What problem does it solve?
Large FastAPI projects struggle with event-loop blocking, connection pool exhaustion, brittle authentication, unreliable background processing, and fragile deployments when patterns for async databases, migrations, dependency injection, logging, and worker configuration are missing. This Skill provides clear, production-ready patterns and diagnostic checklists to avoid performance regressions, security gaps, and operational failures as traffic and team size grow.
Core Features & Use Cases
- Domain-driven project structure for organizing routers, services, repositories, and shared core modules.
- Async SQLAlchemy 2.0 + Alembic async migrations with session management and pool sizing guidance to prevent connection exhaustion.
- Auth & middleware patterns including JWT/OAuth2 flows, RBAC, rate limiting, CORS, and request ID propagation.
- Background processing strategies: when to use FastAPI BackgroundTasks vs Celery + Redis, plus Docker Compose examples for workers.
- Testing & observability: httpx AsyncClient fixtures, dependency overrides for tests, structured JSON logging with structlog, and health/readiness endpoints.
- Deployment & scaling: uvicorn/gunicorn worker recommendations, Docker multi-stage builds, Kubernetes manifests, and graceful shutdown patterns.
- Use Case: bootstrapping a medium-to-large API that needs async DB access, role-based auth, reliable background jobs, and containerized production deployment.
Quick Start
Scaffold a production-grade FastAPI project using async SQLAlchemy, Alembic migrations, JWT auth, Redis caching, Celery for background tasks, structured logging, and Docker/Kubernetes deployment configuration.