https://github.com/krytos/fastapi-production-template
Production-ready FastAPI template with clean architecture, async SQLAlchemy, strict quality gates, Docker/Terraform foundations, and automated PyPI publishing.
https://github.com/krytos/fastapi-production-template
api async backend docker fastapi github-actions pypi python sqlalchemy templates terraform testing
Last synced: 3 months ago
JSON representation
Production-ready FastAPI template with clean architecture, async SQLAlchemy, strict quality gates, Docker/Terraform foundations, and automated PyPI publishing.
- Host: GitHub
- URL: https://github.com/krytos/fastapi-production-template
- Owner: Krytos
- Created: 2026-04-02T09:56:07.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2026-04-02T14:39:45.000Z (3 months ago)
- Last Synced: 2026-04-08T03:02:55.226Z (3 months ago)
- Topics: api, async, backend, docker, fastapi, github-actions, pypi, python, sqlalchemy, templates, terraform, testing
- Language: Python
- Homepage: https://pypi.org/project/fastapi-production-template/
- Size: 124 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ⚡ FastAPI Production Template
**Battle-tested Python backend architecture — ready to ship.**
*By [Kevin Meinon](mailto:kevin@meinon.de) · Freelance Backend Engineer*
[](https://github.com/Krytos/fastapi-production-template/actions/workflows/ci.yml)
[](https://github.com/Krytos/fastapi-production-template/actions/workflows/tests.yml)
[](https://github.com/Krytos/fastapi-production-template/blob/main/pyproject.toml)
[](https://pypi.org/project/fastapi-production-template/)
[](https://python.org)
[](https://fastapi.tiangolo.com/)
[](https://flask.palletsprojects.com/)
[](https://www.djangoproject.com/)
[](https://www.postgresql.org/)
[](https://www.docker.com/)
[](https://www.terraform.io/)
[](https://aws.amazon.com/)
[](https://azure.microsoft.com/)
[](https://cloud.google.com/)
[](https://github.com/astral-sh/uv)
[](https://github.com/astral-sh/ruff)
**→ [Available for freelance projects](mailto:kevin@meinon.de?subject=FastAPI%20Freelance%20Inquiry) ←**
---
## About
I'm **Kevin Meinon**, a freelance backend engineer specialising in Python and production-grade API systems — primarily **FastAPI**, but equally at home with **Flask** and **Django** depending on what the project calls for.
This template is a living showcase of the architecture patterns and engineering standards I bring to every engagement — not boilerplate to fill in, but a reference for what production-ready actually looks like.
**What I build:**
- High-throughput REST & async APIs with clean domain separation
- End-to-end CI pipelines with strict quality gates (lint, types, coverage)
- Cloud-portable infrastructure baselines (AWS / Azure / GCP)
- Systems that are easy for your team to own after I'm done
If your team needs a backend that ships fast and holds up — [let's talk](mailto:kevin@meinon.de).
---
## What this demonstrates
| Concern | Approach |
|---|---|
| **Architecture** | App factory, versioned routes, repository pattern, domain layer separation — framework-agnostic patterns that port cleanly to Flask or Django |
| **Data layer** | SQLAlchemy async ORM + asyncpg + dependency-injected sessions |
| **Auth** | API key middleware (`X-API-Key`) with per-route enforcement |
| **Observability** | Structured JSON logging, request ID propagation, Prometheus-style metrics |
| **Quality** | 100% coverage gate, Ruff linting, Ty type checking, pre-commit hooks |
| **Infrastructure** | Terraform modules for ECR (AWS), ACR (Azure), GAR (GCP) |
| **Dev experience** | Docker Compose with hot-reload dev profile, full local parity |
---
## Tech stack
- **Runtime:** Python 3.14
- **Framework:** FastAPI + Pydantic v2 · Flask · Django
- **Database:** PostgreSQL · SQLAlchemy async · asyncpg
- **Tooling:** uv · Ruff · Ty · pytest · tox
- **Infrastructure:** Docker · Docker Compose · Terraform (AWS / Azure / GCP)
- **CI/CD:** GitHub Actions
> The FastAPI layer is intentionally thin and architecturally isolated — swapping it for Flask or Django is a configuration change, not a rewrite.
---
## API surface
```
GET /api/v1/health # public
GET /api/v1/metrics # public
POST /api/v1/documents/analyze # requires X-API-Key
POST /api/v1/documents # requires X-API-Key
GET /api/v1/documents # requires X-API-Key
GET /api/v1/documents/{document_id} # requires X-API-Key
PUT /api/v1/documents/{document_id} # requires X-API-Key
DELETE /api/v1/documents/{document_id} # requires X-API-Key
```
---
## Local development
```bash
uv sync --all-groups
uv run uvicorn fastapi_production_template.main:app --reload
```
```bash
curl -H "X-API-Key: dev-api-key" http://localhost:8000/api/v1/documents
```
## Quality gates
```bash
uv run pytest # tests + coverage
uv run ruff check . # linting
uv run ty check . # type checking
uv run tox # full gate
```
```bash
uv run pre-commit install
uv run pre-commit run --all-files
```
## Docker
```bash
docker compose up --build
# Dev profile with hot reload
docker compose --profile dev up --build --watch api-dev postgres
```
## Terraform
```bash
terraform -chdir=infra/terraform-aws init && validate
terraform -chdir=infra/terraform-azure init && validate
terraform -chdir=infra/terraform-gcp init && validate
```
---
## Hire me
**I'm available for backend contracts and freelance projects.**
Backend feature delivery · API performance & reliability · CI quality gates · Cloud deployment
[kevin@meinon.de](mailto:kevin@meinon.de?subject=Backend%20Project%20Inquiry)