SQLite Storage
SqliteStorage persists key-value data to a local SQLite database file. It requires thebetter-sqlite3 package and is ideal for single-node deployments, embedded applications, or lightweight production setups.
Installation
Native module note
Native module note
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 tablekv_store:
Primary key:
(namespace, key). WAL mode is enabled for better concurrent read performance.