Rules for databases
Last updated 29 October 2026
Check your program against these rules before you rely on it: each one keeps commits safe, one writer in charge, or the bill small.
Each rule links to its page, which shows what to write and what not to.
Persist, then act
- Await synced() before anything outside the process acts
- Let gate() hold a handler’s answer
- Record a side effect before you make it
- Bound a wait where someone is waiting
One writer
- Run one instance per database
- When a reset says stop, stop
- Keep the cache directory, and never copy it
Size and cost
- Batch a step’s writes into one transaction
- Write what changed, not the whole state
- Keep each transaction under 128 MiB
SQLite
- Leave the journal mode and the page size alone
- Reach the data only through the connection open() returns