TL;DR: SureQ is a job queue for Node.js and TypeScript with retries, schedules, dead letters and real delivery guarantees. One
npm install, zero runtime dependencies, no extra server. Run the example below and you'll have a working queue before your coffee cools.
Every Node.js app ends up needing background work: send the welcome email, resize the upload, sync the customer, run the nightly report. The usual answer is a queue library plus a Redis server, and suddenly your "quick feature" comes with infrastructure to provision, secure and monitor before a single job can run.
SureQ takes a different route. It's a job queue with everything you'd expect (retries, delays, priorities, cron schedules, batch workers, dead letters, health checks) built around a store contract: a small, documented set of operations that lets SureQ run on top of the database you already have. You get a queue that starts in one line, and you don't take on a new server to get it.
Your first queue
npm install @sureq/core Save this as first-queue.mjs and run it with node first-queue.mjs:
import { Queue, UnrecoverableError } from '@sureq/core' const queue = new Queue('emails', { defaultJobOptions: { maxAttempts: 3 } }) const worker = queue.process(async (job) => { if (!job.data.to.includes('@')) throw new UnrecoverableError('invalid address') return { sent: true } }, { concurrency: 5 }) worker.on('completed', ({ job }) => console.log(job.id, 'completed')) worker.on('failed', ({ job, reason }) => console.log(job.id, 'failed:', reason)) worker.on('error', ({ error }) => console.error('worker error', error)) const drained = new Promise((resolve) => queue.on('drained', resolve)) await queue.add({ to: 'ada@example.com' }, { id: 'welcome-ada' }) await queue.add({ to: 'not-an-email' }, { id: 'oops' }) await drained console.log(await queue.getCounts()) await queue.close() The output:
store is not durable; jobs are lost on restart { queue: 'emails' } welcome-ada completed oops failed: unrecoverable { waiting: 0, delayed: 0, active: 0, completed: 1, failed: 1, cancelled: 0, blocked: 0 } That's a working queue: no config file, no Docker container, no connection string. A few things worth noticing:
- Typed jobs. Give the queue a type,
new Queue<Email>('emails'), andjob.datais checked at compile time. Results are typed too. - Errors decide retries. A plain
Erroris retried with backoff up tomaxAttempts. AnUnrecoverableErrorfails at once, so you never burn retries on a bad email address. - It tells you what it's running on. With no store configured, SureQ uses its built-in in-memory store and says so in the first log line. That's perfect for scripts, tests and local development. Point it at a durable store and the line goes away.
Everything you'll reach for
| You want to... | SureQ gives you |
|---|---|
| Retry with a delay | backoff per job or per queue: fixed, exponential with jitter, or your own function |
| Run later | delay: '10m', and priority to put urgent work first |
| Run on a schedule | cron or fixed-interval schedules, safe to declare from every pod at start-up |
| Process in groups | batch workers that take several jobs at once |
| Handle failures | dead letters for jobs that fail for good, and redrive to run them again |
| Shut down cleanly | graceful shutdown whose default fits Kubernetes' 30-second grace period |
| Know it's healthy | health() for readiness probes, plus metrics and suggested alert rules |
| Enqueue from a web server | a lightweight producer entry point that adds jobs without running workers |
Every option has a sensible default. You can start with none of them set and add them as you need them.
Guarantees you can actually rely on
Plenty of queues say "reliable." SureQ writes down exactly what that means:
- At least once. An accepted job runs until it completes or fails for good. Nothing is silently dropped; jobs that fail for good are kept as dead letters.
- Stored before
addresolves. Whenawait queue.add()returns, the job is in the store, not sitting in a buffer inside your process. - One owner at a time. Each running job holds a lease. If a worker stalls past its lease, another can pick the job up, and the stalled worker's late writes are rejected by a fencing token. No double completions, no stale results.
- One clock. Leases, delays, retries and schedules run on the store's clock, so pods with drifting clocks don't break your schedules.
- Self-healing. When a worker dies, any other worker on the queue reclaims its jobs within about one lease duration plus a sweep interval. No restart, no manual cleanup.
Built for the database you already have
A queue is only as durable as the storage behind it, and most teams already run a database they trust. So instead of hard-wiring SureQ to one backend, its storage layer is a store contract: claim a job, renew its lease, record its outcome, and a handful of other operations, each one documented with the rules it must keep.
To prove a store gets those rules right, there's @sureq/store-test, a conformance suite that every store runs against. If your store passes, every guarantee above holds on it. That's the same suite the built-in store passes, so there's no "works on the reference implementation only" gap.
The upshot: the queue code you write today against the in-memory store is the same code you'll run in production. Swapping the store is one option on the constructor.
Why give it a try
- Five minutes to a working queue. Install, paste, run.
- Zero runtime dependencies. Nothing extra in your supply chain.
- TypeScript first. Typed jobs, typed results, typed errors, ESM and CommonJS builds.
- Production-minded from day one. Leases, fencing, graceful shutdown, health checks and metrics are in the core, not plugins.
- Docs written for humans and for AI tools. Every page is also served as plain Markdown via llms.txt, so your coding assistant can read it too.
SureQ runs on Node.js 22 and newer.
Try it and tell us what you think
The best thing you can do right now is put SureQ on something real:
- Run the example above, or drop
@sureq/coreinto a project you already have. - Star the repo on GitHub if you'd like to follow along.
- Open an issue on the issue tracker for anything that surprises you. Your Node version and a short snippet is plenty.
Full docs, guides and API reference: sureq-js.github.io/sureq.