better-sqlite3

The fastest and simplest SQLite3 library for Node.js, with a synchronous API and full transaction support.

Library
npm
v13.0.3
7,443stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
86/100Excellent
Development Activity88
Maintenance92
Community64
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
90/100Excellent
Architecture90
Code Quality90
Innovation95
Learning Curve85

better-sqlite3 is a high-performance SQLite3 binding for Node.js that exposes a deliberately synchronous API. Instead of forcing callbacks or promises onto operations that are CPU-bound and serialized by SQLite anyway, it lets you prepare statements and read rows inline, which is both simpler to reason about and measurably faster than asynchronous alternatives.

Built on a native C++ addon that embeds SQLite directly, it delivers full transaction support, user-defined functions, aggregates, virtual tables, 64-bit integers, and worker-thread support. Prebuilt binaries ship for supported Node.js LTS versions, so most projects can install and query a database in a couple of lines.

What You Get

  • A synchronous prepared-statement API with get(), all(), iterate(), and run() for reading and writing rows without callbacks or promises
  • Full transaction support via db.transaction(), including nested savepoints and automatic rollback on error
  • Extensibility hooks for user-defined functions, aggregates, virtual tables, and loadable extensions
  • First-class 64-bit integer handling, opt-in per statement or database-wide
  • Prebuilt native binaries for supported Node.js LTS versions, plus worker-thread support for large or slow queries

Common Use Cases

  • Embedding a fast local database in desktop, CLI, or Electron applications
  • Powering server-side caches, queues, or read-heavy stores where an embedded database beats a network round-trip
  • Running data-import, ETL, or migration scripts that need tight synchronous control over transactions
  • Backing test suites and prototypes with an in-memory SQLite database

Under The Hood

Architecture - better-sqlite3 is a thin, well-factored JavaScript layer (lib/database.js and lib/methods/*.js) sitting on top of a native C++ addon (src/objects/database.cpp, statement.cpp, backup.cpp) that embeds SQLite from deps/. The Database constructor validates options, lazily loads the compiled better_sqlite3.node binding via the bindings package, and wires prototype methods (prepare, transaction, pragma, backup, function, aggregate, table) onto each instance; a hidden cppdb symbol holds the native handle so calls like prepare().get() drop straight into C++ for execution.

Tech Stack - The library targets Node.js 20 through 26 and ships as JavaScript (~68%) over C++ (~32%). Runtime dependencies are minimal: bindings for locating the addon and prebuild-install to fetch prebuilt binaries, falling back to node-gyp rebuild through binding.gyp when none match. Testing and benchmarking use mocha, chai, nodemark, and the competing sqlite/sqlite3 packages for comparison.

Code Quality - The repo carries a substantial mocha suite of roughly thirty numbered test files covering database open/close, pragmas, statement run/get/all/iterate, transactions, and error cases. Input validation is thorough and defensive: the constructor throws precise TypeError/RangeError messages for misspelled or removed options, and errors surface through a dedicated SqliteError class. Naming is consistent and the small util module keeps shared symbols and option parsing centralized.

API Design - The public surface is deliberately minimal and ergonomic: new Database(path) then prepare(sql) returning a statement with get/all/iterate/run keeps boilerplate near zero, and the synchronous model removes the callback nesting other bindings require. Extensive docs (api.md plus dedicated performance, integer, threads, and troubleshooting guides) and clear README examples make the learning curve gentle for anyone who already knows SQL.

Used by 39 apps in this directory

TypeScript
94%
MIT

Actual

Invoicing Finance

28,224

Local-first personal finance with envelope budgeting, end-to-end encryption, and multi-device sync — no subscription required.

View details
93
Repo Health
85
Technical
77
Dependency
Built with
TypeScript94%
Updated yesterday
TypeScript
86%
MIT

Agents Observe

Developer Tools

652

A real-time, fully local observability dashboard for Claude Code and Codex agent sessions — filtering, search, session replay, and token/cost breakdowns via an auto-starting MCP server.

View details
71
Repo Health
67
Technical
77
Dependency
Built with
TypeScript86%
JavaScript11%
Updated 4 weeks ago
TypeScript
95%
Apache 2.0

AionUi

AI Agents · Productivity

32,102

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript95%
Updated today
Rust
67%
MIT

Bun

Developer Tools

95,452

An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.

View details
92
Repo Health
91
Technical
66
Dependency
Built with
Rust67%
C++19%
Updated today
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

50,753

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
88
Repo Health
84
Technical
71
Dependency
Built with
TypeScript99%
Updated today
TypeScript
97%
Apache 2.0

Cline

AI Code Assistants

66,453

An open-source AI coding agent that lives in your editor and terminal — reads and edits your codebase, runs commands, browses the web, and requires human approval for every action by default.

View details
90
Repo Health
74
Technical
67
Dependency
Built with
TypeScript97%
Updated today
TypeScript
99%
Apache 2.0

Colanode

Knowledge Management · Team Chat · Collaboration

5,018

Local-first, self-hosted workspace that combines real-time chat, Notion-style pages, and structured databases — all synced via CRDTs so you work offline without losing a keystroke.

View details
47
Repo Health
73
Technical
73
Dependency
Built with
TypeScript99%
Updated 4 months ago
TypeScript
96%
Other

Dyad

AI Development · Productivity · AI Code Assistants

21,279

Build AI-powered apps locally with your own keys, your own models, and zero cloud lock-in.

View details
88
Repo Health
83
Technical
70
Dependency
Built with
TypeScript96%
Updated today
TypeScript
96%

Finance

AI Assistants · Invoicing Finance

890

Bloomberg-grade financial data and AI-powered analysis through a conversational chat interface you can self-host.

View details
62
Repo Health
62
Technical
71
Dependency
Built with
TypeScript96%
Updated 1 weeks ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search