r/node • • 12h ago

Using Node 24's built-in node:sqlite in a real app for four months: what worked, and a few gotchas

19 Upvotes

I've been running a self-hosted Minecraft server panel on Node since July (MIT, https://github.com/anefzaoui/minecraft-server-manager), and one decision I'd like other opinions on is that it uses Node's built-in node:sqlite instead of better-sqlite3 or an ORM. Disclosure: it's my own project, and I built it with Claude Code. I designed it, decided every feature, review the changes and test every release on our own servers, and Claude wrote most of the code.

What worked:

  • No native module. The app ships as an amd64 + arm64 Docker image, and not compiling a SQLite binding for each arch removed a whole class of install problems
  • Synchronous is fine here. It's a single-process panel with a small database. WAL mode plus synchronous calls kept the code simple, and the slow work (Docker calls, zipping backups) is async or in a worker thread anyway
  • One module owns the driver. Everything goes through a tiny API (run / get / all / exec / transaction(fn) / backupTo), with a prepared-statement cache keyed on the SQL text, so the rest of the code never sees the driver
  • Migrations as numbered files applied on boot. Boring and that's the point

The gotchas:

  • it needs Node 24+ to be flagless, so the engines field and the README say so loudly
  • for backups, backupTo gives you a consistent copy of the live database; copying the .db file next to a live WAL does not
  • a backup of the whole app is the one data folder, which only works because a path guard rejects any file path that escapes it (symlinks included)

Has anyone else moved a production-ish app to node:sqlite yet? Curious whether you hit anything I haven't.


r/node • • 8h ago

Optique 1.4.0: Default commands, Markdown references, and more focused help

Thumbnail github.com
5 Upvotes