Appendix: file inventory

The final project layout, for orientation. This is what you'll have built by the end of the workshop.

snake-royale/
├── frontend/                   # the Lovable app (TanStack Start)
│   ├── src/
│   │   ├── routes/             # index, play, leaderboard, watch, auth — one file per page
│   │   ├── services/           # index.ts, mock.ts, http.ts, types.ts
│   │   ├── hooks/              # useAuth and friends
│   │   ├── components/         # SnakeBoard and UI components
│   │   └── router.tsx
│   ├── scripts/
│   │   └── prerender-static-shell.mjs   # builds the static shell for the container
│   ├── vite.config.ts          # dev server + /api proxy to the backend
│   └── package.json
├── backend/                    # the FastAPI app
│   ├── main.py                 # entrypoint: runs uvicorn for app.main:app
│   ├── app/
│   │   ├── main.py             # FastAPI app, CORS, routers under /api, static frontend
│   │   ├── routers/            # auth.py, scores.py, active_games.py
│   │   ├── models.py           # Pydantic request/response models
│   │   ├── store.py            # SQLAlchemy models, sessions, and database selection
│   │   ├── security.py         # password hashing
│   │   └── auth.py             # bearer-token auth
│   ├── tests/                  # unit tests
│   ├── tests_integration/      # integration tests (file-based SQLite)
│   └── pyproject.toml
├── infra/
│   └── cloudformation.yaml     # AWS deployment (added in Part 12)
├── scripts/                    # dev.sh, aws-deploy.sh, aws-update.sh
├── docs/                       # deployment notes
├── AGENTS.md                   # uv house rules for the assistant
├── CLAUDE.md                   # points Claude at AGENTS.md
├── openapi.yaml                # the frontend-backend API spec
├── Dockerfile                  # combined frontend + backend image
├── compose.yaml                # app + Postgres
├── Makefile                    # install / dev / backend / frontend / tests
└── .github/workflows/ci-cd.yml

A few notes on files whose role isn't obvious from the name:

  • frontend/src/services/mock.ts is the in-memory fake backend that lets the frontend run on its own before the real backend exists. The entrypoint services/index.ts switches between it and the real http.ts client, which we do in Part 7: Connect frontend and backend.
  • frontend/scripts/prerender-static-shell.mjs builds the static shell the container serves - the TanStack Start workaround from Part 9: Package as one container.
  • backend/app/store.py holds the SQLAlchemy models and the SQLite-or-Postgres decision, driven by SNAKE_ROYALE_DATABASE_URL.
  • Dockerfile at the repo root is the combined image: it builds the frontend in a Node stage and copies the result into the Python image, so one container serves both.
  • infra/cloudformation.yaml is the infrastructure as code for the AWS deployment, which we write in Part 12: Deploy to AWS with infrastructure as code.

Questions & Answers

Sign up to ask questions, track your progress, and get access to other workshops · Already have an account? Sign in