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
| Subject | Decision |
|---|---|
| Frame | A scaling path with three independent decisions: where the data is, how many processes, how a request names its tenant |
| Program | One binary everywhere. Configuration chooses web, worker or both |
| The check | Every request, in the users’ database. No cache of answers, so a logout works from the next request |
| Shared state | Rate limits, single-use marks and leases live in the database, pruned by the worker |
| Proxies and signed passes | None. Any load balancer in front of identical processes |
| SQLite | Recommended for step 1. Never on several machines |
| Step 3 | PostgreSQL only. Any number of data servers, each with one database or one for each customer |
| Database credentials | In the process’s configuration, never in the places table |
| WebSocket and event stream | A 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.