Skip to main content

SQLite Storage

SqliteStorage persists key-value data to a local SQLite database file. It requires the better-sqlite3 package and is ideal for single-node deployments, embedded applications, or lightweight production setups.

Installation

better-sqlite3 is a native Node.js addon. If you encounter build errors, ensure you have build tools installed (e.g., node-gyp, Python, Visual Studio Build Tools on Windows).

Setup


Constructor

string
required
Path to the SQLite database file. The file is created if it doesn’t exist. Use :memory: for an in-process in-memory database (still uses SQLite, but no disk).

Full Example


Schema

SqliteStorage creates a single table kv_store: Primary key: (namespace, key). WAL mode is enabled for better concurrent read performance.

Prefix Listing


Graceful Shutdown


API Reference