FastAPI is our default Python framework. Across dozens of production systems we have converged on a small set of patterns that make services boring, observable and easy to evolve.
Dependency Injection Everywhere
Database sessions, auth context, feature flags and external clients all flow through FastAPI's Depends system. This makes testing trivial.
Background Work Belongs in Celery
FastAPI's BackgroundTasks are fine for fire-and-forget side effects under 1 second. Anything longer goes to Celery plus Redis with idempotent task design.
Structured Logging
Every log line is JSON with a request_id, user_id and route. We propagate the request_id through Celery tasks via task headers.
Pydantic Is the API Contract
Request and response models live in a shared schemas package and are version-tagged. Breaking changes require a new schema version.



