all templates
API & Backend

FastAPI Service

A production Python API: auth, migrations, workers, and observability from commit one.

The Python backend the way it ends up looking after a year in production — starting on day one. Async SQLAlchemy, Alembic migrations, JWT auth with scopes, background workers and structured logging, all arranged so the next endpoint is a ten-minute job.

What's inside

  • JWT auth with role scopes and refresh flow
  • Async SQLAlchemy + Alembic migrations
  • Background workers with retry semantics
  • Structured logging, /health and /metrics
  • Pagination and filtering conventions
  • pytest suite with isolated test database

Quickstart

$ git clone git@github.com:devai-io/fastapi-service.git my-api$ cd my-api && uv sync$ cp .env.example .env$ uv run fastapi dev app/main.py

from production

The same shape as the APIs running several live products in production today.