Skip to main content

Module 06 Projects - Overview

Estimated total time: 8–12 hours | Level: Intermediate

Before reading further, answer this: what is the difference between a web application that works and a web application that is production-ready?

The answer is everything that is invisible when nothing goes wrong - structured logging, request tracing, error handling that gives clients actionable information, health checks that let orchestrators know whether to route traffic, and a deployment that behaves identically in every environment. The two projects in this module build exactly that gap.

Projects in This Module

Project 01 - Task Management REST API

Time: 5–7 hours | File: 01-REST-API-Service.md

Build a production-quality Task Management REST API using FastAPI, Pydantic v2, and SQLAlchemy. Every lesson in Module 06 converges here - HTTP methods from Lesson 01, REST design from Lesson 02, FastAPI routing from Lesson 04, the request-response lifecycle from Lesson 05, middleware from Lesson 06, JSON serialization from Lesson 07, and Pydantic validation from Lesson 08.

What you build:

  • Full CRUD for tasks with proper HTTP semantics (201 on create, 204 on delete, 404 on missing)
  • SQLite backend with SQLAlchemy - in-memory for tests, file-backed for development
  • Pagination (limit/offset), filtering by status and priority, sorting
  • Request ID middleware and timing middleware for distributed tracing
  • RFC 7807 Problem Details error responses for every 4xx/5xx case
  • Complete pytest test suite using TestClient - happy path, edge cases, and error scenarios
  • Auto-generated OpenAPI documentation at /docs with tags, summaries, and response models
  • Dockerfile and docker-compose.yml for containerized local development

Skills practiced: FastAPI routing and dependency injection, Pydantic v2 request/response models, SQLAlchemy session management, pytest with TestClient, middleware design, RFC 7807 error responses, Docker basics.

Project 02 - Local Deployment Setup

Time: 3–5 hours | File: 02-Local-Deployment-Setup.md

Configure a production-like local deployment stack for the REST API from Project 01. This project bridges the gap between "it works on my laptop" and "it works in production" - the deployment primitives are the same ones used in real production environments.

What you build:

  • Multi-stage Dockerfile: builder stage (dependencies) → runtime stage (minimal image, no build tools)
  • docker-compose.yml: FastAPI app + Nginx reverse proxy + PostgreSQL database
  • Nginx configuration: proxy_pass, rate limiting, gzip compression, security headers
  • Pydantic BaseSettings for environment-based configuration (development vs. staging vs. production)
  • Alembic database migrations: init, first migration, upgrade/downgrade workflow
  • Health check endpoint GET /health returning service status and database connectivity
  • Graceful shutdown with FastAPI's lifespan events and @asynccontextmanager
  • Makefile with make up, make down, make logs, make migrate, make test

Skills practiced: Multi-stage Docker builds, Docker Compose service orchestration, Nginx reverse proxy configuration, environment-based config with Pydantic BaseSettings, database migrations with Alembic, health check design, graceful shutdown patterns.

How the Projects Connect

Project 01 produces a working, tested API. Project 02 takes that API and deploys it with a production-like stack. The patterns from both projects carry forward into Module 07, which replaces the synchronous SQLAlchemy with asyncpg-backed async sessions and introduces proper connection pooling.

Prerequisites

Both projects require the Module 06 lessons as background:

  • Lesson 01 (HTTP Deep Dive) - HTTP methods, status codes, headers
  • Lesson 02 (REST Principles) - resource design, idempotency, HATEOAS
  • Lesson 04 (FastAPI) - routing, dependencies, request/response models
  • Lesson 05 (Request-Response Lifecycle) - where middleware runs, how errors propagate
  • Lesson 06 (Middleware) - how to write and register middleware
  • Lesson 07 (JSON Serialization) - orjson, custom encoders, datetime handling
  • Lesson 08 (Validation with Pydantic) - BaseModel, Field, validators, ORM mode

For Project 02, basic familiarity with Docker and containers is helpful but not required - the project includes explanations of every Docker and Nginx directive used.

Environment Setup

Both projects use the same Python environment:

# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # Linux/macOS
# .venv\Scripts\activate # Windows

# Install project dependencies
pip install fastapi uvicorn sqlalchemy pydantic[email] orjson alembic pytest httpx

# For Project 02: install Docker Desktop
# https://docs.docker.com/desktop/

# Verify Docker is running
docker --version
docker compose version

Grading Criteria

Each project has clear completion criteria in its file. A project is complete when:

  1. All stated requirements (R1–R8) are implemented
  2. The test suite (pytest) passes with zero failures
  3. The application starts without errors (uvicorn or docker compose up)
  4. The verification checklist at the end of each project passes fully
© 2026 EngineersOfAI. All rights reserved.