Skip to content

Latest commit

 

History

266 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FastAPI Web Applications (AxVa, 2026)

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."

Used Packages for Python 3.12.5

See requirements.txt.

The FastAPI framework

$ pip install fastapi

The Uvicorn ASGI server with dependencies written in C

$ pip install "uvicorn[standard]"

The HTTPie command-line HTTP client

$ pip install httpie

Example: 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.

The Requests synchronous HTTP client package

$ pip install requests

The HTTPX synchronous/asynchronous HTTP client package

$ pip install httpx
$ pip install httpx2

Authentication

  • JWT

    $ pip install python-jose[cryptography]
  • Hashing and verifying passwords

    $ pip install pwdlib[argon2]

Security

$ pip install python-dotenv

Generate a secret key

$ python -c "import secrets; print(secrets.token_hex(32))"
b9f3f6a080cfc1fd67dfe1f6e9e6cd2f119d09d4a58884fa7c7ead61216873e9

Add ".env" to .gitignore and store the following in .env

JWT_SECRET_KEY=<secret-key>
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=15

Testing

$ pip install pytest
$ pip install pytest-mock

Run tests

$ pytest -v

Property-Based Testing

$ pip install hypothesis
$ pip install schemathesis

Relational Database

  • SQLAlchemy

    $ pip install SQLAlchemy
  • SQLModel

    $ pip install sqlmodel

Async

  • Async for SQLite

    $ pip install aiosqlite
  • Async for Pytest

    $ pip install pytest-asyncio

Alembic

$ pip install alembic

About

Comprehensive educational repository for modern Python web development with FastAPI, Pydantic v2, Pytest, ORM with SQLAlchemy and SQLModel, asynchronous programming with asyncio, and database migrations with Alembic. Step-by-step implementation of a complete web application. Inspired by Bill Lubanovic. Extra protein. No sugar.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages