{"id":28477919,"url":"https://github.com/cgoncalves94/fastapi-starter","last_synced_at":"2026-04-29T10:31:59.949Z","repository":{"id":295334831,"uuid":"989832224","full_name":"cgoncalves94/fastapi-starter","owner":"cgoncalves94","description":"A scalable FastAPI starter with SQLModel, Pydantic, and a clean, vertical architecture.","archived":false,"fork":false,"pushed_at":"2025-10-21T09:02:43.000Z","size":203,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-21T10:34:37.785Z","etag":null,"topics":["fastapi","pydantic","python","sqlmodel"],"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/cgoncalves94.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-24T23:19:15.000Z","updated_at":"2025-09-07T19:14:25.000Z","dependencies_parsed_at":"2025-05-25T00:59:29.174Z","dependency_job_id":"11a1cda8-b7a9-4bd4-948d-ac54bbfed23e","html_url":"https://github.com/cgoncalves94/fastapi-starter","commit_stats":null,"previous_names":["cgoncalves94/fastapi-starter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cgoncalves94/fastapi-starter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgoncalves94%2Ffastapi-starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgoncalves94%2Ffastapi-starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgoncalves94%2Ffastapi-starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgoncalves94%2Ffastapi-starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cgoncalves94","download_url":"https://codeload.github.com/cgoncalves94/fastapi-starter/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cgoncalves94%2Ffastapi-starter/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32421581,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-29T06:29:02.080Z","status":"ssl_error","status_checked_at":"2026-04-29T06:29:00.631Z","response_time":110,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["fastapi","pydantic","python","sqlmodel"],"created_at":"2025-06-07T17:08:53.526Z","updated_at":"2026-04-29T10:31:59.944Z","avatar_url":"https://github.com/cgoncalves94.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FastAPI Starter Project\n\nA modern FastAPI starter project with SQLModel, Pydantic v2, PostgreSQL, and Docker support. It features user authentication, workspace management with role-based access control, and a **Vertical (Feature-First) Architecture** for enhanced scalability and maintainability.\n\n## 🚀 Features\n\n- **Modern Python**: Uses Python 3.13+ with modern syntax\n- **FastAPI**: Latest FastAPI with async/await support\n- **SQLModel**: Type-safe database operations with SQLModel\n- **Pydantic v2**: Data validation with Pydantic v2 and modern configuration\n- **PostgreSQL**: Production-ready PostgreSQL database with async support\n- **Docker Support**: Containerized development and deployment with Docker Compose\n- **Authentication**: JWT-based authentication with secure password hashing and email verification\n- **Role-based Access**: Workspace-based permissions with different roles\n- **Clean Architecture**: **Vertical (Feature-First) Architecture**, Repository pattern, service layer, and dependency injection\n- **Exception Handling**: Domain-driven exception handling with global handlers\n- **Alembic Migrations**: Database schema management with Alembic\n- **Modern Linting \u0026 Formatting**: Configured with Ruff, MyPy, Bandit, and Pytest for automated code quality.\n\n## 🏗️ Architecture\n\n```\nsrc/app/\n├── main.py                    # FastAPI app initialization\n├── core/                      # Shared infrastructure (config, db, security, exceptions)\n├── api/v1/                    # API layer (router aggregation, shared dependencies)\n│   └── routers/               # Version-specific HTTP routing layer\n├── users/                     # Users Domain (models, schemas, repository, service)\n├── workspaces/                # Workspaces Domain (models, schemas, repository, service)\n└── auth/                      # Auth Domain (schemas, service)\n```\n\nFor more details about the Vertical (Feature-First) Architecture implementation, see the [FastAPI Clean Architecture Guide](docs/FASTAPI_ARCHITECTURE_GUIDE.md).\n\n## Getting Started\n\n### Prerequisites\n\n**Option 1: Docker (Recommended)**\n- Docker and Docker Compose\n- Git\n\n**Option 2: Local Development**\n- Python 3.13+\n- PostgreSQL 17.5+\n- uv (recommended) or pip\n\n### 🐳 Quick Start with Docker\n\nTo get the project up and running for the first time with Docker:\n\n1.  **Clone the repository:**\n    ```bash\n    git clone cgoncalves94/fastapi-starter\n    cd fastapi-starter\n    ```\n2.  **Copy environment variables:**\n    ```bash\n    cp .env.example .env\n    ```\n3.  **Start the application services:**\n    ```bash\n    make docker-up\n    ```\n    This command will automatically build Docker images, start all services, and run database migrations.\n\n4.  **Access the application:**\n    -   **API**: http://localhost:8000\n    -   **API Docs**: http://localhost:8000/docs\n    -   **PgAdmin** (optional): `make docker-pgadmin` then visit http://localhost:5050\n\n**Important Notes for Docker Usage:**\n\n*   **`make docker-up` handles everything**: Database migrations are automatically applied during container startup via the Docker entrypoint script.\n*   **For subsequent starts**: Just run `make docker-up` again - it will start containers without rebuilding unless needed.\n\n\n### 🖥️ Local Development Setup\n\n1. Clone the repository\n2. Copy environment variables:\n   ```bash\n   cp .env.example .env\n   ```\n\n3. Create and activate a virtual environment using `uv`:\n   ```bash\n   uv venv --python 3.13\n   source .venv/bin/activate\n   ```\n\n4. Install dependencies:\n   ```bash\n   make install\n   ```\n\n5. Run database migrations:\n   ```bash\n   make migrate-upgrade\n   ```\n\n6. Start the development server:\n   ```bash\n   make dev-server\n   ```\n\n## 🚀 Usage\n\n### 🐳 Docker Commands\n\nFor containerized development:\n\n* `make docker-build` - Build Docker images\n* `make docker-up` - Start all services (PostgreSQL + FastAPI)\n* `make docker-down` - Stop all services\n* `make docker-logs` - View logs from all services\n* `make docker-shell` - Open shell in FastAPI container\n* `make docker-db-shell` - Open PostgreSQL shell\n* `make docker-pgadmin` - Start with PgAdmin UI (http://localhost:5050)\n\n### 🗃️ Database Commands\n\n* `make migrate-create MSG=\"Your migration message\"` - Create a new migration\n* `make migrate-upgrade` - Apply all pending migrations\n* `make migrate-rollback` - Rollback one migration\n* `make migrate-status` - Show current migration status\n* `make migrate-history` - Show migration history\n* `make db-info` - Show database information\n* `make db-backup` - Create database backup\n* `make db-restore BACKUP_FILE=\"filename.sql\"` - Restore from backup\n\n### 🚀 Development Commands\n\n* `make install` - Install dependencies\n* `make dev-server` - Run the development server (local)\n* `make lint` - Run linters\n* `make test` - Run tests\n\n## 📚 API Documentation\n\nFastAPI automatically generates interactive API documentation:\n\n* **Swagger UI**: Visit `/docs` for interactive API exploration and testing\n* **ReDoc**: Visit `/redoc` for alternative documentation format\n* **OpenAPI JSON**: Available at `/openapi.json` for API specification\n\nWhen running locally (`make dev-server`), access the documentation at:\n- http://localhost:8000/docs (Swagger UI)\n- http://localhost:8000/redoc (ReDoc)\n\n## ⚙️ Configuration\n\nEdit the `.env` file to configure PostgreSQL connection and other settings:\n- PostgreSQL host, port, user, password, and database name\n- JWT secret key and expiration\n- CORS settings\n- Debug mode\n\nFor detailed instructions on database schema management and migrations, see the [Alembic Migrations Guide](docs/ALEMBIC_MIGRATIONS_GUIDE.md).\n\n## 📝 License\n\nMIT License - see LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgoncalves94%2Ffastapi-starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcgoncalves94%2Ffastapi-starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcgoncalves94%2Ffastapi-starter/lists"}