Build production APIs with Python & FastAPI
A hands-on backend path — modern Python, FastAPI's dependency injection system, REST APIs, SQLAlchemy, authentication, testing and async concurrency — ending with a capstone service you containerize and deploy yourself.
Prerequisites & tooling
What you should already know
- Basic programming in any language — variables, functions, loops
- Comfortable with the command line and Git
- No prior Python or web framework experience required
- Python 3.12 and a code editor like VS Code installed
Stack you'll work with
The same tools teams use to ship real Python services in production.
Your 15-week learning path
Twelve modules, from your first typed function to a tested, secured, observable service you deploy in a container.
Python Foundations & Environment Setup
Refresh modern Python and get your backend toolchain running.
- Type hints, dataclasses & the
matchstatement - Python 3.12, virtual environments & Poetry
- Running your first FastAPI application
FastAPI Core & Dependency Injection
Understand the system that powers every FastAPI application.
- Path operations, path/query params & Pydantic models
Depends()& the dependency injection system- Auto-generated docs with Swagger UI & ReDoc
Building REST APIs
Design and build clean, well-validated HTTP APIs.
APIRouter, request/response models & status codes- Validation with Pydantic & custom validators
- Centralized error handling with exception handlers
Data Persistence with SQLAlchemy
Model your domain and talk to a real relational database.
- Models, sessions & the SQLAlchemy 2.0 query API
- Relationships, lazy loading & transactions
- Schema migrations with Alembic
Authentication & Security
Lock down your API with modern, stateless authentication.
- Password hashing with
passlib& OAuth2 password flow - JWT-based authentication & refresh tokens
- Scoped permissions via dependency-based authorization
Testing FastAPI Applications
Build a layered test suite you can trust before every deploy.
- Unit testing with pytest & fixtures
TestClient& dependency overrides- Real-database integration tests with Testcontainers
Microservices & Messaging
Move from a single service to a small distributed system.
- Service-to-service calls with
httpx - Event-driven messaging with Celery & RabbitMQ
- Resilience patterns: retries, timeouts & circuit breakers
Caching & Performance
Keep a growing service fast under real load.
- Caching with Redis & cache invalidation strategies
- Connection pooling & query performance
- Background tasks with
BackgroundTasks
Observability & Production Readiness
Understand what your service is doing once it's live.
- Structured logging & health-check endpoints
- Metrics with
prometheus-client - Distributed tracing basics
Containerization & Deployment
Package and ship your service the way production teams do.
- Multi-stage Docker images for a Python service
- CI/CD pipelines for a FastAPI service
- Deploying with Gunicorn + Uvicorn workers
Async Python & Concurrency
A deep dive into the async model FastAPI is built on.
asyncio: the event loop, coroutines & tasks- Async database drivers & when
async defactually helps - When to reach for threads, processes, or Celery instead
Capstone: Ship a Production FastAPI Service
Apply every module in one project — built, tested, secured and deployed by you.
- Fully tested, secured, containerized service
- Code review & deployment walkthrough
- Portfolio-ready project you can show employers