{"id":28549133,"url":"https://github.com/ysskrishna/fastapi-supabase-starter","last_synced_at":"2026-04-12T18:36:55.077Z","repository":{"id":297883042,"uuid":"995542741","full_name":"ysskrishna/fastapi-supabase-starter","owner":"ysskrishna","description":"A starter template for building secure and scalable FastAPI applications with Supabase authentication integration. This template provides a solid foundation for modern web applications, combining the power of FastAPI's high-performance framework with Supabase's robust authentication system.","archived":false,"fork":false,"pushed_at":"2025-06-08T04:17:11.000Z","size":40,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-08T05:39:53.254Z","etag":null,"topics":["authentication","fastapi","fastapi-boilerplate","jwt","jwt-authentication","python","python-jose","python3","sqlalchemy","sqlite","supabase","template","uv","ysskrishna"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ysskrishna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-03T16:31:17.000Z","updated_at":"2025-06-08T04:17:24.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd62108b-6414-4368-9d77-92e179959e76","html_url":"https://github.com/ysskrishna/fastapi-supabase-starter","commit_stats":null,"previous_names":["ysskrishna/fastapi-supabase-starter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ysskrishna/fastapi-supabase-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysskrishna%2Ffastapi-supabase-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysskrishna%2Ffastapi-supabase-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysskrishna%2Ffastapi-supabase-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysskrishna%2Ffastapi-supabase-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ysskrishna","download_url":"https://codeload.github.com/ysskrishna/fastapi-supabase-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ysskrishna%2Ffastapi-supabase-starter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263550730,"owners_count":23478864,"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","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":["authentication","fastapi","fastapi-boilerplate","jwt","jwt-authentication","python","python-jose","python3","sqlalchemy","sqlite","supabase","template","uv","ysskrishna"],"created_at":"2025-06-10T02:00:28.465Z","updated_at":"2026-04-12T18:36:50.053Z","avatar_url":"https://github.com/ysskrishna.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI Supabase Starter\n\n[![Python](https://img.shields.io/badge/Python-3.8+-blue.svg)](https://www.python.org/downloads/)\n[![FastAPI](https://img.shields.io/badge/FastAPI-0.95.1-green.svg)](https://fastapi.tiangolo.com/)\n[![SQLAlchemy](https://img.shields.io/badge/SQLAlchemy-2.0.30-blue.svg)](https://www.sqlalchemy.org/)\n[![Supabase](https://img.shields.io/badge/Supabase-Platform-orange.svg)](https://supabase.com/)\n[![uv](https://img.shields.io/badge/uv-Package%20Manager-purple.svg)](https://github.com/astral-sh/uv)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nA starter template for building secure and scalable FastAPI applications with Supabase authentication integration. This template provides a solid foundation for modern web applications, combining the power of FastAPI's high-performance framework with Supabase's robust authentication system.\n\n## Use Cases\n\nThis starter template is perfect for:\n- Building secure backend APIs\n- Creating user authentication systems\n- Developing full-stack applications\n- Learning FastAPI and Supabase integration\n- Prototyping new projects quickly\n\n## Features\n\n- FastAPI backend with SQLAlchemy ORM\n- Secure Supabase JWT authentication integration\n  - Automatic token validation and parsing\n  - Protected route handling\n- User management endpoints\n- CORS middleware enabled\n- SQLite database (can be easily switched to other databases)\n- Swagger UI for API documentation\n\n## Prerequisites\n\n- Python 3.8+\n- uv (Python package installer)\n- Supabase account and project\n\n## Installation\n\n1. Clone the repository:\n```bash\ngit clone \u003crepository-url\u003e\ncd fastapi-supabase-starter\n```\n\n2. Install dependencies using uv:\n```bash\nuv venv\n.venv\\Scripts\\activate\nuv sync\n```\n(Optional) To add new packages to your project:\n```bash\nuv add \u003cpackage-name\u003e\n```\n\n3. Set up environment variables:\nCreate a `.env` file in the project root with the following variables:\n```env\nSUPABASE_PROJECT_ID=your_project_id\nSUPABASE_JWT_SECRET=your_jwt_secret\nDATABASE_URL=your_database_url\n```\n\n## Supabase Setup\n\n1. Create a Supabase project at https://supabase.com\n2. Get your project credentials:\n   - SUPABASE_PROJECT_ID: Found in `Project Settings \u003e General \u003e Project ID`\n   - SUPABASE_JWT_SECRET: Found in `Project Settings \u003e API \u003e JWT Settings \u003e JWT Secret`\n3. Add these credentials to your `.env` file\n\n## JWT Authentication\n\nThis project uses Supabase's JWT authentication with the following features:\n\n- HS256 symmetric encryption\n- Automatic JWT validation and parsing\n- User session management\n- Protected route handling\n\n### Getting a JWT Token\n\n1. Using Supabase Client:\n```javascript\nconst { data, error } = await supabase.auth.signInWithPassword({\n  email: 'user@example.com',\n  password: 'password'\n})\n// JWT token will be in data.session.access_token\n```\n\n2. Using REST API:\n```bash\ncurl -X POST 'https://[YOUR_PROJECT_ID].supabase.co/auth/v1/token?grant_type=password' \\\n-H \"apikey: [YOUR_ANON_KEY]\" \\\n-H \"Content-Type: application/json\" \\\n-d '{\"email\":\"user@example.com\",\"password\":\"password\"}'\n```\n\n### Using JWT in API Requests\n\nInclude the JWT token in the Authorization header:\n```\nAuthorization: Bearer \u003cyour_jwt_token\u003e\n```\n\n## Project Structure\n\n```\nfastapi-supabase-starter/\n├── core/               # Core utilities and configurations\n│   ├── config.py      # Environment configuration\n│   ├── dbutils.py     # Database utilities\n│   └── jwtutils.py    # JWT authentication utilities\n├── models/            # SQLAlchemy models\n├── routers/           # API route handlers\n├── main.py           # Application entry point\n├── requirements.txt   # Project dependencies\n└── README.md         # Project documentation\n```\n\n## API Endpoints\n\n### User Management\n\n- `POST /user/create` - Create user in database, using supabase jwt payload (requires Supabase JWT)\n- `GET /user/me` - Retrieves user details from database (requires Supabase JWT)\n\n## Running the Application\n\nStart the development server:\n\n```bash\npython main.py\n```\n\nThe server will start at `http://localhost:8000`\n\n## API Documentation\n\nSwagger UI documentation is available at: `http://localhost:8000/docs`\n\n## Security Best Practices\n\n- Never expose your JWT_SECRET in client-side code\n- Keep your JWT_SECRET secure and rotate it periodically\n- Use HTTPS for all API requests\n- Set appropriate token expiration times\n- Validate all claims in the JWT payload\n\n## References\n\n### Supabase Documentation\n- [Supabase Authentication Overview](https://supabase.com/docs/guides/auth)\n- [JWT Authentication Guide](https://supabase.com/docs/guides/auth/jwt)\n- [Security Best Practices](https://supabase.com/docs/guides/auth/managing-user-data)\n- [API Reference](https://supabase.com/docs/reference/api/introduction)\n\n### JWT Resources\n- [JWT.io](https://jwt.io/) - Learn about JSON Web Tokens\n- [JWT Best Practices](https://auth0.com/blog/a-look-at-the-latest-draft-for-jwt-bcp/)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysskrishna%2Ffastapi-supabase-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fysskrishna%2Ffastapi-supabase-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fysskrishna%2Ffastapi-supabase-starter/lists"}