FTM301 · The FTM Backend
Learning materials — teaching, weekly quizzes, weekly tests. Examination paper — timed paper with marking guide.
Credits 8 · Hours 80 · Prereqs CS301 · Semester 3
Source
Section titled “Source”No university course teaches this codebase. The closest published analogue is
Berkeley CS169’s “build and deploy a real SaaS” model; the day-to-day reference is
the Django documentation (https://docs.djangoproject.com/en/stable/) and the
Django Ninja documentation (https://django-ninja.dev/), read against the actual
backend/ tree — 15 apps, ~189k lines of Python.
Objectives
Section titled “Objectives”- URL → view → template → model → task, unaided.
- Add an endpoint or a page end to end, with permissions and tests.
- Say who can read what, in a system with sessions, magic links and hashed tokens.
- Say where background work runs, and how it fails.
Weekly map
Section titled “Weekly map”| Wk | Topic | Read in backend/ |
|---|---|---|
| 1 | project layout, settings, env vars | ftm/settings/, deployment/backend-env.nix |
| 2 | URLs, views, middleware | ftm/urls.py, booking/views/ |
| 3 | templates, inheritance, forms | booking/templates/, forms/ |
| 4 | the admin, custom pages, get_urls() | booking/admin*.py, booking/templates/admin/ |
| 5 | auth I: sessions, magic links | accounts/ |
| 6 | auth II: BandAPIAccess hashed tokens, band-access permissions, RLS | bands/ |
| 7 | Django Ninja in bands/api_v2/, versioning discipline | bands/api_v2/ |
| 8 | the ORM in anger: N+1, select_related, transactions | booking/models.py |
| 9 | tasks I: huey, Redis, in-process work | backend/*/tasks.py |
| 10 | tasks II: the arq worker, retries, timeouts, idempotency | worker/src/ftm_worker/ |
| 11 | uploads: presigned S3 POST, S3→S3 copy | *attachment_views.py |
| 12 | mail: template → Postmark → inbound webhook | emails/ |
FTM labs
Section titled “FTM labs”- L1 trace six URLs to their views and back, on paper, then verify each.
- L2 add a read-only admin page with a permission test.
- L3 write and reverse a migration on staging, then make it safe for a live table.
- L4 queue a job, break it deliberately, read the failure in the journal.
- L5 make one job safe under duplicate delivery.
Project
Section titled “Project”The capstone’s backend: field, migration, view, permission, tests.
Reading list
Section titled “Reading list”| Book | Author, year | Use | Free |
|---|---|---|---|
| Django documentation | Django Software Foundation, current | The actual reference; read the topics guide once, then look up | Yes |
| Two Scoops of Django, 3.x ed. | Daniel & Audrey Roy Greenfeld, 2020 | Django conventions and layout opinions; where FTM agrees and where it doesn’t | No |
| Architecture Patterns with Python | Percival & Gregory, 2020 | Repository/unit-of-work/service-layer — the vocabulary for FTM’s thin services; cosmicpython.com | Yes |
| Django Ninja documentation | Vitaliy Kucheryaviy, current | The API layer in bands/api_v2/ | Yes |
| High Performance Django | Bailey & Djang, 2015 | Dated but still the right mental model for the ORM/caching layer | No |
Assessment
Section titled “Assessment”Coursework 45% (L1–L5) · Project 35% · Check-off viva 10% · Exam 10%.
Deferred: processes, file descriptors, sockets, OOM → FTM402.