@deeblr/auth-adapter-sqlite
v0.4.0
Published
A real, persistent DatabaseAdapter for Deeblr Auth backed by Node's built-in node:sqlite module. Zero external dependencies. Supports transactions and sessions; file-backed or in-memory.
Readme
@deeblr/auth-adapter-sqlite
A real, persistent DatabaseAdapter for Deeblr Auth backed by Node's
built-in node:sqlite module. Zero external dependencies — no
better-sqlite3, no native build step.
Requirements
Node.js >= 22.5.0 (node:sqlite is experimental; Node prints an
ExperimentalWarning on first use — that's Node's own notice, not a sign
anything here is incomplete).
Install
npm install @deeblr/auth-adapter-sqliteUsage
import { DeeblrAuth } from "@deeblr/auth";
import { SqliteDatabaseAdapter } from "@deeblr/auth-adapter-sqlite";
const auth = new DeeblrAuth({
adapter: new SqliteDatabaseAdapter({ filename: "./data/auth.db" }),
// or: new SqliteDatabaseAdapter() for an in-memory database (":memory:", the default)
secret: process.env.AUTH_SECRET,
});What it supports
Full DatabaseAdapter contract including sessions (with real
updateSession — sliding-expiration refresh preserves the session id, not
a delete-and-recreate), and real ACID transactions via SQLite's own
BEGIN/COMMIT/ROLLBACK.
Custom fields on your TUser type beyond the base shape (e.g. name) are
stored in a JSON column, since this adapter has no per-deployment migration
step to add real typed columns.
What it doesn't support
Search, soft-delete, and batch operations aren't implemented — the conformance suite skips those tests for this adapter rather than failing them. Nothing stops you from extending it (it's a small, single-file class) if you need them.
Testing
Passes the full @deeblr/auth-adapter-kit conformance suite, plus
dedicated tests proving real file-based durability across separate process
connections and that committed transactions survive a reconnect:
npm testLicense
MIT
