Skip to main content

File format

A monlite database is a plain SQLite file plus a few documented conventions. Any language with a SQLite binding can read and write it — that's the cross-language contract.

Documents

A document collection users is a table:

CREATE TABLE users (
_id TEXT PRIMARY KEY,
data TEXT NOT NULL, -- JSON document body
created_at INTEGER NOT NULL, -- epoch ms
updated_at INTEGER NOT NULL
);

Read it from anywhere:

SELECT _id, data FROM users WHERE json_extract(data, '$.age') >= 18;

Structured collections promote declared fields to native columns (the rest stay in data).

Companion tables

Each companion package is its own conventioned table(s) in the same file:

PackageTables (shape)
@monlite/kva key/value table with key, JSON value, expires_at
@monlite/queuea _jobs table: queue, status, JSON payload, run_at, attempts
@monlite/crona schedule table: name, cron expr, next-run
@monlite/ftsFTS5 virtual tables (<coll>_fts)
@monlite/vectorsqlite-vec vec0 virtual tables
@monlite/synca change-feed table with per-doc LWW versions + tombstones

Because these are ordinary SQLite tables, you can inspect, back up (copy the file), and interoperate across languages — see Python / interop.