FastAPI and Modern Frameworks
A three-day training on building high-performance async APIs with FastAPI. From Pydantic models and automatic documentation to production deployment with Docker and Uvicorn.
Duration
3 days (21 hours)
Format
50 percent presentation, 50 percent exercises
Prerequisites
Solid Python fundamentals required, async basics recommended
Materials
Virtual machines provided, electronic course materials
Day 1 — FastAPI Fundamentals
Getting Started
- FastAPI project setup and structure
- Async endpoints: async def vs def, when to use each
- Path parameters, query parameters, and request body
- Pydantic models for request and response validation
Automatic Documentation
- OpenAPI and Swagger UI: automatic API documentation
- Customizing schemas, examples, and descriptions
- ReDoc alternative documentation
Advanced Request Handling
- Dependency injection: Depends, sub-dependencies, overrides
- Request validation: headers, cookies, form data, file uploads
- Response models: status codes, response classes, streaming responses
Day 2 — Database, Auth, and Real-Time
Database Integration
- SQLAlchemy async: async sessions, models, CRUD operations
- Tortoise ORM: async-first ORM alternative
- Database migrations with Alembic
- Repository pattern for clean data access
Authentication and Security
- JWT authentication: token generation, validation, refresh
- OAuth2: password flow, authorization code flow
- Role-based access control and permission systems
Background Tasks and WebSockets
- Background tasks: BackgroundTasks, long-running operations
- WebSocket support: connections, rooms, broadcasting
- Testing with pytest: TestClient, async tests, fixtures
Day 3 — Production and Advanced Topics
Production Setup
- Docker: containerizing FastAPI applications
- Uvicorn and Gunicorn: ASGI server configuration
- Environment management and configuration
Middleware and Cross-Cutting Concerns
- Middleware: custom middleware, request logging, timing
- CORS configuration for frontend integration
- Rate limiting and throttling strategies
Ecosystem Comparison and Optimization
- Comparison with Flask, Starlette, and Litestar
- Performance optimization: async best practices, connection pooling
- Structuring large FastAPI projects: routers, services, repositories
Practical Project
- Building a complete REST API with authentication and database
- Adding WebSocket features and background processing
- Containerizing and preparing for production deployment
