{"id":27685,"library":"deepbase-sqlite","title":"DeepBase SQLite Driver","description":"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.","status":"active","version":"3.6.9","language":"javascript","source_language":"en","source_url":"https://github.com/clasen/DeepBase","tags":["javascript","deepbase","sqlite","sqlite3","driver","database","persist","nested","objects","typescript"],"install":[{"cmd":"npm install deepbase-sqlite","lang":"bash","label":"npm"},{"cmd":"yarn add deepbase-sqlite","lang":"bash","label":"yarn"},{"cmd":"pnpm add deepbase-sqlite","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency - driver is used with DeepBase instance","package":"deepbase","optional":false},{"reason":"underlying SQLite library (native module)","package":"better-sqlite3","optional":false}],"imports":[{"note":"Default export only. Named import will fail. TypeScript types are included.","wrong":"import { SqliteDriver } from 'deepbase-sqlite'","symbol":"SqliteDriver","correct":"import SqliteDriver from 'deepbase-sqlite'"},{"note":"DeepBase is also a default export from its own package.","wrong":"import { DeepBase } from 'deepbase'","symbol":"DeepBase","correct":"import DeepBase from 'deepbase'"},{"note":"Legacy name for SqliteDriver with pragma:'fast'. Kept for backward compatibility. Same default export pattern.","wrong":"import { SqliteFastDriver } from 'deepbase-sqlite'","symbol":"SqliteFastDriver","correct":"import SqliteFastDriver from 'deepbase-sqlite'"}],"quickstart":{"code":"import DeepBase from 'deepbase';\nimport SqliteDriver from 'deepbase-sqlite';\n\nconst db = new DeepBase(new SqliteDriver({\n  path: './data',\n  name: 'quickstart',\n  pragma: 'balanced'\n}));\n\nawait db.connect();\n\nawait db.set('users', 'alice', { name: 'Alice', age: 30 });\nconst alice = await db.get('users', 'alice');\nconsole.log(alice); // { name: 'Alice', age: 30 }\n\nawait db.close();","lang":"javascript","description":"Creates a DeepBase instance with SQLite driver, connects, sets and retrieves a nested object, then closes."},"warnings":[{"fix":"Use explicit pragma: 'none' to create backward-compatible tables.","message":"Pragma mode 'none' uses WITHOUT ROWID tables by default in v3.0+ causing schema mismatch with databases created by v2.x.","severity":"breaking","affected_versions":">=3.0.0 <3.3.0"},{"fix":"Replace SqliteFastDriver with new SqliteDriver({ pragma: 'fast' }).","message":"SqliteFastDriver is deprecated. Use SqliteDriver with {pragma: 'fast'} instead.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Install with --ignore-scripts=false or manually install better-sqlite3 after checking build prerequisites.","message":"Native module better-sqlite3 requires build tools (Python, C++ compiler) if prebuilt binaries are unavailable.","severity":"gotcha","affected_versions":"*"},{"fix":"Manage a single instance per database file or use separate paths to avoid sharing.","message":"Singleton connection sharing can lead to unexpected state if one instance is closed while others are still in use.","severity":"gotcha","affected_versions":"*"},{"fix":"Run ALTER TABLE to add seq column (driver does this automatically on connect for v3.3+).","message":"The 'seq' column was added in v3.3+ for deterministic ordering. Legacy databases without this column will order by key alphabetically.","severity":"gotcha","affected_versions":"<3.3.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run 'npm install deepbase-sqlite --ignore-scripts=false' or install better-sqlite3 manually.","cause":"Missing better-sqlite3 dependency (native module not installed or build failed).","error":"Error: The module 'better-sqlite3' was not found. Make sure you have installed it."},{"fix":"Change to: import SqliteDriver from 'deepbase-sqlite'","cause":"Using named import { SqliteDriver } instead of default import.","error":"TypeError: SqliteDriver is not a constructor"},{"fix":"Use identical pragma mode or different database names.","cause":"Two DeepBase instances with same name on same path but different pragma modes causing schema conflict.","error":"sqlite3 error: table already exists"},{"fix":"Run 'npm install deepbase' alongside deepbase-sqlite.","cause":"Missing peer dependency deepbase.","error":"Error: Cannot find module 'deepbase'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}