A production-ready template for building and deploying FastAPI services in containers.
This project provides a complete starter template for developing FastAPI applications with modern Python tooling. It's designed to help you quickly bootstrap new API services with best practices already in place.
- FastAPI - High-performance web framework for building APIs
- Clean Architecture - Organized project structure with separation of concerns
- Type Safety - Fully typed Python codebase with MyPy integration
- Testing - Pytest setup with sample unit and integration tests
- Modern Python Tooling - Uses uv for faster package management and virtual environments
- Development Mode - Hot reloading support for rapid development
- Production-Ready - Container-optimized setup for deployment
- Python 3.11
- uv
-
Clone this repository or use it as a template:
git clone https://github.com/hsperker/fastapi-container-app-starter.git cd fastapi-container-app-starter
-
Run type checking to verify code quality:
uv run mypy app tests
Note: This command will automatically create a virtual environment and install the necessary dependencies.
-
Run tests to ensure everything is working properly:
uv run pytest
-
Start the development server:
uv run fastapi dev
app/
├── __init__.py
├── main.py
├── api/ # API routes and schemas
├── core/ # Core business logic
└── infrastructure/ # Repositories
tests/
├── core/ # Unit tests for core functionality
└── integration/ # Integration tests
When running the server, API documentation is automatically generated:
- Swagger UI: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc