JavaScript SQLite libraries

Updated Nov 2026

JavaScript SQLite libraries run SQLite, a database engine that keeps a whole database in one file, from Node.js, the browser, or a mobile app. A library either binds to the native engine or runs a WebAssembly build inside the browser. These libraries let desktop apps, mobile apps, and AI agents keep structured local data without a database server.

Popularity

better-sqlite3 has the most monthly downloads in this comparison, at 62.1M.

LibraryMonthly downloadsStarsLast releaseLicense
better-sqlite3
63.3M
7.6KNov 2026MIT
sql.js
23.9M
13.7KNov 2026MIT
libSQL client
22.1M
579Sep 2026MIT
sqlite3
11.7M
6.4KMar 2026BSD-3-Clause
Expo SQLite
10.6M
53.7KNov 2026MIT
SQLite Wasm
5.6M
1.1KOct 2026Apache-2.0
OP-SQLite
2.9M
1.1KNov 2026MIT
sqlite
1.0M
935Nov 2023MIT
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

better-sqlite3

Provides synchronous SQLite database and prepared statement APIs for Node.js.

Downloads / mo
63.3M
Stars
7.6K
Last release
13.2.0
License
MIT

Strengths

  • Reuses prepared statement objects. Prepare a statement once, then bind values for each execution.
  • Groups synchronous work into transactions. Commit successful callbacks and roll back callbacks that throw.

Limitations

  • Transaction callbacks cannot await. Keep asynchronous work outside the transaction callback.
  • Large integers need BigInt handling. Use BigInt when stored integers exceed JavaScript number precision.

Quickstart

From api.md
$ npm install better-sqlite3@13.2.0
const Database = require("better-sqlite3");
const db = new Database(":memory:");
console.log(db.prepare("SELECT 1 AS value").get());
db.close();

better-sqlite3 examples

From open-source projects on GitHub

Runs SQLite through WebAssembly with in-memory databases and database-file import and export.

Downloads / mo
23.9M
Stars
13.7K
Last release
1.17.0
License
MIT

Strengths

  • Runs in browsers and Node. Use the same database API across browser and Node hosts.
  • Exports a complete database file. Export the database as a Uint8Array for separate storage.

Limitations

  • Changes stay in memory. Export and store database bytes when changes must survive a reload.
  • Prepared statements need explicit cleanup. Free prepared statements after use to release their memory.

Quickstart

From README.md
$ npm install sql.js@1.17.0
const initSqlJs = require("sql.js");
initSqlJs().then(SQL => {
  const db = new SQL.Database();
  console.log(db.exec("SELECT 1 AS value"));
  db.close();
}).catch(console.error);

sql.js examples

From open-source projects on GitHub

Uses a JavaScript client for local SQLite databases and remote libSQL services.

Downloads / mo
22.1M
Stars
579
Last release
0.18.0
License
MIT

Strengths

  • Supports local and remote databases. Choose a local database file or a remote libSQL connection.
  • Groups statements into batches. Submit multiple statements together with an explicit transaction mode.

Limitations

  • Web clients cannot open files. Use the Node client for local file URLs.
  • Replica writes go to primary. Embedded replicas forward writes to the primary instead of accepting offline writes.

Quickstart

From index.mjs
$ npm install @libsql/client@0.18.0
import { createClient } from "@libsql/client";
const client = createClient({ url: ":memory:" });
console.log((await client.execute("SELECT 1 AS value")).rows);
client.close();

libSQL client examples

From open-source projects on GitHub

Provides SQLite bindings for Node.js.

Downloads / mo
11.7M
Stars
6.4K
Last release
6.0.1
License
BSD-3-Clause

Quickstart

From API.md
$ npm install sqlite3@6.0.1
const sqlite3 = require("sqlite3");
const db = new sqlite3.Database(":memory:", err => {
  if (err) throw err;
  db.get("SELECT 1 AS value", [], (err, row) => {
    if (err) throw err;
    console.log(row);
    db.close();
  });
});

sqlite3 examples

From open-source projects on GitHub

Belongs to Expo, a React framework for native apps on Android, iOS, and the web.

Downloads / mo
10.6M
Stars
53.7K
Last release
58.0.18
License
MIT

Quickstart

From sqlite.mdx
$ npx expo install expo-sqlite@58.0.18
import * as SQLite from "expo-sqlite";
async function firstQuery() {
  const db = await SQLite.openDatabaseAsync("demo.db");
  console.log(await db.getFirstAsync("SELECT 1 AS value"));
  await db.closeAsync();
}
firstQuery().catch(console.error);

Expo SQLite examples

From open-source projects on GitHub

Packages SQLite WebAssembly APIs for browser, worker, and in-memory Node usage.

Downloads / mo
5.6M
Stars
1.1K
Last release
3.54.1-build1
License
Apache-2.0

Strengths

  • Exposes prepared SQLite statements. Bind values, step through rows, and finalize native statement objects.
  • Uses browser-private file storage. Open an OPFS database from a worker for persistent browser storage.

Limitations

  • Node databases stay in memory. Use another binding when Node needs persistent database files.
  • OPFS databases need worker execution. Move the OPFS database workload off the browser’s main thread.

Quickstart

From main.ts
$ npm install @sqlite.org/sqlite-wasm@3.54.1-build1
import sqlite3InitModule from "@sqlite.org/sqlite-wasm";
const sqlite3 = await sqlite3InitModule();
const db = new sqlite3.oo1.DB(":memory:");
console.log(db.selectValue("SELECT 1"));
db.close();

SQLite Wasm examples

From open-source projects on GitHub

Provides a SQLite library for React Native.

Downloads / mo
2.9M
Stars
1.1K
Last release
19.0.5
License
MIT

Quickstart

From README.md
$ npm install @op-engineering/op-sqlite@19.0.5
import { open } from "@op-engineering/op-sqlite";
async function firstQuery() {
  const db = open({ name: "demo.sqlite" });
  console.log((await db.execute("SELECT 1 AS value")).rows);
  db.close();
}
firstQuery().catch(console.error);

OP-SQLite examples

From open-source projects on GitHub

Wraps sqlite3 with a promise-based client and SQL migrations for Node.js.

Downloads / mo
1.0M
Stars
935
Last release
5.1.1
License
MIT

Quickstart

From README.md
$ npm install sqlite@5.1.1 sqlite3@6.0.1
import sqlite3 from "sqlite3";
import { open } from "sqlite";
const db = await open({ filename: ":memory:", driver: sqlite3.Database });
console.log(await db.get("SELECT 1 AS value"));
await db.close();

sqlite examples

From open-source projects on GitHub

FAQ

better-sqlite3 suits Node.js apps that want fast synchronous queries on a local file. sql.js and SQLite Wasm suit browser apps. Expo SQLite and OP-SQLite suit React Native apps.

libSQL is a fork of SQLite that also runs as a remote database service. The libSQL client connects to local libSQL files and to remote libSQL services from one API.

better-sqlite3 runs queries synchronously with reusable prepared statements. sqlite3 uses callbacks for its run, get, and all operations.

sql.js runs SQLite through WebAssembly with an in-memory database that the app imports and exports as bytes. SQLite Wasm is the official WebAssembly build, with persistent storage in a worker.

Expo SQLite is the Expo module for SQLite in React Native apps. It offers asynchronous and synchronous query APIs, with data that persists on the device.

For coding agents

Found your SQLite library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official