Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

002 One program and a scaling path of three steps

Summary: why the same binary runs in every process, every request is checked in the users’ database, and growth happens in three steps.
Key terms: step, users’ database, shared state, worker, with_proxies.
Related: Scaling · spec 10

Date: 2026-11-25. State: in force. It replaced an earlier list of four separate architectures.

Decided

SubjectDecision
FrameA scaling path with three independent decisions: where the data is, how many processes, how a request names its tenant
ProgramOne binary everywhere. Configuration chooses web, worker or both
The checkEvery request, in the users’ database. No cache of answers, so a logout works from the next request
Shared stateRate limits, single-use marks and leases live in the database, pruned by the worker
Proxies and signed passesNone. Any load balancer in front of identical processes
SQLiteRecommended for step 1. Never on several machines
Step 3PostgreSQL only. Any number of data servers, each with one database or one for each customer
Database credentialsIn the process’s configuration, never in the places table
WebSocket and event streamA new check after 5 minutes† at the latest

Why

A process that trusts another process’s word about a session, or a cache of the answer, lets access outlive a logout. Putting shared state in the database that every process already reads makes one process and many behave the same, with nothing to configure.

Not now

Regions and processes that cannot reach the users’ database. Signed passes are one possible answer, with a delay before a logout works.