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

@better-bull-board/client

v0.0.15

Published

Developer documentation for integrating Better Bull Board with your BullMQ workers.

Downloads

1,566

Readme

@better-bull-board/client

Developer documentation for integrating Better Bull Board with your BullMQ workers.

Installation

npm install @better-bull-board/client

Usage

To use Better Bull Board with your BullMQ workers, you need to:

  1. Import the BBB client
  2. Use a separate processor (sandboxed processor required for job cancellation)

Basic Setup

1. Create a Processor File

Create a separate processor file (e.g., processor.ts or processor.js):

import { patch } from "@better-bull-board/client";
import type { SandboxedJob } from "bullmq";
import { redis } from "./lib/redis"; // Your Redis connection

export default patch(async (job: SandboxedJob) => {
  console.log(`Processing job ${job.id}`);
  
  // Your job processing logic here
  await processYourJob(job.data);
  
  console.log(`Job ${job.id} completed`);
  
  return { status: "done" };
}, redis);

2. Create a Worker

Use the Better Bull Board Worker class in your main worker file:

import path from "node:path";
import { Worker } from "@better-bull-board/client";
import { redis } from "./lib/redis"; // Your Redis connection

const processorFile = path.join(__dirname, "processor.cjs"); // Note: .cjs extension for built files

new Worker("your-queue-name", processorFile, {
  connection: redis,
  ioredis: redis,
  useWorkerThreads: true,
  concurrency: 10,
  getJobTags(job) {
    // Optional: Return tags for better organization
    return ["your-queue", "production"];
  },
});

Key Requirements

  • Separate Processor: You must use a sandboxed processor (separate file) for job cancellation to work properly
  • Redis Connection: Provide both connection and ioredis options pointing to the same Redis instance
  • Worker Threads: Set useWorkerThreads: true for proper isolation
  • File Extension: Use .cjs extension for the processor file path when referencing built files

Complete Example

Here's a complete working example based on our demo:

processor.ts

import { patch } from "@better-bull-board/client";
import type { SandboxedJob } from "bullmq";
import { redis } from "../lib/redis";

export default patch(async (job: SandboxedJob) => {
  console.log(`Processing job ${job.id}`);

  // Simulate work
  await new Promise((resolve) => setTimeout(resolve, 10_000));

  console.log(`Job ${job.id} processed`);

  return { status: "done" };
}, redis);

worker.ts

import path from "node:path";
import { fileURLToPath } from "node:url";
import { Worker } from "@better-bull-board/client";
import { redis } from "./lib/redis";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const processorFile = path.join(__dirname, "processor.cjs");

new Worker("demo-queue", processorFile, {
  connection: redis,
  ioredis: redis,
  useWorkerThreads: true,
  concurrency: 10,
  getJobTags() {
    return ["demo-queue", "test"];
  },
});

Advanced Features

Job Cancellation

The patch function provides built-in job cancellation support. Jobs can be cancelled through the Better Bull Board UI.

Console Logging

All console output from your processors is automatically captured and sent to Better Bull Board for monitoring.

Job Tags

Use the getJobTags function to organize and filter your jobs in the Better Bull Board interface:

getJobTags(job) {
  return [
    job.queueName,
    job.data.priority || "normal",
    process.env.NODE_ENV || "development"
  ];
}

API Reference

patch(processor, redis)

Wraps your job processor with Better Bull Board functionality.

  • processor: Your async job processing function
  • redis: Redis connection instance

Worker

Extended BullMQ Worker with Better Bull Board integration.

Required Options:

  • ioredis: Redis connection instance
  • useWorkerThreads: Must be true
  • getJobTags: Optional function to return job tags

Troubleshooting

  • Job cancellation not working: Ensure you're using a sandboxed processor (separate file)
  • Jobs not appearing: Check that your Redis connection is properly configured
  • Build issues: Make sure to reference .cjs files for built processors