Skip to content

0019. Phase 3a platform choices: age rule, build isolation, storage, local mode

  • Status: Accepted (owner decisions 2026-11-27 for the age rule, build isolation and storage)
  • Date: 2026-11-27
  • Phase: 3

Phase 3a turns the framework into a platform: accounts, publishing, a sandboxed play page, a catalog and moderation, running locally with one command. ADRs 0008–0012 set the stack; several details were left for this phase.

  • Accounts are 13+ (owner). Sign-up asks for a date of birth, refuses under-13s with a clear message, and stores only an age bracket (13-15, 16-17, 18+), never the date. Playing needs no account and stores nothing. Social sign-in waits for an age step (OAuth providers give no birth date).
  • Builds (owner): each version builds from the upload’s game/ data and src/ behaviors with a platform-owned bootstrap (index page, entry file, Vite config); uploaded package.json, HTML or config files are refused, and dependencies come from the platform’s own set. Type errors fail the build.
    • In Docker the pipeline is split in two (no Docker socket anywhere). The worker (trusted) fetches sources, prepares build folders and uploads results; it reaches only the database and storage over an internal network. The builder (untrusted input) compiles the folders it receives through a shared volume and runs with no network at all (network_mode: none), no secrets, a read-only filesystem, no capabilities and memory/CPU/ process limits; each step is a child process with a time limit and memory cap.
    • Amended 2026-11-27 (owner): the first version compiled inside the worker. Testing showed SeaweedFS’s internal file API accepts unauthenticated writes from that network, so a compromised compiler could have altered other games’ builds or read unpublished sources. Builds do not execute uploaded code, so this needed a compiler exploit, but the split closes it fully and is required before Phase 3b runs games headless on the server.
    • Local mode (no Docker) compiles in child processes of the web server.
    • Phase 7 runs each build as its own short-lived task.
  • Storage (owner): SeaweedFS as the local S3-compatible store (Apache-2.0, one container); real S3 in the cloud.
  • Local mode without Docker: with no DATABASE_URL, the web server uses PGlite (Postgres in-process), files for blobs, builds in-process, emails on a /dev/mail page, and serves the play origin itself. Tests use the same.
  • Ids are DNS labels (lowercase letters, digits, dash) because game ids are play subdomains.
  • Play origin: http://<gameId>.play.localhost:3001/v/<versionId>/ locally (a separate registrable domain in production, ADR 0012). Strict CSP without unsafe-eval — PixiJS loads its pixi.js/unsafe-eval module, which replaces its runtime code generation so it works under such a CSP. Files allow cross-origin reads (sandboxed documents have an opaque origin).
  • React Router 8 (successor of v7 framework mode named in ADR 0009), one Node process serving pages and API.
  • Cloud saves go through the play bridge to /api/games/{slug}/saves/{slot} as the signed-in player.
  • Local secrets in compose.yaml are placeholders for local use only.
  • The worker image contains the full toolchain; build images get slimmer when builds move to per-task containers.
  • Email verification is required to create games (anti-abuse baseline); guests can still play and report.