BullMQ
Fast, reliable Redis-backed queue for jobs and messages in Node.js.
3. Used by agents' projects
Dependency in 35 public GitHub projects set up for AI coding agents that we scanned (0.6%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
bullmq.io/llms.txtFrom the package registry and GitHub, checked daily. Tap a verdict to see its source.How we checkedReport an error
What BullMQ does
BullMQ ships native libraries for Node.js, Python, Rust, Elixir, PHP and .NET that run the same scripts against one Redis or PostgreSQL queue, so a job added from one language can be processed by a worker in another.
BullMQ popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How BullMQ is used
- BullMQ is a dependency in 35 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (0.7% of the 4,867 JavaScript/TypeScript ones), #5 of 48 in jobs, queues and workflows.
- Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 117; those are left out of every share on this page.
- The most used alternative in our scan is Bull (6 projects).
- Projects that use it most often also use ioredis (88.6%), dotenv (74.3%), tsx (57.1%).
By coding agent
Often used with
BullMQ in practice
Strengths
The site says you can write producers in Node.js and consumers in Python against the same queue. It pitches this at microservices and polyglot stacks.
On the PostgreSQL backend, jobs are rows in a <code>bullmq</code> schema. The debugging guide shows a plain <code>SELECT state, count(*)</code> query that checks a queue without any BullMQ code.
<code>FlowProducer</code> adds a parent job and its nested children in one call. In the README example the root job sits in <code>topQueueName</code>, its children in <code>childrenQueueName</code> and the grandchildren in <code>grandChildrenQueueName</code>.
The site describes job schedulers as factories that produce jobs from cron expressions, fixed intervals or custom patterns. It also lists upsert semantics and job templates.
Watch out for
The runtimes page says only the core queue behavior is shared. Higher-level features are added to each library separately. The PHP client currently has no worker support: its table marks processing jobs, rate limiting, flows and job events as not available for PHP.
A worker renews its job lock from the Node.js event loop. Long synchronous work blocks that loop, so the lock can expire and the job is marked stalled while it is still running. The guide suggests sandboxed processors, splitting the job with flows, or a larger <code>lockDuration</code>.
The debugging guide calls a worker that listens to a different queue "the most common cause" of jobs stuck in waiting. The queue name must match including case. On Redis the prefix, host, port and database number must also match.
Add a job, process it, listen for completion
import { Queue } from 'bullmq';
const queue = new Queue('Paint');
queue.add('cars', { color: 'blue' });
import { Worker } from 'bullmq';
const worker = new Worker('Paint', async job => {
if (job.name === 'cars') {
await paintCar(job.data.color);
}
});
import { QueueEvents } from 'bullmq';
const queueEvents = new QueueEvents('Paint');
queueEvents.on('completed', ({ jobId }) => {
console.log('done painting');
});More about BullMQ
Packages around it
- ioredis: Redis client
- dotenv: .env config loader
- tsx: Run TypeScript directly
- vitest: Test runner
- zod: Schema validation
- typescript: Typed JavaScript
More in Jobs, queues and workflows
Alternatives
BullMQ This page
Redis-based job queue for Node.js.
Job queue for Node.js on PostgreSQL.
Get started
Install it.
npm install bullmqRules for your agent
## BullMQ
- Give the producer and the worker the same queue name (case matters). On Redis, also match the `prefix` (default `bull`), host, port and database number. On PostgreSQL, match the database and schema (default `bullmq`).
- Make every processor code path return or throw, and add timeouts to network calls. A processor that never settles keeps the job active forever.
- Move CPU-heavy processors to sandboxed processors, or split them with flows, so the worker can keep renewing its lock.
- On shutdown, handle `SIGTERM` with `await worker.close()` so current jobs finish before exit.
- On PostgreSQL, run `runMigrations` as a deploy step or pass `migrate: true` on the connection. Otherwise workers fail with `SchemaMigrationRequiredError`.
- Only read BullMQ's PostgreSQL tables. Change jobs through BullMQ or a dashboard, never with direct SQL writes.
- When using the node-redis adapter (`createNodeRedisClient`), install `redis` 5.0.0 or newer.