Build a real API.
From an empty folder to Shelf, a reading-list API with a database, auth, tests and a Docker image. Every chapter is short, hands-on, and ends with a way to check it worked.
- 01Why FastAPI, and what we buildMeet Shelf, the reading-list API we build together, and why FastAPI fits it.10 minutes
- 02Set up and run itInstall uv, start the server, and explore the live docs at /docs.10 minutes
- 03Routes, path and query parametersDecorators map URLs to functions; type hints turn strings into checked values.15 minutes
- 04Pydantic models and validationDescribe the shape of your data once; get checking, cleaning and docs for free.20 minutes
- 05A real database with SQLAlchemyTables as Python classes, one session per request, and queries that read like sentences.20 minutes
- 06Dependencies and settingsLet FastAPI hand each route what it needs: a session, pagination, settings.15 minutes
- 07Errors that helpOne error format for everything: clear for clients, safe for you.15 minutes
- 08Protect writes with an API keyAnyone can read your shelf; only you can change it.15 minutes
- 09Test it with pytestFast tests against a fresh in-memory database, no server needed.20 minutes
- 10Middleware, request ids and logsCode that runs around every request: trace it, time it, log it.15 minutes
- 11Background tasks and asyncReply fast, finish the rest later, and know when to write async def.15 minutes
- 12Ship itHealth checks, a small Docker image, production settings and a checklist.20 minutes