Skip to content

Toolset · Pydantic, SQLAlchemy, async

Python / FastAPI

  • Python
  • FastAPI
  • Pydantic

FastAPI is our default Python backend: async, typed, and self-documenting. Pydantic for validation, SQLAlchemy for data, and a real task queue for background work.

Where two tools compete, the one marked our default is what we reach for.

01

Packaging & deps

2 tools
uvour default

Extremely fast package/venv manager and resolver. Our default over pip/Poetry for new work.

Mature dependency management and packaging.

02

Framework & DI

1 tool
FastAPIour default

Async web framework with typed request/response models and OpenAPI out of the box. Dependency injection is built in via Depends. Our default.

def get_db() -> Session: ...          # a dependency

def get_repo(db: Session = Depends(get_db)) -> UserRepository:
    return UserRepository(db)

@app.get("/users/{id}")
async def read_user(id: str, repo: UserRepository = Depends(get_repo)):
    return await repo.find(id)
03

Validation & settings

1 tool
Pydantic v2our default

Data validation and settings via type hints — parse at the boundary. Our default.

04

Environment variables

1 tool

Type-safe environment configuration — define a Settings class with validated fields, load from .env in development, and read config from a single settings object everywhere. Fail fast at startup on anything missing or invalid, and never hardcode values. Our default.

05

ORM & migrations

2 tools
SQLAlchemy 2.0our default

The definitive Python ORM/toolkit with a modern async API. Mind session-per-request and isolation. Our default.

Alembicour default

Migrations for SQLAlchemy.

06

Authentication & authorization

2 tools

python-jose for JWTs and passlib for password hashing. Implement auth as a FastAPI dependency (Depends) that verifies the token and returns the user, and wire OAuth2PasswordBearer so the flow shows up in the OpenAPI docs. Never trust decoded claims without verifying the signature. Our default.

Enforce authorization with a dependency that checks the user's role — resolved server-side, never from client input. See the RBAC spec for the data model and enforcement points.

07

Async DB & HTTP

2 tools
asyncpgour default

Fast async PostgreSQL driver.

httpxour default

Async-capable HTTP client. Our default.

08

Task queue

2 tools
Celeryour default

Distributed task queue (Redis/RabbitMQ). Keep tasks idempotent and carry IDs, not objects. Our default.

A simpler, more ergonomic alternative to Celery — fewer features, less complexity, cleaner API. Decision rule: start with Celery for its robustness and ecosystem; consider Dramatiq for smaller projects or simpler workloads where Celery's complexity is overkill.

09

Security

3 tools
CORSMiddlewareour default

Configure CORS with FastAPI's built-in middleware — allow only trusted origins, never a wildcard alongside credentials. Baseline hygiene for any browser-facing API. Our default.

Basic rate limiting to blunt brute-force and abuse; fastapi-limiter is Redis-backed so limits hold across multiple workers.

Add security headers (CSP, X-Content-Type-Options, and more) via a custom middleware or the secure library.

10

Testing & serving

2 tools
pytestour default

Testing with httpx AsyncClient for API tests. Our default.

ASGI server; run Uvicorn workers under Gunicorn in production.

11

Monitoring & observability

4 tools

Error and performance monitoring with a FastAPI/Starlette integration. Our default for errors.

OpenTelemetryour default

Vendor-neutral traces and metrics; auto-instrument FastAPI, SQLAlchemy, and httpx, export anywhere. Our default for tracing.

One-line Prometheus metrics endpoint for FastAPI — request latency, counts, and status codes.

Structured, context-aware logging that ships clean JSON to your log pipeline.

12

CI/CD

5 tools
GitHub Actionsour default

uv sync, run pytest, then build the image. Our default CI.

Dockerour default

Containerise with a slim image for a reproducible deploy. Our default.

Push-to-deploy container hosting for the FastAPI service.

Handle SIGTERM to stop accepting new requests, let in-flight requests finish, and close database and queue connections before exiting. In FastAPI, do startup/shutdown work in the lifespan handler (async with). This prevents dropped requests during restarts and is what makes zero-downtime deploys actually zero-downtime.

Run ruff and formatters on commit and in CI — fail fast on style/lint.

13

Linting & formatting

3 tools
Ruffour default

Extremely fast linter and formatter that replaces flake8, isort, and Black. Our default.

mypyour default

Static type checking for Python — enforce your type hints in CI. Our default.

The uncompromising formatter, if you're not using ruff format.

Building on Python / FastAPI?

We ship production Python / FastAPIwith exactly this stack. Tell us what you're building.

Start a conversation