{"id":30615681,"url":"https://github.com/justanotherbyte/react-python-autumn-template","last_synced_at":"2025-08-30T08:06:39.965Z","repository":{"id":301532982,"uuid":"1009267559","full_name":"justanotherbyte/react-python-autumn-template","owner":"justanotherbyte","description":"Starter React frontend + Python backend template with Autumn ","archived":false,"fork":false,"pushed_at":"2025-06-27T10:31:01.000Z","size":6554,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-27T11:26:57.900Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/justanotherbyte.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-06-26T21:14:39.000Z","updated_at":"2025-06-27T10:32:16.000Z","dependencies_parsed_at":"2025-06-27T11:37:49.805Z","dependency_job_id":null,"html_url":"https://github.com/justanotherbyte/react-python-autumn-template","commit_stats":null,"previous_names":["justanotherbyte/react-python-autumn-template"],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/justanotherbyte/react-python-autumn-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanotherbyte%2Freact-python-autumn-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanotherbyte%2Freact-python-autumn-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanotherbyte%2Freact-python-autumn-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanotherbyte%2Freact-python-autumn-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/justanotherbyte","download_url":"https://codeload.github.com/justanotherbyte/react-python-autumn-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/justanotherbyte%2Freact-python-autumn-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272821200,"owners_count":24998599,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-30T02:00:09.474Z","response_time":77,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-30T08:06:32.963Z","updated_at":"2025-08-30T08:06:39.958Z","avatar_url":"https://github.com/justanotherbyte.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# React + Python Autumn Starter Template\n\n[Autumn](https://useautumn.com) is an open-source layer between Stripe and your application, allowing you to create any pricing model and embed it with a few lines of code.\n\nThis template demonstrates how you can set up pricing for a simple AI chatbot application using a React frontend and a Python backend.\n\nView the example app here: https://nextjs-autumn-template.vercel.app/\n\n## Getting Started\n\n1. Clone the repository:\n\n```bash\ngit clone https://github.com/justanotherbyte/react-python-autumn-template.git\n\n# Backend\ncd backend/\npip install -r requirements.txt\n\ncd ../\n\n# Frontend\ncd frontend/\nnpm install\n```\n\n\u003e [!NOTE]\n\u003e Python 3.9+ is required.\n\n\n2. Create an account at [app.useautumn.com](https://app.useautumn.com)\n\n3. Get your Autumn secret key from the [sandbox environment](https://app.useautumn.com/sandbox/dev) and add it to your environment variables:\n\n```bash\nexport AUTUMN_SECRET_KEY=am_sk_test_OAFUOL0meFCjpMMmFeU13gHnrEOGAHWp2YTLECyY7k\n```\n\n4. Connect your Stripe account in the [integrations page](https://app.useautumn.com/sandbox/integrations/stripe)\n\n5. Run the backend server:\n\n```bash\nuvicorn app:app --port 8000\n```\n\n6. Run the frontend server:\n\n```bash\nnpm run dev\n```\n\n## Understanding the Implementation\n\nThis template implements a simple AI chat message app where users can:\n\n- Send messages (with usage limits)\n- Upgrade to a pro or ultra plan\n- View their usage and subscription details\n\n### Key Endpoints\n\n1. **Check if a user can access a feature** (`/check`)\n\n```typescript\nimport { useAutumn } from \"autumn-js/react\";\nconst { check } = useAutumn();\n\n// Check if user can send a message\nconst { data } = await check({\n  featureId: \"messages\",\n});\n\nif (!allowed) {\n  toast.error(\"You're out of messages!\");\n  return;\n}\n```\n\n2. **Track a user's usage of a feature** (`/track`)\n\n```typescript\nconst { track } = useAutumn();\n\n// Record that a message was sent\nawait track({\n  featureId: \"messages\",\n});\n```\n\n3. **Get a Stripe Checkout URL so the customer can purchase a plan** (`/attach`)\n\n```typescript\n// Upgrade user to pro plan\nconst { attach } = useAutumn();\n\nconst onCheckoutClicked = async () =\u003e {\n  await attach({\n    productId: \"pro\",\n  });\n};\n```\n\nOur shadcn/ui components also trigger automatically to handle paywalls, upgrades, downgrades, and renewals. If you change the products in Autumn, they will automatically update too, so you don't need to make any code changes.\n\n\u003c!-- ### Additional Features\n\nThe template also includes `getOrCreateCustomer` to fetch customer details, entitlements, and subscription status, which is used in the customer details card in the UI:\n\n```typescript\nconst customer = await getOrCreateCustomer(CUSTOMER_ID);\n// Returns: customer details, product subscriptions, and feature entitlements\n``` --\u003e\n\n## Learn More\n\n- [Autumn Documentation](https://docs.useautumn.com)\n- [React Router Documentation](https://reactrouter.com/docs)\n- [Autumn JS](https://github.com/useautumn/autumn-js)\n- [Autumn Py](https://github.com/useautumn/autumn-py)\n\n## Troubleshooting\n\nYou may encounter CORS errors if you are running the frontend on a port different to the default one provided in this template. To fix this, change the `backend/app.py` file to include the port your frontend is running on:\n\n```python\nORIGINS = [\"http://localhost:\u003cPORT\u003e\"]\n\napp.add_middleware(\n    CORSMiddleware,\n    allow_origins=ORIGINS,\n    allow_credentials=True,\n    allow_methods=[\"*\"],\n    allow_headers=[\"*\"],\n)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustanotherbyte%2Freact-python-autumn-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjustanotherbyte%2Freact-python-autumn-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjustanotherbyte%2Freact-python-autumn-template/lists"}