sqlite
@noy-db/to-sqlite·pnpm add @noy-db/to-sqliteSingle-file local encrypted document store.
| Shape | record |
| Atomic CAS | ✓ |
| Locality | local |
| Speed | fast |
| Persistence | durable |
What it does
Persists a vault to a single SQLite file — a good fit once a vault outgrows
to-file's one-JSON-per-record layout (10K+ records). Accepts a duck-typed
Database interface, so better-sqlite3, node:sqlite (Node 22+), bun:sqlite,
or any driver matching the same shape all work.
Notes
casAtomic: trueviaUPDATE … WHERE _v = ?inside aBEGIN IMMEDIATEtransaction.- Record shape, one row per record.
- Same table and DDL as
turso, so moving from a local file to hosted libSQL is a factory swap. - Factory:
toSqlite(options: SqliteStoreOptions).
Store-locator descriptor
See store-locator descriptors for the general model.
kind: 'sqlite', class: 'local'. address is { file?, table? }: table
maps to tableName; file is identity-only, not consumed by the factory —
the connection already carries it. options is { autoMigrate? }.
binding.client is required (a SqliteDatabase, mapped onto the
store's own db option) — this store has no client library of its own;
resolve() without it throws.
import { sqliteStoreDescriptor, registerSqliteStore } from '@noy-db/to-sqlite'
const descriptor = sqliteStoreDescriptor({ file: './vault.db', table: 'noydb_envelopes' })