Workmatic ๐Ÿš‚

A persistent, high-performance background job queue for Node.js backed by SQLite with zero external infrastructure dependencies.

Workmatic delivers production-grade background job processing without the operational overhead, memory consumption, or maintenance complexity of Redis, RabbitMQ, PostgreSQL, or Kafka.

Built on better-sqlite3 and Kysely, Workmatic embeds directly into your Node.js application process. It provides atomic lease-based job processing, priority queues, delayed execution, automatic exponential retries, multi-queue orchestration, an embedded real-time web dashboard, a full CLI toolset, and official Model Context Protocol (MCP) support for autonomous AI coding agents.


โšก Key Highlights #

  • ๐Ÿชถ Zero External Infrastructure: Operates purely on local SQLite databases in WAL mode (jobs.db). No Redis, Docker, or external service required.
  • โšก Extreme Hot Path Performance:
    • 37,600+ ops/sec sequential job insertion (0.03 ms latency).
    • 32,600+ ops/sec concurrent claim & process throughput.
    • 4,900+ ops/sec live queue statistics queries via composite covering indexes.
  • ๐Ÿ”’ Atomic Lease-Based Claiming: Single-pass UPDATE ... WHERE rowid IN (SELECT ...) RETURNING ... guarantees exactly-once claiming with zero duplicate execution across concurrent workers.
  • โฑ๏ธ Event-Driven Wakeup: Eliminates polling latency. When a ready job is enqueued, waiting workers wake up immediately (~0.03 ms) instead of waiting for the 1000 ms poll timer.
  • ๐Ÿง  Smart Memory Caching: O(1) LRU prepared statement cache eliminates SQLite query compilation overhead on hot paths.
  • ๐Ÿ“ฆ Completion Micro-Batching: High-concurrency job completions are grouped into single atomic writes, boosting processing throughput by over 60%.
  • ๐ŸŽ›๏ธ Multi-Queue Orchestration: Register and manage multiple queues, bulk transfer jobs between queues (e.g. dead-letter queues), or move individual jobs.
  • ๐Ÿ“Š Embedded Web Dashboard & Middleware: Mountable real-time monitoring UI with zero frontend build dependencies, compatible with Express, Connect, or standalone HTTP.
  • ๐Ÿค– Native Model Context Protocol (MCP): 12 built-in AI tools enabling Claude Desktop, Cursor, and Antigravity to monitor queues, debug dead jobs, update job status, and receive real-time signals.
  • ๐Ÿ›ก๏ธ Production Reliability & Graceful Shutdown: Full support for OS signal handling (SIGINT, SIGTERM), draining jobs safely during container or process termination.

๐Ÿš€ Quick Example #

TYPESCRIPT
import { createDatabase, createClient, createWorker } from 'workmatic';

// 1. Initialize SQLite database with optimal pragmas (WAL mode, memory temp store, 64MB cache)
const db = createDatabase({ filename: './jobs.db' });

// 2. Create worker and define job processor
const worker = createWorker({ db, queue: 'emails', concurrency: 4 });

worker.process(async (job) => {
  console.log(`Processing email job ${job.id}:`, job.payload);
  // Send email...
});

worker.start();

// 3. Enqueue jobs from anywhere in your app
const client = createClient({ db, queue: 'emails' });

await client.add({
  to: 'user@example.com',
  subject: 'Welcome to Workmatic!',
});

๐Ÿงญ Documentation Map #

GuideDescription
Getting StartedInstallation, initial database setup, and basic client/worker workflows
Architecture & EngineSQLite WAL tuning, atomic claiming, partial indexes, and event-driven wakeup
Client APIEnqueuing jobs (add, addMany), priorities, delays, stats, and clearing
Worker APIConcurrency, leases, timeouts, backoff strategies, and completion batching
OrchestratorManaging multiple queues, cross-queue transfers, and queue pauses
Web DashboardEmbedded UI and Express/Connect middleware for live monitoring
Model Context Protocol (MCP)Connecting AI assistants (Claude, Cursor, Antigravity) with 12 tools and signals
CLI ReferenceManaging queues, retrying dead jobs, and CSV export/import via CLI
Graceful ShutdownSafe process termination in Docker, Kubernetes, and Node.js environments
BenchmarksPerformance metrics, latency tables, and reproducible benchmark commands