📦 Docker Basics
Docker packages your app, dependencies, and configurations into a container. The Dockerfile defines how to build the image. Claude Code generates optimized Dockerfiles with multi-stage builds.
FROM python:3.12-slim WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt COPY . . EXPOSE 8000 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
In one sentence: Docker = "works on my machine" becomes "works anywhere."
🎼 Docker Compose
Real apps have more than one service: app + database + cache. Docker Compose orchestrates everything with a single docker-compose.yml. A docker compose up start everything together.
In one sentence: docker compose up = app + DB + cache running together in 1 command.
☁️ Cloud deploy (Railway/Fly.io)
Platforms like Railway and Fly.io deploy your app with one command. Connect the Git repo, configure environment variables, and every push triggers an automatic deploy. No server management.
# Railway railway login && railway init && railway up # Fly.io fly launch && fly deploy
In one sentence: PaaS = deploy with one command, without managing servers.
🔐 Environment Management
Secrets in .env, configs by environment (dev/staging/prod), 12-factor principle. Use pydantic-settings to load and validate configurations. Never commit .env to git.
NEVER do this
Committing .env to git. Add .env to .gitignore BEFORE the first commit.
In one sentence: .env + .gitignore + pydantic-settings = secure secrets and validated configs.
📈 Monitoring and Logs
Minimum viable: endpoint /health, structured logging with structlog, and external uptime monitoring. Without that, you only find out about problems when a user complains.
In one sentence: /health + structlog + uptime check = know before the user does.
📏 Scaling Basics
Horizontal (more replicas) vs. vertical (larger machine). For 99% of early-stage projects, one replica with caching is enough. Rule of thumb: don't scale before you need to. When monitoring shows a bottleneck, then do it.
In one sentence: don't scale before you need to; when you do, monitoring shows you where.
🧾 Module Summary
Next module:
5.6 — Ship Your Product: MVP, launch, and iteration.