Guides
One task per page, each with code that compiles against the lith of this site's commit and runs in its tests.
The guides follow one app: boards of lanes that hold cards, the domain of lith's own benchmarks. Its code is in site/internal/docs/example in lith's repository, compiled and tested with the site: board holds the commands, the queries and the schema, web the handlers, the views and the page, tenants a pool of databases, and backup the Litestream wiring, in a module of its own. A listing with a file name above it is a piece of that code, of lith's template or of this site, and the docs' tests fail when the file no longer holds it.
| Guide | What it covers |
|---|---|
| Commands and the writer | Send, Do, DoValue, validation, topics, refusals, op ids with Once and OnceResult, AfterCommit, the statement cache |
| Migrations, jobs and imports | the schema's files, Exclusive, bulk imports, background jobs, sweeps, checkpoints |
| Reads | View and ViewValue, query code shared through sqlite.Querier, WithTx, the read pool |
| Views and the hub | keys and topics, Presence, Every, Watch and Unwatch, Spec.WriteTick, the heartbeat signal, MaxStreams |
| Pages and Datastar | the document, the fat morph, tab state in SQLite, op ids and pending, reconnecting after a deploy |
| Streams and compression | zstd and brotli, windows, the memory budget, hibernation, NoCompression |
| The request edge | sessions, CSRF, the CSP and its nonce, client addresses, rate limits, compression, static files, health |
| One database per account | tenant.Pool, a writer per account, views across accounts, erasure |
| Backups | VACUUM INTO copies, Litestream with the backup module, restores |
| Metrics and monitoring | lith/prom, dbmetrics, the Grafana dashboard, alerts, logs, probes |
| Deploying | the systemd unit, Caddy, the deploy script with rollback, memory settings |
| Load testing | loadtest.Run with an app's own views and commands, and how to read its report |
The first command and view builds a smaller feature from scratch, and the package reference has every exported name.