npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@queuelabs/bullmq-utils

v1.3.0

Published

Reusable BullMQ-based job queue microservice with support for email, PDF, and webhooks.

Readme

BullMQ Job Queue Microservice

BullMQ Job Queue Microservice

npm version downloads license node version

Production-ready background job processing system for Node.js using BullMQ and Redis. Handles emails, PDFs, webhooks, scheduling, and monitoring out of the box.


What This Solves

  • Configure Redis connections (shared or per-worker)
  • Implement workers with concurrency and rate-limiter support
  • Handle retries, backoff, and timeouts
  • Schedule jobs for future execution
  • Integrate multiple email providers (Gmail / SendGrid / SMTP)
  • Monitor jobs with Bull Board
  • Docker-ready deployment

⚡ Features

  • Add jobs via REST API
  • Email worker (SMTP / Gmail / SendGrid)
  • PDF worker for invoices & reports
  • Webhook worker with retries and timeout
  • Scheduled jobs
  • Bull Board admin dashboard
  • Input validation
  • Redis-backed queues
  • Exponential retry & backoff support
  • Docker-ready deployment
  • Graceful shutdown for workers
  • Worker configuration: concurrency, limiter, timeout

🏗 Architecture

Client → REST API → Queue → Redis → Worker → External Service ↓ Bull Board Admin UI


📦 Installation

npm install @queuelabs/bullmq-utils

🔧 Quick Start

Create Redis Connection

import "dotenv/config";
import { createRedisConnection } from "@queuelabs/bullmq-utils";

const redis = createRedisConnection({
  host: process.env.REDIS_HOST,
  port: Number(process.env.REDIS_PORT),
});

📧 Email Worker Example (Gmail)

import { startEmailWorker, emailQueue } from "@queuelabs/bullmq-utils";

startEmailWorker({
  redis, // optional: defaults to shared Redis
  mail: {
    service: "gmail",
    auth: { user: process.env.EMAIL_USER, pass: process.env.EMAIL_PASS },
  },
  concurrency: 2, // optional, defaults to 1
  limiter: { max: 10, duration: 1000 }, // optional rate limiter
});

emailQueue.add(
  "sendEmail",
  { to: "[email protected]", subject: "Welcome 🚀", message: "Hello!" },
  { attempts: 3, backoff: { type: "exponential", delay: 5000 } }
);

Environment Variables

REDIS_HOST=localhost
REDIS_PORT=6379
[email protected]
EMAIL_PASS=your_app_password

🌐 Webhook Worker Example

import { startWebhookWorker, webhookQueue } from "@queuelabs/bullmq-utils";

startWebhookWorker({
  redis,              // optional: defaults to shared Redis
  concurrency: 5,     // optional
  timeout: 10000,     // optional HTTP request timeout in ms
});

webhookQueue.add(
  "sendWebhook",
  { url: "https://example.com/webhook", payload: { event: "order.created" } },
  { attempts: 5, backoff: { type: "exponential", delay: 3000 } }
);

⏰ Scheduled Jobs

import { scheduleEmail, schedulePdf, scheduleWebhook } from "@queuelabs/bullmq-utils";

// Schedule email for future
await scheduleEmail(
  "[email protected]",
  "Scheduled Email",
  "This will be sent later ⏰",
  new Date(Date.now() + 60000) // 1 minute later
);

// Schedule PDF generation
await schedulePdf("Invoice", "invoice.pdf", new Date(Date.now() + 60000));

// Schedule webhook
await scheduleWebhook("https://example.com/webhook", { orderId: 123 }, new Date(Date.now() + 60000));

📊 Monitor Jobs

Visit: http://localhost:3000/admin/queues

  • Active jobs
  • Completed jobs
  • Failed jobs
  • Retry attempts

🐳 Docker Deployment

docker run -d --name redis-server -p 6379:6379 redis

⚙ Production Capabilities

  • Shared Redis connections for multiple queues
  • Configurable concurrency & rate limiter per worker
  • Job timeouts
  • Graceful worker shutdown (SIGTERM / SIGINT)
  • Horizontal scaling support
  • Cloud-ready & containerized

💡 Example Use Cases

  • Transactional emails (SaaS onboarding)
  • Background PDF generation (invoices, reports)
  • Reliable webhook delivery
  • Notification scheduling
  • External API retries

🗺 Roadmap

  • Plugin-based custom job registration
  • Dead-letter queue (DLQ) support
  • Multi-tenant queue mode
  • Workflow orchestration layer
  • Observability integration

📜 License

MIT © Queuelabs