bullmq-job-architect

Designs and implements BullMQ job queues with Redis, workers, DLQs, and monitoring.

1|Updated Aug 25, 2026
One-click install
npx skills add https://github.com/sabiscore/swarmxq --skill bullmq-job-architect-sabiscore
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bullmq-job-architect
Source: https://github.com/sabiscore/swarmxq/tree/main/.ai/skills/bullmq-job-architect
Command: npx skills add https://github.com/sabiscore/swarmxq --skill bullmq-job-architect-sabiscore

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires bullmq, ioredis, @bull-board/api, @bull-board/fastify.

What problem does it solve? Setting up background job processing with BullMQ involves non-obvious production pitfalls: shared Redis connections cause deadlocks, default concurrency of 1 bottlenecks throughput, unbounded completed-job retention exhausts Redis memory, and failed jobs vanish without a dead letter queue. This Skill provides a complete, correct-by-default architecture for BullMQ-based background job systems. ## Core Features & Use Cases - Queue Architecture: Enforces one queue per job type with separate ioredis connections for Queue, Worker, and QueueEvents roles, plus a concurrency sizing formula based on rate limits and job duration. - Failure Handling: Implements exponential backoff retries, dead letter queues with replay support, and graceful worker shutdown that drains active jobs before closing. - Advanced Patterns: Covers dependent job flows with FlowProducer, cron-based recurring jobs with stable jobIds, rate limiting for external API quotas, and Bull Board monitoring UI behind authentication. - Use Case: You need to send transactional emails, generate PDFs, and call LLM APIs in the background without blocking your Fastify API. This Skill produces isolated queues per job type, correctly sized workers, a DLQ for failed jobs, and a Bull Board dashboard at /admin/queues. ## Quick Start Ask the AI to set up a BullMQ background job queue for your task, for example: "Set up BullMQ for sending transactional emails with retry logic and a dead letter queue."

Frequently Asked Questions about bullmq-job-architect

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a BullMQ job queue with Redis?

Create a Queue instance with its own ioredis connection, define defaultJobOptions with attempts and exponential backoff, and add jobs via queue.add. Each job type gets its own queue, and Queue, Worker, and QueueEvents each need separate Redis connections to avoid deadlocks.

How do I handle failed jobs in BullMQ?

Configure attempts with exponential backoff in defaultJobOptions, then listen to the worker's failed event. When attemptsMade reaches the configured attempts, move the job to a dedicated dead letter queue that stores the original job data, error message, and stack for later inspection and replay.

How do I size BullMQ worker concurrency?

Use the formula concurrency = ceil(rate_limit_per_sec × avg_job_duration_sec × 1.2 buffer). For CPU-bound jobs like PDF generation, use os.cpus().length instead. Transactional email workers typically run 20-50 concurrent jobs, while cron workers use concurrency of 1.

Why does my BullMQ worker hang or deadlock with Redis?

BullMQ deadlocks when Queue, Worker, and QueueEvents share a single ioredis connection, or when the connection lacks required settings. Create a separate connection per role and set maxRetriesPerRequest to null and enableReadyCheck to false in the Redis options.

How do I schedule recurring cron jobs with BullMQ?

Add a job with a repeat option containing a cron pattern, such as '0 2 * * *' for daily at 2am UTC. Always set a stable jobId so the recurring job registers only once, and use removeRepeatable with the same pattern to unregister it.

Does BullMQ support dependent jobs or workflows?

Yes, BullMQ's FlowProducer supports parent-child job trees where children complete before parents run. You define the tree with nested children arrays across different queues, and BullMQ processes it bottom-up, such as validate then generate PDF then send email.