Question presented to candidate: "You need a local database for a small tool and do not want to add a dependency. What does Node give you now?"
What a strong answer should cover:
node:sqliteis a built-in module β introduced experimentally in Node 22, stabilising further in later releases β that gives you a SQLite database with zero npm dependency.- Its API is synchronous:
DatabaseSyncandStatementSyncrun queries and return results directly, no promises, no callbacks β a deliberate design choice matching SQLite's own embedded, single-process nature. - That makes it a natural fit for CLIs, build scripts, local caches, and tests β anywhere a small embedded database is useful and pulling in
better-sqlite3or a full ORM would be overkill. - It is not a general replacement for a real client-server database (Postgres, MySQL) in a multi-instance production service β SQLite's file-based, single-writer model does not fit that shape.
- Being labelled experimental in some Node versions matters for production use: check the exact stability level of the Node version you are targeting rather than assuming it is fully stable everywhere.
- The synchronous API is the headline trade-off to name: it blocks the event loop for the duration of the query, same as any synchronous file I/O β fine for small local operations, wrong for a hot request path serving concurrent users.
Clarifying questions expected:
- "Is this for a single-process tool or a concurrently-accessed service?" β decides whether the synchronous model is appropriate.
- "Which Node version, and is the feature still experimental there?"
Code / implementation expected: Optional. A short synchronous query against an in-memory database is the clearest demonstration.