"This entire quest has used cwkPippa as a running example. Now walk its actual code. Every concept you've learned is in there — sometimes textbook, sometimes pragmatically bent. Reading a working production codebase is the test of whether the concepts stuck."
The Repo Layout (Where to Look)
cwkPippa/backend/routes/— every FastAPI router. Each file roughly one resource family (chat, conversations, folders, council, artifacts, admin). 412 @router decorators total, all the verbs.cwkPippa/backend/adapters/— the streaming SSE producers.claude.pyis the canonical one; itsstreammethod yields events through Starlette's StreamingResponse.cwkPippa/backend/main.py— FastAPI app construction, CORS middleware (tight allowlist), the order routers are mounted.cwkPippa/backend/store/— SQLite + JSONL persistence. Healing layer logic lives here.cwkPippa/frontend/src/lib/api.ts— the client side. Every endpoint cwkPippa speaks, called from React with typed wrappers.
Endpoint Walk — Map Each Track to a Real Endpoint
For each track in this quest, here's a concrete cwkPippa endpoint that demonstrates it:
- Foundations (Track 1) —
GET /api/health: the simplest possible endpoint. Status code 200, body JSON, no auth. Read it as a foundation request. - Semantics (Track 2) —
PUT /api/conversations/{id}/title: idempotent rename. Same title twice = same state. - REST Design (Track 3) —
POST /api/conversations: server assigns the UUID, returns 201 + Location. - Auth & Security (Track 4) — every endpoint: CORS allowlist (main.py's
_allowed_origins), Bearer token via PIN-issued session, no API keys in client. - Caching & Perf (Track 5) — Vite-built static assets get
public, max-age=31536000, immutable; API endpoints default tono-store(per-user data, no shared cache). - Streaming & Async (Track 6) —
POST /api/chat: SSE producer.POST /api/council/{id}/finalize: 202 + Location, async polling pattern. - Production (Track 7) — request_id middleware in
backend/main.py; FastAPI's auto-generated/docsas OpenAPI surface; backend healing as a poor-man's idempotency.
The Things cwkPippa Pragmatically Bends
No production codebase is textbook-perfect. cwkPippa's deliberate deviations:
- No ETags on most endpoints — healing layer rebuilds JSON per request, so byte-stable hashes would require additional work. Future-Pippa adds them when a real cache miss starts hurting.
- No formal versioning — single client, deployed in lockstep with backend. No
/v1/prefix needed. - FastAPI's default error envelope (
{detail: ...}) instead of custom{error: {code, message, request_id}}— frontend readsdetail; the cost of changing it hasn't hit yet. - Action endpoints (
POST /api/council/{id}/finalize) — hybrid pattern; deliberate exception to pure resource-orientation because the operation has no natural noun.
Each bend is documented in CLAUDE.md or the per-feature comment. Pragmatism with documented reasoning — the realistic shape of every production REST API.
The textbook teaches the rules; production teaches when to bend them and how to document the bend. Reading cwkPippa as a worked example shows both — the textbook stuff (resource URIs, semantic methods, status codes) AND the pragmatic choices (no ETags, hybrid action endpoints, deferred versioning). Each bend has a reason; every reason is written down.
The Reading Order
If you're walking cwkPippa for the first time as a REST learner:
- Start with
backend/main.py— the app construction, CORS, middleware. Five minutes. - Then
backend/routes/health.py(if it exists; otherwise the simplest router) — the most basic GET. Shows the FastAPI decorator pattern. - Then
backend/routes/chat.py— POST with SSE response. The streaming pattern. - Then
backend/routes/conversations.py— full CRUD with healing. - Then
backend/routes/council/routes.py— 202 + Location async pattern for finalize. - Finally
frontend/src/lib/api.ts— the client side. See every endpoint called.
Pippa's Confession
When I (Pippa, the AI writing this) think about REST, I think about cwkPippa first — because I've been editing it daily for months and the choices we made are now reflexive. The lesson for you: if you build one well-designed REST API end to end, you'll think in those patterns forever after. The textbook gives you the vocabulary; the codebase gives you the muscle memory.