DeepBase SQLite Driver

raw JSON →
3.6.9 verified Sat May 09 auth: no javascript

SQLite database driver for DeepBase providing high-performance, ACID-compliant storage for nested JavaScript objects. Uses better-sqlite3 with synchronous operations wrapped in async API. Supports PRAGMA modes (none, safe, balanced, fast) for tuning durability vs performance. Includes singleton pattern for shared connections across instances. Current stable version: 3.6.9. Active development with regular releases. Key differentiator: seamlessly integrates with DeepBase's nested object storage using dot-notation path indexing and monotonic sequence ordering for deterministic key order.

error Error: The module 'better-sqlite3' was not found. Make sure you have installed it.
cause Missing better-sqlite3 dependency (native module not installed or build failed).
fix
Run 'npm install deepbase-sqlite --ignore-scripts=false' or install better-sqlite3 manually.
error TypeError: SqliteDriver is not a constructor
cause Using named import { SqliteDriver } instead of default import.
fix
Change to: import SqliteDriver from 'deepbase-sqlite'
error sqlite3 error: table already exists
cause Two DeepBase instances with same name on same path but different pragma modes causing schema conflict.
fix
Use identical pragma mode or different database names.
error Error: Cannot find module 'deepbase'
cause Missing peer dependency deepbase.
fix
Run 'npm install deepbase' alongside deepbase-sqlite.
breaking Pragma mode 'none' uses WITHOUT ROWID tables by default in v3.0+ causing schema mismatch with databases created by v2.x.
fix Use explicit pragma: 'none' to create backward-compatible tables.
deprecated SqliteFastDriver is deprecated. Use SqliteDriver with {pragma: 'fast'} instead.
fix Replace SqliteFastDriver with new SqliteDriver({ pragma: 'fast' }).
gotcha Native module better-sqlite3 requires build tools (Python, C++ compiler) if prebuilt binaries are unavailable.
fix Install with --ignore-scripts=false or manually install better-sqlite3 after checking build prerequisites.
gotcha Singleton connection sharing can lead to unexpected state if one instance is closed while others are still in use.
fix Manage a single instance per database file or use separate paths to avoid sharing.
gotcha The 'seq' column was added in v3.3+ for deterministic ordering. Legacy databases without this column will order by key alphabetically.
fix Run ALTER TABLE to add seq column (driver does this automatically on connect for v3.3+).
npm install deepbase-sqlite
yarn add deepbase-sqlite
pnpm add deepbase-sqlite

Creates a DeepBase instance with SQLite driver, connects, sets and retrieves a nested object, then closes.

import DeepBase from 'deepbase';
import SqliteDriver from 'deepbase-sqlite';

const db = new DeepBase(new SqliteDriver({
  path: './data',
  name: 'quickstart',
  pragma: 'balanced'
}));

await db.connect();

await db.set('users', 'alice', { name: 'Alice', age: 30 });
const alice = await db.get('users', 'alice');
console.log(alice); // { name: 'Alice', age: 30 }

await db.close();