This is a comprehensive educational repository dedicated to Python web development with FastAPI. It provides both the theoretical background and a step-by-step implementation of a complete web application.
Throughout the project, new technologies and concepts are introduced incrementally, including Pydantic v2, Pytest, ORM with SQLAlchemy and SQLModel, asynchronous programming with asyncio, and database migrations with Alembic.
The repository was originally created while studying the book "FastAPI: Modern Python Web Development" by Bill Lubanovic (O'Reilly Media, 2023). During learning, however, the project evolved far beyond the original material. The codebase has been substantially redesigned, and many essential topics have been expanded into comprehensive chapters with detailed explanations, while non-essential material has been removed to keep the learning path focused.
You can think of this repository as "Inspired by Bill Lubanovic. Extra protein. No sugar."
See requirements.txt.
$ pip install fastapi$ pip install "uvicorn[standard]"$ pip install httpieExample: request http://example.com/ and print (-p) request headers (H), request body (B), and response headers (h)
$ http -p HBh http://example.com/
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: example.com
User-Agent: HTTPie/3.2.4
HTTP/1.1 200 OK
Age: 8995
Allow: GET, HEAD
CF-RAY: a12c5cf9ac46606b-MUC
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html
Date: Sun, 28 Jun 2026 11:31:05 GMT
Last-Modified: Sat, 27 Jun 2026 11:26:45 GMT
Server: cloudflare
Transfer-Encoding: chunked
cf-cache-status: HIT
Use -b (equivalent to --body or -p b) only for the response body.
$ pip install requests$ pip install httpx
$ pip install httpx2-
JWT
$ pip install python-jose[cryptography]
-
Hashing and verifying passwords
$ pip install pwdlib[argon2]
$ pip install python-dotenvGenerate a secret key
$ python -c "import secrets; print(secrets.token_hex(32))"
b9f3f6a080cfc1fd67dfe1f6e9e6cd2f119d09d4a58884fa7c7ead61216873e9Add ".env" to .gitignore and store the following in .env
JWT_SECRET_KEY=<secret-key>
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=15$ pip install pytest
$ pip install pytest-mockRun tests
$ pytest -v$ pip install hypothesis
$ pip install schemathesis-
SQLAlchemy
$ pip install SQLAlchemy
-
SQLModel
$ pip install sqlmodel
-
Async for SQLite
$ pip install aiosqlite
-
Async for Pytest
$ pip install pytest-asyncio
$ pip install alembic