@bimetal/store-sqlite
v0.35.0
Published
SQLite EventStore implementation for @bimetal/event-sourcing — file-based, zero-config persistence
Maintainers
Readme
@bimetal/store-sqlite
SQLite-backed EventStore implementation for @bimetal/event-sourcing — file-based, zero-config
native event sourcing. Use with any domain package (@bimetal/calendar-data, @bimetal/table-data,
…). Built on better-sqlite3.
It is one of the storage adapters covered by the storage-parity test suite (In-Memory / SQLite / EventStoreDB produce bit-identical results), so it is a drop-in replacement for the in-memory store.
Installation
npm install @bimetal/store-sqliteUsage
import { createSqliteEventStore } from '@bimetal/store-sqlite';
import { createCalendarStore } from '@bimetal/calendar-data';
const eventStore = createSqliteEventStore({ path: './events.db' });
const store = createCalendarStore({ eventStore });
await store.hydrate();Options (SqliteStoreOptions)
| Option | Purpose |
|--------|---------|
| path | Path to the SQLite database file. Use ':memory:' for an in-memory database. |
| wal? | Enable WAL mode for better concurrent read performance. Default true. |
Testing
npm test --workspace @bimetal/store-sqliteThe parity suite (__tests__/storage-parity.test.ts) runs the same append/read/subscribe
sequence against In-Memory, SQLite and EventStoreDB and asserts identical results — the guarantee
that makes the adapter interchangeable.
