Package reference
Every exported name of lith's packages, with its signature and its doc comment.
These pages are generated from the Go doc comments of lith's packages, at the commit this site was built from: go generate ./content in site/ writes them, and TestUpToDate fails when they differ from the code. To change a page, change the doc comment and generate again.
| Package | What it does |
|---|---|
| sqlite | Opens one SQLite database file the way the projects use it: a single write connection, for migrations and the writer, and a pool of read-only connections for everything else. |
| writer | The single writer of a SQLite database. |
| events | Keeps an event log in the app's SQLite database: typed streams of events, deciders that decide from each stream's own state, and projectors that keep read models current. |
| events/eventstest | Tests deciders as given, when, then: the events a stream holds, a command, and the events or the error the command should cause. |
| live | Renders views from the database and streams them to pages: view = f(state). |
| sse | Writes Datastar server-sent events through a compressor of its own per stream. |
| edge | What the apps do at the request edge, before a handler runs and after it has written. |
| datastar | Holds the Datastar build that lith's template and site serve: Starbase's patched build of Datastar with Rocket, one minified ES module. |
| tenant | Keeps one open value per key, usually a SQLite database per account. |
| dbmetrics | Times the statements a database/sql driver runs and logs the slow ones. |
| loadtest | Measures a project's views and commands under load, in process: a writer and a live hub on one database, streams without a network, and producers that send commands on a fixed schedule. |
| backup | Replicates SQLite databases to S3-compatible storage with Litestream, embedded in the process. |
| prom | Exports a lith app's numbers to Prometheus: the writer's batches and commands, the live hub's ticks, renders and frames, what the streams hold of the memory budget, and the event store's appends and projectors. |
| dbmetrics/prom | Records dbmetrics observations in Prometheus. |
| minify | Minifies JavaScript and CSS for edge.Static: JavaScript with esbuild, CSS with tdewolff/minify. |
backup, prom, dbmetrics/prom and minify are modules of their own, so that an app without them never pulls in their dependencies: Litestream and the AWS SDK for backup, the Prometheus client for prom and dbmetrics/prom, esbuild and tdewolff/minify for minify. The rest are packages of the module github.com/zweiundeins/lith, imported one by one.