@bull-board/nestjs

中文文档
9.12.0发布于 2026/11/08MITTypeScriptCommonJS零依赖构建来源已验证近 30 天下载 224万

A NestJS module for Bull-Board dashboard.

原始使用文档
文档目录7 节
  1. Installation
  2. Register the root module
  3. Express Authentication
  4. Fastify Authentication
  5. Register your queues
  6. Registering queue instances directly
  7. Using the bull-board instance in your controllers and/or se…

@bull-board @bull-board/nestjs

NestJS for bull-board.

npm version npm downloads licence

Overview UI

Installation

Install both @bull-board/api and this module.

$ npm install --save @bull-board/nestjs @bull-board/api

Install the Express or Fastify adapter depending on what you use in NestJS (default is Express)

$ npm install --save @bull-board/express
//or 
$ npm install --save @bull-board/fastify

Register the root module

Once the installation is completed, we can import the BullBoardModule into your rootmodule e.g. AppModule.

import { Module } from '@nestjs/common';
import { BullBoardModule } from "@bull-board/nestjs";
import { ExpressAdapter } from "@bull-board/express";

@Module({
  imports: [
    BullModule.forRoot({
      // your bull module config here.
    }),

    BullBoardModule.forRoot({
      route: '/queues',
      adapter: ExpressAdapter // Or FastifyAdapter from `@bull-board/fastify`
    }),
  ],
})
export class AppModule {
}

The forRoot() method registers the bull-board instance and allows you to pass several options to both the instance and module. The following options are available.

  • route the base route for the bull-board instance adapter.
  • adapter The routing adapter to be used, either the Express Adapter or Fastify Adapter provided by bull-board.
  • boardOptions options as provided by the bull-board package, such as uiBasePath and uiConfig
  • middleware optional middleware for the express adapter (e.g. basic authentication)

Express Authentication

For Express, install express-basic-auth:

$ npm install --save express-basic-auth

Modify the BullBoardModule.forRoot() method:

import basicAuth from "express-basic-auth";

BullBoardModule.forRoot({
  route: "/queues",
  adapter: ExpressAdapter,
  middleware: basicAuth({
    challenge: true,
    users: { admin: "passwordhere" },
  }),
}),

Fastify Authentication

For Fastify, you can use fastify-basic-auth:

$ npm install --save fastify-basic-auth

Then apply it using middleware:

import fastifyBasicAuth from "fastify-basic-auth";

BullBoardModule.forRoot({
  route: "/queues",
  adapter: FastifyAdapter,
  middleware: (req, res, next) => {
    fastifyBasicAuth({
      validate: async (username, password, req, reply) => {
        if (username === "admin" && password === "passwordhere") {
          return;
        }
        throw new Error("Unauthorized");
      },
    })(req, res, next);
  },
}),

Register your queues

To register a new queue, you need to register BullBoardModule.forFeature in the same module as where your queues are registered.

import { Module } from '@nestjs/common';
import { BullBoardModule } from "@bull-board/nestjs";
import { BullMQAdapter } from "@bull-board/api/bullMQAdapter";
import { BullModule } from "@nestjs/bullmq";

@Module({
  imports: [
    BullModule.registerQueue(
      {
        name: 'my_awesome_queue'
      }
    ),
    
    BullBoardModule.forFeature({
      name: 'my_awesome_queue',
      adapter: BullMQAdapter, //or use BullAdapter if you're using bull instead of bullMQ
    }),
  ],
})
export class FeatureModule {}

The forFeature method registers the given queues to the bull-board instance. The following options are available.

  • name the queue name to resolve from the Nest DI container.
  • queue a queue instance to register directly, instead of resolving it by name.
  • adapter either BullAdapter or BullMQAdapter depending on which package you use.
  • options queue adapter options as found in the bull-board package, such as readOnlyMode, description etc.

Provide either name or queue.

Registering queue instances directly

@nestjs/bullmq generates the DI token for a queue from its name only, ignoring the prefix. Two queues that share a name but use different prefixes therefore collapse onto a single DI token, and a name-based lookup cannot tell them apart. Pass the queue instances directly via queue to register them as distinct board entries:

@Module({
  imports: [
    BullBoardModule.forFeature(
      { queue: emailsTenantA, adapter: BullMQAdapter, options: { prefix: 'tenant-a:' } },
      { queue: emailsTenantB, adapter: BullMQAdapter, options: { prefix: 'tenant-b:' } },
    ),
  ],
})
export class FeatureModule {}

Using the bull-board instance in your controllers and/or services.

The created bull-board instance is available via the @InjectBullBoard() decorator. For example in a controller:

import { Controller, Get } from "@nestjs/common";
import { BullBoardInstance, InjectBullBoard } from "@bull-board/nestjs";

@Controller('my-feature')
export class FeatureController {

  constructor(
    @InjectBullBoard() private readonly boardInstance: BullBoardInstance
  ) {
  }
  
  //controller methods
}

Usage examples

  1. Simple NestJS setup

For more info visit the main README

版本与发布记录

@bull-board/nestjs 共发布 187 个版本,首次发布于 2023/06/13;过去 12 个月发布了 65 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
9.12.0latest2026/11/08今天
9.11.02026/11/017 天前
9.10.52026/10/2217 天前
9.10.42026/10/051 个月前
9.10.22026/09/291 个月前
9.10.12026/09/121 个月前

关于 @bull-board/nestjs 的常见问题

@bull-board/nestjs 是什么?

A NestJS module for Bull-Board dashboard.

如何安装 @bull-board/nestjs?

在项目目录运行 npm install @bull-board/nestjs,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:rxjs(^7.8.1)、@nestjs/core(^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0)、@nestjs/common(^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0)、@bull-board/api(^9.12.0)、reflect-metadata(^0.1.13 || ^0.2.0)、@nestjs/bull-shared(^10.0.0 || ^11.0.0 || ^12.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@bull-board/nestjs 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@bull-board/nestjs 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@bull-board/nestjs 可以商用吗?

@bull-board/nestjs 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@bull-board/nestjs 的下载量有多少?

根据 npm 官方下载统计,@bull-board/nestjs 在 2026/10/09 – 2026/11/07 这 30 天内被下载 2,239,793 次,日均约 74,660 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@bull-board/nestjs 还在维护吗?

最新版本 9.12.0 发布于 2026/11/08(今天);至今共发布 187 个版本,其中过去 12 个月发布了 65 个;首次发布于 2023/06/13。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。