⚡ FastAPI Production Template
Battle-tested Python backend architecture — ready to ship.
By Kevin Meinon · Freelance Backend Engineer
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.
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
uv sync --all-groups
uv run uvicorn fastapi_production_template.main:app --reload
curl -H "X-API-Key: dev-api-key" http://localhost:8000/api/v1/documents
Quality gates
uv run pytest # tests + coverage
uv run ruff check . # linting
uv run ty check . # type checking
uv run tox # full gate
uv run pre-commit install
uv run pre-commit run --all-files
Docker
docker compose up --build
# Dev profile with hot reload
docker compose --profile dev up --build --watch api-dev postgres
Terraform
terraform -chdir=infra/terraform-aws init && validate
terraform -chdir=infra/terraform-azure init && validate
terraform -chdir=infra/terraform-gcp init && validate
Metadata
Release files for fastapi-production-template 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fastapi_production_template-0.1.4.tar.gz | 10.3 kB | With provenance | Details for fastapi_production_template-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fastapi_production_template-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for fastapi_production_template-0.1.4-py3-none-any.whl |
Total release size: 27.9 kB
Release files / fastapi_production_template-0.1.4.tar.gz
| Download URL | fastapi_production_template-0.1.4.tar.gz |
|---|---|
| Size | 10.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4d617706f3a55dbcc98409c2eb294cd10e00bce0bb5e08dc181e604127a3e7bd
|
|
BLAKE2b-256 checksum How to use checksums |
84e7281bf9646e43ea5cee83a3d5566b579535a3942f4830674a5cc54c7cab0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.
Transparency logRelease files / fastapi_production_template-0.1.4-py3-none-any.whl
| Download URL | fastapi_production_template-0.1.4-py3-none-any.whl |
|---|---|
| Size | 17.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4c9fe756fbd97be46807ff591ce28ab94b525708be686507eadba675cf9b8ffc
|
|
BLAKE2b-256 checksum How to use checksums |
718b5722f6146162de1563dde2d2da212b0762fd284beac2c676f13486c8ef2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.
Transparency logSecurity for fastapi-production-template 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for fastapi_production_template-0.1.4.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 2, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.