Menu

1 / 2

node:sqlite: The Database That Already Ships With Node

DEV Community: node·Danny Holloran·3 days ago
#YHdZjvxI
#devtonodejs#devto#dev#node#sqlite
Reading 0:00
15s threshold

Every small Node project hits the same fork in the road. You need to persist something: a queue of jobs, a cache of API responses, the bookmarks for a CLI tool. A JSON file feels too fragile, Postgres feels like too much, and SQLite feels right until you remember it means a native addon, a node-gyp build, and a CI image that suddenly needs Python and a C++ toolchain.

That last part is no longer true. Node ships SQLite in the box as node:sqlite . It landed in v22.5.0 behind a flag, dropped the flag in v22.13.0 and v23.4.0, and was promoted to release candidate (stability 1.2) in v25.7.0. With Node 26 now in Active LTS, it is a reasonable default for the "I just need a local database" problem.

The whole API fits in your head

There is no connection pool, no promise wrapper, and no ORM. You open a database, prepare statements, and run them:

import { DatabaseSync } from "node:sqlite" ;

const db = new DatabaseSync ( "app.db" , { timeout : 5000 } ) ;

db .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.