FastAPI Dependency Injection: Scopes, Overrides and Testing
How FastAPI dependency injection resolves a per-request graph, manages app-lifetime resources, cleans up with yield, and stays testable with dependency_overrides.
14 min read
Tag
How FastAPI dependency injection resolves a per-request graph, manages app-lifetime resources, cleans up with yield, and stays testable with dependency_overrides.
14 min read
Set up structlog in FastAPI: bind request IDs via contextvars, route uvicorn and stdlib logs through one processor chain, and emit correlated JSON logs.
13 min read
Learn how SQLAlchemy async and asyncpg relate in FastAPI, how to wire sessions and connection pools, avoid lazy-loading traps, and pick the right layer.
13 min read
Use FastAPI dependency injection to own SQLAlchemy session and auth lifetimes, compose Depends chains, and test cleanly with dependency overrides.
18 min read
Choose between FastAPI BackgroundTasks, ARQ, and Celery based on durability, retries, and isolation, with idempotency, enqueue, and testing guidance.
15 min read
Choose among Python backend frameworks by deciding how much the framework should own and whether your API workload truly needs async Python.
13 min read