A hands-on course that takes you from "I know a bit of Python and the Node.js stack" to building and shipping a real backend with Python, SQL, and FastAPI — then wiring it up to a React frontend you already know.
You learn by building one app across the whole course: DevHub, a small team workspace & knowledge base (projects, tasks, tags, notes, a blog, a book review list, and authentication).
- 📘 The book:
docs/python-backend-guide.pdf— 16 chapters, step by step. - 🧪 The examples:
chapters/— one heavily-commented, runnable folder per chapter. - 🚀 The finished app:
app/backend(FastAPI + SQL) andapp/frontend(React).
How to use this course: open the PDF on one side and the matching
chapters/chNN_.../folder in your editor on the other. Read the chapter, then read the code and its comments. The comments are part of the lesson.
👉 Full instructions — including what each tool actually is, and install commands for macOS, Windows and Linux — are in SETUP.md. Start there if this is a fresh machine.
The short version: you only need Python 3.10+ to begin. Everything else is introduced by the chapter that needs it.
| Tool | Why | When you need it |
|---|---|---|
Python 3.10+ (with pip + venv) |
The backend language and its package/environment tools | From Chapter 1 |
| SQLite 3 CLI | The zero-setup database used to learn SQL | Chapters 4–6 |
| Git | Track your own work as you learn | Recommended |
| Node.js + npm | Runs the React frontend | Chapters 15–16 |
| PostgreSQL | The production-grade database | Chapter 14 only |
| Docker + Compose | Runs the whole stack together | Chapter 16 (optional) |
From the repo root (python-backend/):
# 1) Create an isolated Python environment (like a project-local node_modules).
python3 -m venv .venv# 2) Activate it — do this in EVERY new terminal. macOS / Linux:
source .venv/bin/activateOn Windows PowerShell step 2 is .venv\Scripts\Activate.ps1 instead.
# 3) Install the backend + tooling dependencies.
pip install -r requirements.txtYou'll know the venv is active when your prompt shows (.venv). Deactivate any time
with deactivate.
Then confirm everything landed correctly:
python check_setup.pyThat script checks every prerequisite and prints the exact fix — for your OS — for anything missing.
Node ↔ Python analogy:
python3 -m venv .venv+pip install -r requirements.txtis the rough equivalent ofnpm install— but the environment is a folder you activate, and dependencies are listed inrequirements.txtinstead ofpackage.json.
Open this folder in VS Code and it will offer to install the recommended extensions
(defined in .vscode/extensions.json); see
SETUP.md for the full list and what each one does. The essentials are
ms-python.python, ms-python.vscode-pylance, charliermarsh.ruff, and
qwtel.sqlite-viewer.
Point VS Code at the venv interpreter: Ctrl/Cmd+Shift+P → "Python: Select
Interpreter" → choose the one inside ./.venv. (A
.vscode/settings.json is included that already does this.)
cd chapters/ch04_sql_foundations
sqlite3 devhub.db < schema.sql # create the tables
sqlite3 devhub.db < seed.sql # insert sample data
sqlite3 devhub.db # open an interactive SQL shell
# sqlite> .tables
# sqlite> SELECT * FROM projects;
# sqlite> .quitOr use the SQLite Viewer extension to click through devhub.db visually.
source .venv/bin/activate # if not already active
cd app/backend
uvicorn app.main:app --reload # starts on http://127.0.0.1:8000Then open http://127.0.0.1:8000/docs for interactive, auto-generated API docs
(Swagger UI). The database is created and seeded automatically on first run. See
app/backend/README.md for the seeded demo login and details.
Run the backend tests:
cd app/backend
pytest -qOpen a second terminal (leave the backend running):
cd app/frontend
npm install # first time only
npm run dev # starts Vite on http://localhost:5173The frontend expects the backend at http://127.0.0.1:8000 (configurable via
VITE_API_URL in app/frontend/.env). The backend already allows the Vite origin
(http://localhost:5173) through CORS. See app/frontend/README.md.
Chapter 14 walks through installing PostgreSQL (per-OS instructions are in
SETUP.md), creating the devhub database, and pointing the app at it via
DATABASE_URL. Until then everything runs on zero-setup SQLite.
cd app
docker compose up --buildThe book is generated from the Markdown in docs/chapters/ by a script:
source .venv/bin/activate
python docs/build_pdf.py # writes docs/python-backend-guide.pdfEdit any docs/chapters/NN-*.md and re-run to regenerate the book.
python-backend/
├── README.md ← you are here
├── SETUP.md ← prerequisites & install, for macOS/Windows/Linux
├── check_setup.py ← verifies your machine is ready
├── requirements.txt ← backend + tooling dependencies
├── docs/
│ ├── python-backend-guide.pdf ← the course book (generated)
│ ├── build_pdf.py ← regenerates the book from Markdown
│ └── chapters/ ← Markdown source, one file per chapter
├── chapters/ ← runnable, heavily-commented examples
│ ├── ch01_python_foundations/ … ch16_capstone/
└── app/
├── docker-compose.yml ← runs the whole stack (Chapter 16)
├── backend/ ← the finished FastAPI + SQL app
└── frontend/ ← the finished Vite + React app
| Part | Ch | Title |
|---|---|---|
| I. Python | 1 | Python Foundations for Node.js Developers |
| 2 | Functions, Modules, Type Hints & Environments | |
| 3 | OOP, Dataclasses, Decorators & Async | |
| II. SQL | 4 | SQL Foundations (SQLite) |
| 5 | Relationships, Joins & Analytics | |
| 6 | Talking to SQL from Python (SQLAlchemy) | |
| III. FastAPI | 7 | FastAPI First Steps |
| 8 | Pydantic & Schemas | |
| 9 | Building a CRUD API on a Database | |
| 10 | Relationships, Filtering & Pagination | |
| 11 | Authentication & Authorization | |
| 12 | Rounding Out the API (CORS, errors, aggregation) | |
| 13 | Testing & Migrations | |
| IV. Ship it | 14 | Moving to PostgreSQL |
| 15 | The React Frontend | |
| 16 | Capstone & Deployment |
This ships as plain files, not a Git repository, so you can start your own history from the very first commit:
git init && git add . && git commit -m "Start the python-backend course".gitignore already excludes .venv/, node_modules/, *.db and .env, so only
real source gets committed. Commit after each chapter — you'll have a record of
exactly what you changed while learning.
Run python check_setup.py first — it diagnoses most problems automatically. The
common ones:
ModuleNotFoundError— your venv isn't active (no(.venv)in the prompt) or you skippedpip install -r requirements.txt.command not found: python— usepython3(macOS/Linux) orpy(Windows). In an active venv, plainpythonworks.uvicorn: command not found— activate the venv first; uvicorn installs into it.- CORS error in the browser — make sure the backend is running and its allowed
origins include the frontend URL (
http://localhost:5173). - Frontend can't reach the API — check
app/frontend/.env'sVITE_API_URLand that the backend is up on port 8000.
A fuller table — including Windows PowerShell and Debian/Ubuntu specifics — is in SETUP.md.
Happy building — start with Chapter 1 in the PDF.