Files
aneurinandClaude Sonnet 5 5c8f2dbf07 Un-hard-wrap all Markdown documentation
Every prose paragraph and list item was manually wrapped at ~80-100
columns; joined each back into a single line. Headings, table rows,
and fenced code blocks are untouched -- tables already had one row per
line, and wrapping inside a code fence is the code's own formatting,
not something this applies to.

Also fixed two pre-existing typos this surfaced (both from wrapping
without leaving the space that was actually intended): a missing space
in "{ challenge_id, options }" and a stray "+ TypeScript" that had
accidentally been written as if it were a new line, in web/README.md
and README.md respectively.

Code comments are explicitly out of scope for this -- left exactly as
they were.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-05 02:29:08 +01:00

2.6 KiB

Architecture

A REST API in PHP 8 (Slim 4) over a single SQLite file, plus a Vue 3 + TypeScript PWA frontend. Auth is a bearer JWT, obtained via a magic link or a passkey (see docs/api.md) — there's no session store or cookie.

Backend layout

public/index.php              Front controller
src/bootstrap.php             App wiring and route definitions
src/Support/Config.php        Environment-driven configuration
src/Support/Database.php      PDO/SQLite connection
src/Auth/JwtService.php       Issue/verify JWTs
src/Auth/AuthMiddleware.php   Bearer-token authentication
src/Auth/SessionPayload.php   Shared user + session JSON shape
src/Mail/                     Mailer interface, SMTP/mail()/log transports, EmailVerifier
src/Http/JsonErrorHandler.php Uniform JSON error envelope
src/Http/Controllers/        Request handlers (Auth, EmailVerification, Passkey, Project, Card, CardStatus)
src/Repository/              Database access (User, EmailVerification, Passkey, WebAuthnChallenge, Project, Card, CardStatus)
src/Support/Validator.php    Request-body validation helper
migrations/*.sql             Schema, applied by bin/migrate.php
Dockerfile                   Multi-stage: Node frontend build + PHP 8.3/Apache runtime
                              (Alpine -- apk's own php83/apache2 packages, not a
                              from-source compile; ~90MB image)
docker-compose.yml           Local stack: app (SPA + API) + Mailpit
docker/                      Apache vhost (mod_rewrite, document root) + entrypoint
                              (runs pending migrations, then hands off to Apache)
web/                         Vue 3 + TypeScript + Vite PWA frontend (dev on the host)

A ProjectScopedController base class centralizes "look up a project owned by the caller, or 404" for the controllers that need it (Project, Card, CardStatus). Every table a request can reach is scoped to the authenticated user one way or another — directly (owner_id/user_id) or via a project that is.

Frontend

The Vue/TypeScript PWA lives in web/ and is a separate concern with its own conventions (routing, state, styling, drag-and-drop). See web/README.md for all of that — this document only covers the backend.

Database

One SQLite file, migrated forward-only by bin/migrate.php from migrations/*.sql (each applied file is recorded in a schema_migrations table, so re-running is safe). See docs/setup.md for how to run migrations, and docs/history.md for how the schema and the rest of the app got here.