Watchdog
A small durable job queue for TypeScript on SQLite, D1 or PostgreSQL: jobs survive a crash, run once per claim and report an honest outcome.
Fastest path
Install
Add it to your project with npm, pnpm, Yarn or Bun.
TERMINAL npm install @fungi.computer/watchdogRun your first job
Runs one job through an in-memory node:sqlite database and prints its settled status. Needs Node.js 24 for node:sqlite.
home.ts import { DatabaseSync } from "node:sqlite";import { fromNodeSqlite } from "@fungi.computer/watchdog/node-sqlite";import { Watchdog } from "@fungi.computer/watchdog";const watchdog = await Watchdog.make({owner: fromNodeSqlite(new DatabaseSync(":memory:")),execute: async () => (console.log("sending welcome-1"),{ kind: "completed" }),isAlive: async () => true,wake: { recompute: async () => {} },});await watchdog.ingest({jobId: "welcome-1",queue: "email",lane: "default",priority: 0,payload: {},state: "queued",});const tick = await watchdog.tick();console.log(tick.status); // "settled"