The fastest and simplest SQLite library for Node.js, with a synchronous API that outperforms alternatives like sqlite3 by 2-24x in common operations. Version 12.10.0 requires Node.js 20+ and includes prebuilt binaries for LTS. Key differentiators: full transaction support, user-defined functions/aggregates/virtual tables, 64-bit integer support, and worker thread compatibility. The synchronous API is designed to be safer and more efficient than async equivalents for SQLite's inherently single-threaded nature.
npm install better-sqlite3No compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates in-memory database, enables WAL, creates table, inserts rows in transaction, and queries a single row.
Use worker threads for long queries, or ensure queries are fast (indexed, small).
Always call db.pragma('journal_mode = WAL') after opening.Call db.close() when done, or use a wrapper with cleanup.
Use db.defaultSafeIntegers(true) to restore old behavior, or handle BigInt values.
Use db.prepare('sql').all({ pluck: true }) instead of .pluck().all().Install locally: npm install better-sqlite3
Upgrade Node.js to 20+ or use an older version of better-sqlite3 (but note that older versions are unsupported).
Use const stmt = db.prepare('...'); const row = stmt.get();No dependency data recorded yet.