Intermediate ยท 5h 58m ยท 22 lessons
FastAPI
Build fast, modern Python APIs with automatic docs, validation and dependency injection.
What you'll learn
- โฆBuild a FastAPI app with path operations and run it with Uvicorn or the fastapi command
- โฆRead path and query parameters with type hints, defaults and Query or Path rules
- โฆWrite Pydantic models that validate request bodies, including nested and list fields
- โฆChoose the right status code, raise clean HTTP errors and filter output with a response model
- โฆBuild dependencies with Depends() and yield to share database sessions and protect routes
- โฆDecide where work belongs: middleware, CORS, background tasks, async def or plain def
- โฆConnect a database, protect routes and test the API with TestClient
Part of these career paths
- Backend Developer path ยท course 9 of 14
- Full-Stack Developer path ยท course 10 of 14
Certification projects
Build 4 projects to earn your certificate
Hands-on work that proves you can apply what you learned โ part of the certificate requirements.
Syllabus
Module 1 ยท 54m
Getting started Free
What you'll be able to do
- Can explain where a FastAPI app sits between a client and a database, and what one type hint does
- Can write a GET path operation that returns JSON, and tell a 404 from a 405
- Can start the app with fastapi dev or uvicorn and send test requests from /docs
Module 2 ยท 48m
Path & query parameters Locked
What you'll be able to do
- Can capture typed path parameters and order routes so fixed paths still match
- Can add required and optional query parameters and predict the values FastAPI passes
- Can add Query and Path rules (lengths, ranges, patterns) and test their edges
Module 3 ยท 51m
Request bodies with Pydantic Locked
What you'll be able to do
- Can write a Pydantic model with required and optional fields, and predict what it converts or rejects
- Can accept a validated JSON body and read a 422 reply to find the broken field
- Can model nested JSON with models inside models and typed lists
Module 4 ยท 50m
Responses, status codes & errors Locked
What you'll be able to do
- Can choose the right status code for create, queue, delete and each kind of client error
- Can raise HTTPException so a failure stops the handler and sends a clear JSON error
- Can filter output with a response model, so fields like password hashes never leave the server
Module 5 ยท 48m
Dependency injection Locked
What you'll be able to do
- Can move repeated setup into a dependency and declare it with Depends()
- Can chain dependencies and clean up after each request with yield
- Can protect chosen routes with an auth dependency and pick 401 or 403
Module 6 ยท 45m
Lifecycle, middleware & tasks Locked
What you'll be able to do
- Can put the stages of a request in order and say which stage sent a status code
- Can add middleware and set CORS so a browser page on another origin can call the API
- Can move follow-up work into BackgroundTasks and decide when a task queue is needed
Module 7 ยท 1h 2m
Async, databases & production Locked
What you'll be able to do
- Can choose def or async def and spot a blocking call inside async def
- Can connect SQLModel with one engine and a session per request, and save rows
- Can test endpoints with TestClient and dependency overrides
- Can plan the steps that take a working API to a deployed one