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 🙏

© 2024 – Pkg Stats / Ryan Hefner

nestjs-bull-board

v1.2.1

Published

NestJS module for bull-board

Downloads

135

Readme

This package has been migrated

This package has been migrated to the official bull-board repository and will be maintained from there.

Please use the official @bull-board/nestjs package for future support and maintenance.

NestJS bull-board module

A simple NestJS module for using bull-board with NestJS.

NPM

Installation

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

$ npm install --save nestjs-bull-board @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 "nestjs-bull-board";
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)

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 "nestjs-bull-board";
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 register
  • 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.

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 "nestjs-bull-board";

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

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