Skip to content

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

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.

  • 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.
WkTopicRead in backend/
1project layout, settings, env varsftm/settings/, deployment/backend-env.nix
2URLs, views, middlewareftm/urls.py, booking/views/
3templates, inheritance, formsbooking/templates/, forms/
4the admin, custom pages, get_urls()booking/admin*.py, booking/templates/admin/
5auth I: sessions, magic linksaccounts/
6auth II: BandAPIAccess hashed tokens, band-access permissions, RLSbands/
7Django Ninja in bands/api_v2/, versioning disciplinebands/api_v2/
8the ORM in anger: N+1, select_related, transactionsbooking/models.py
9tasks I: huey, Redis, in-process workbackend/*/tasks.py
10tasks II: the arq worker, retries, timeouts, idempotencyworker/src/ftm_worker/
11uploads: presigned S3 POST, S3→S3 copy*attachment_views.py
12mail: template → Postmark → inbound webhookemails/
  • 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.

The capstone’s backend: field, migration, view, permission, tests.

BookAuthor, yearUseFree
Django documentationDjango Software Foundation, currentThe actual reference; read the topics guide once, then look upYes
Two Scoops of Django, 3.x ed.Daniel & Audrey Roy Greenfeld, 2020Django conventions and layout opinions; where FTM agrees and where it doesn’tNo
Architecture Patterns with PythonPercival & Gregory, 2020Repository/unit-of-work/service-layer — the vocabulary for FTM’s thin services; cosmicpython.comYes
Django Ninja documentationVitaliy Kucheryaviy, currentThe API layer in bands/api_v2/Yes
High Performance DjangoBailey & Djang, 2015Dated but still the right mental model for the ORM/caching layerNo

Coursework 45% (L1–L5) · Project 35% · Check-off viva 10% · Exam 10%.

Deferred: processes, file descriptors, sockets, OOM → FTM402.