Skip to main content

Production-ready FastAPI template with CI/CD, Terraform, and complete tests

Project description

⚡ FastAPI Production Template

Battle-tested Python backend architecture — ready to ship.

By Kevin Meinon · Freelance Backend Engineer


CI Tests Coverage PyPI


Python 3.14 FastAPI Flask Django PostgreSQL Docker Terraform AWS Azure GCP uv Ruff


Available for freelance projects


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

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fastapi_production_template-0.1.4.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fastapi_production_template-0.1.4-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_production_template-0.1.4.tar.gz.

File metadata

File hashes

Hashes for fastapi_production_template-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4d617706f3a55dbcc98409c2eb294cd10e00bce0bb5e08dc181e604127a3e7bd
MD5 a7b8294e3f2b54a8eaaec2c066ff3db1
BLAKE2b-256 84e7281bf9646e43ea5cee83a3d5566b579535a3942f4830674a5cc54c7cab0e

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_production_template-0.1.4.tar.gz:

Publisher: ci.yml on Krytos/fastapi-production-template

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastapi_production_template-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_production_template-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 4c9fe756fbd97be46807ff591ce28ab94b525708be686507eadba675cf9b8ffc
MD5 4cd3ef4d7e282ceb80657a05b35fb8c9
BLAKE2b-256 718b5722f6146162de1563dde2d2da212b0762fd284beac2c676f13486c8ef2a

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastapi_production_template-0.1.4-py3-none-any.whl:

Publisher: ci.yml on Krytos/fastapi-production-template

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page