All paths
FastAPIIntermediate

FastAPI

Build modern Python APIs with FastAPI: type hints, Pydantic validation, automatic docs, dependency injection, async and security. Complete your backend developer path.

12 chapters36 lessons48 challenges

Course curriculum

Chapter 1: Introduction to FastAPI

  • What FastAPI is
  • Running the app: uvicorn and ASGI
  • Automatic documentation

Chapter 2: Path operations and routing

  • HTTP methods and path operations
  • Path parameters
  • Route order: fixed before dynamic

Chapter 3: Query parameters and validation

  • Query parameters
  • Optional and default values
  • Validation with Query()

Chapter 4: Request body and Pydantic

  • Pydantic models (BaseModel)
  • Receiving the body in an endpoint
  • Optional fields and nested models

Chapter 5: Response model and status code

  • response_model: output shape and filter
  • status_code: the right status code
  • Separate models: input vs output

Chapter 6: Advanced validation with Pydantic

  • Field(): constraints and metadata
  • Custom validators
  • Special types (EmailStr, constrained)

Chapter 7: Dependency Injection

  • What a dependency is: Depends()
  • Reusable dependencies
  • Dependencies with yield (setup/teardown)

Chapter 8: Authentication and security

  • OAuth2 with Bearer token
  • Password hashing and JWT
  • Protecting an endpoint

Chapter 9: Database with SQLAlchemy

  • Engine and session
  • ORM models and CRUD
  • From ORM to Pydantic (from_attributes)

Chapter 10: Error handling

  • HTTPException
  • Validation errors (422)
  • Custom exception handlers

Chapter 11: Async, middleware and background tasks

  • async def in endpoints
  • Middleware
  • Background tasks

Chapter 12: Testing and deployment

  • Testing with TestClient
  • Project structure: APIRouter
  • Production deployment

Ready to level up?

Create a free account and start now: earn XP on every challenge and climb the leaderboard.

FastAPI — LevelUpCode