Week 02 — Deployment & API Engineering
Goal: Take a Python function from your laptop to a live, observable, authenticated API on the internet — in one week.
By the end of Week 2 you will have built and deployed a production-grade FastAPI service with Google OAuth, Docker containers, Redis caching, Prometheus metrics, and Grafana dashboards. You will also run local LLMs on your own machine.
What You'll Build
code
Your laptop
└── FastAPI app (Python)
├── Google OAuth 2.0 (authentication)
├── Redis (caching + rate limiting)
├── Prometheus + OpenTelemetry (metrics & traces)
└── Docker container
└── Deployed → HuggingFace Spaces / Render / Railway
└── Grafana dashboard (live monitoring)
Topics This Week
| # | Topic | What You'll Learn |
|---|---|---|
| 01 | FastAPI Fundamentals | Build REST APIs with auto docs |
| 02 | CORS & Middleware | Handle cross-origin, rate limiting |
| 03 | Google OAuth 2.0 | Secure endpoints with real auth |
| 04 | FastAPI Advanced | WebSockets, background tasks, DI |
| 05 | Config Management | .env, secrets, 12-factor app |
| 06 | Docker & Compose | Containerize everything |
| 07 | Deployment Platforms | HuggingFace, Render, Railway |
| 08 | Logging & Testing | structlog, pytest, coverage |
| 09 | Observability | Prometheus, OpenTelemetry, Grafana |
| 10 | CloudFlare Tunnels | Expose localhost to the internet |
| 11 | Local LLMs | Run Ollama & LM Studio locally |
| 12 | Redis Caching | Cache responses, manage sessions |
Labs This Week
| Lab | Title | Skills |
|---|---|---|
| Lab 2.1 | Gemma API on HuggingFace Spaces + Google Auth | FastAPI · HuggingFace · OAuth |
| Lab 2.2 | FastAPI Observability + Grafana Dashboard | Prometheus · OpenTelemetry · Grafana |
Prerequisites
- Completed Week 1 (UV, Git, basic Python)
- Python 3.11+ installed via UV
- Docker Desktop installed
- A Google account (for OAuth)
- A HuggingFace account (free)
Mental Model for This Week
Think of it in three layers:
code
┌─────────────────────────────────────┐
│ Layer 3: OBSERVABILITY │ ← Know what's happening
│ Prometheus · Grafana · Loki │
├─────────────────────────────────────┤
│ Layer 2: RUNTIME │ ← Keep it running
│ Docker · Redis · CloudFlare │
├─────────────────────────────────────┤
│ Layer 1: APPLICATION │ ← Make it work
│ FastAPI · OAuth · Config │
└─────────────────────────────────────┘
Build bottom-up. Get the app working first, then containerize, then observe.
Week 2 in one sentence
FastAPI + Docker + Prometheus = production-ready API. Everything else this week supports these three pillars.