@healthzkit/sqlite package provides HealthAdapter helpers for better-sqlite3 (synchronous), sqlite3 (callback driver), and @libsql/client (libSQL / Turso). Successful checks run a lightweight SQL probe (default SELECT 1) and return ok with metadata.latencyMs plus any fields from an optional metadata hook; failures return fail with the caught error.
Install the adapter package and one database client:
Package entrypoints
@healthzkit/sqlite-betterSqlite3Adapter,sqlite3Adapter,libsqlAdapter, and their option types.@healthzkit/sqlite/better-sqlite3-betterSqlite3Adapteronly.@healthzkit/sqlite/sqlite3-sqlite3Adapteronly.@healthzkit/sqlite/libsql-libsqlAdapteronly.
Shared options
Every factory acceptsBaseSqliteOptions:
Pass either connection credentials or an existing
client (not both). The shape depends on the adapter (see below).
betterSqlite3Adapter (better-sqlite3)
Peer: better-sqlite3 >= 12.
Runs client.prepare(query).get() and records round-trip latency. Best for embedded SQLite in the same process.
Connection string
PassconnectionString. The adapter lazily imports better-sqlite3, opens the database once, and reuses it across checks.
connectionString is a file path (for example ./data/app.db) or :memory:.
Existing client
sqlite3Adapter (sqlite3)
Peer: sqlite3 >= 5 or >= 6.
Uses the classic callback API: client.get(query, callback). Suitable when you already depend on node-sqlite3.
Connection string
PassconnectionString. The adapter opens the database via new sqlite3.Database(connectionString, mode, callback) and caches the handle. Default open mode is OPEN_READWRITE | OPEN_CREATE.
Existing client
libsqlAdapter (@libsql/client)
Peer: @libsql/client >= 0.14.
Runs await client.execute(query). Use for libSQL and Turso (libsql://, https://, file URLs, and so on).
URL and token
Passurl (and optional authToken). The adapter lazily imports @libsql/client, calls createClient once, and reuses the client across checks.
Existing client
Scheduling
For databases that should not be queried on every probe, pair these adapters with aschedule on the check so readiness reads cached results (see Scheduling).