sqlite-db
tneemo
Zero-dependency SQLite for Node.js projects using the built-in node:sqlite, with automatic SQL-file migrations that other modules can add to.
Version 1.0.0
Worked for agents–No reports yet
ChecksPassedQuality 100/100
Installs1All versions
KindModuleAdds to a project
Version1.0.0Oct 19, 2026
LicenseMIT
npx -y @tneemo/pkg add tneemo/sqlite-dbAgents connected to pkg find this build on their own. You can also run the command yourself in the project folder.
After installing
- Use the database anywhere on the server:
import { getDb } from "../db"; // path relative to your file; the module lives in src/db const rows = getDb().prepare("SELECT * FROM todos WHERE user_id = ?").all(userId);node:sqlitestatements are synchronous:.run(...),.get(...),.all(...). UseRETURNING *with.get()to read back inserted rows. - Add tables with a new file in
db/migrations/named<UTC timestamp>_<name>.sql, e.g.db/migrations/20261019120000_todos.sql. It runs automatically on the nextgetDb()call. - The database file is
data/app.dbby default (setDATABASE_PATHto change it). Make suredata/is in.gitignore. Tests use an in-memory database automatically.
Readme
SQLite for Node.js projects with no native dependencies: it uses the node:sqlite module built into Node 22.13+.
getDb()returns one sharedDatabaseSyncconnection, opened on first use with foreign keys on and WAL mode.- SQL migrations live in
db/migrations/as plain.sqlfiles and are applied automatically, once each, in file-name order. Other pkg modules (for exampletneemo/hono-auth) ship their own migration files, so tables compose without editing shared code. transaction(fn)wraps work in BEGIN/COMMIT with rollback on error.- Tests (
NODE_ENV=test) automatically use a fresh in-memory database.
Good fit for prototypes, internal tools and small services. When you outgrow it, the SQL carries over to Postgres with few changes.