TinyStore
A small storage runtime for applications. SQL, key-value state, durable jobs, files, search, logs and metrics in one directory, with one lifecycle, one memory budget and one backup. SQLite is underneath, and a Rust program compiles all of it in: the program is the store.
Version 0.10. Until
1.0, a minor release may still change the API, and its notes say what changed.
TinyStore builds SQLite itself, with flags of its own. Put them in your
project's .cargo/config.toml, since a dependency cannot set them for you:
[]
= "SQLITE_DQS=0 -USQLITE_ENABLE_MEMORY_MANAGEMENT SQLITE_ENABLE_DBPAGE_VTAB -DHAVE_FDATASYNC=1"
Without them readers wait on one another, point reads from 16 threads 7-9x
slower (research rust-slice-2026-10-10), which the store warns of once, in the
first lines of its logger when nothing listened before; a synced commit on
Linux takes 1.5x as long, since SQLite calls fsync for fdatasync; and a
node of a replicated store cannot apply its home's pages. The same flags serve
every platform.
use ;
let store = open?;
let db = store.database.migrations.open?;
db.exec?;
let sessions = store..idle.open?;
sessions.set?;
let emails = store..open?;
emails.add?;
Each engine is a cargo feature, all of them on by default: kv, config,
locks, channels, jobs, sql, blobs, records, metrics, system,
search, backup, replication and wire, with replication-tls and
console beside them. A program that turns the defaults off links only the
engines it names.
A program that only reads its settings, with config::load, asks for
config-load alone. It links no store and no SQLite, so it needs neither
the flags above nor a C compiler:
= { = "0.10", = false, = ["config-load"] }
- Your first store: a first program, step by step
- The guides: every engine, page by page, in Rust, TypeScript, Python and Go
- The
tinystorecommand: a store's directory served to other processes, and read while it runs
Licensed under Apache-2.0.