Package reference
Mirrors the package README (single source). Install @basaltkit/notifications-sqlite v1.0.2 — npm · source.
<p align="center"> <a href="https://basaltkit-docs.pages.dev"> <img src="https://basaltkit-docs.pages.dev/social-card.png" alt="Basalt" width="440"> </a> </p>
@basaltkit/notifications-sqlite
Durable, SQLite-backed implementation of the @basaltkit/notificationsInAppStore — the in-app notification inbox — built on Node's built-in node:sqlite. Zero external dependencies.
Swap it in for the in-memory store and the inbox survives a restart — no ORM, no migration tool, no service. The single-node reference backend; the production (Postgres/MySQL) counterpart is @basaltkit/notifications-prisma.
pnpm add @basaltkit/notifications-sqlite # peer: @basaltkit/notifications> Requires Node 22.5+. Stable and flag-free on Node 24; on 22.x run with > --experimental-sqlite.
Use it
@basaltkit/notifications takes the in-app store as the inApp channel option:
import { notificationsPlugin } from '@basaltkit/notifications'
import { sqliteInAppStore } from '@basaltkit/notifications-sqlite'
const n = sqliteInAppStore('./data/notifications.db') // ':memory:' by default
const app = await createApp({
plugins: [notificationsPlugin({ inApp: n.store, mailer })],
}).boot()SqliteInAppStore is also exported and takes a DatabaseSync, so it can share a handle with the other *-sqlite stores. openNotificationsDatabase() and migrate() are exported too.
Notes
- One
in_app_notificationstable, indexed by recipient. list()returns newest-first, withunreadOnlyandlimit, matching the in-memory store;unreadCount()counts unread.markRead()marks only an existing, still-unread notification (aWHERE … read_at IS NULLguard), so it's idempotent and reports whether it actually changed anything.datais stored as JSON text and round-trips unchanged.node:sqliteis synchronous; the methods stayasyncto honor the contract.
License
MIT