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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nestjstools/messaging-bootstrap

v1.3.0

Published

A lightweight NestJS utility to bootstrap messaging-based apps with HTTP and microservice modes, built on top of @nestjstools/messaging.

Readme

@nestjstools/messaging-bootstrap

A lightweight NestJS wrapper around @nestjstools/messaging, designed to simplify bootstrapping messaging-based applications.

Instead of manually configuring messaging in your AppModule, this package lets you quickly set up:

  • An HTTP server with messaging support
  • A dedicated worker (microservice) that runs only messaging consumers

Features

  • 🧵 Microservice/worker mode for consumers only
  • 🌐 HTTP server with integrated messaging
  • 🚀 Clean main.ts bootstrapping

Documentation

📘 https://nestjstools.gitbook.io/nestjstools-messaging-docs


Example Project (RabbitMQ)

🔗 https://github.com/nestjstools/messaging-rabbitmq-example


Installation

npm install @nestjstools/messaging-bootstrap
# or
yarn add @nestjstools/messaging-bootstrap

Peer Dependencies

You must also install the following packages (if not already present in your project):

npm install @nestjs/microservices @nestjstools/messaging
# or
yarn add @nestjs/microservices @nestjstools/messaging

⚠️ Warning

Do not call MessagingModule.forRoot() in your AppModule (or in any other module) when using this library.
This method should be invoked only once, and it is already handled internally by @nestjstools/messaging-bootstrap.

Including it manually will lead to duplicate initialization and unexpected behavior.


Getting Started

HTTP Server with Messaging

// main.ts
import { AppModule } from './app.module';
import { AmqpChannelConfig, ExchangeType } from '@nestjstools/messaging';
import { MessagingRabbitmqExtensionModule } from '@nestjstools/messaging-rabbitmq-extension';
import { MessagingBootstrap } from '@nestjstools/messaging-bootstrap';

async function bootstrap() {
  const app = await MessagingBootstrap.createNestApplicationWithMessaging(
    AppModule,
    //You can provide HTTP ADAPTER as second argument (optional)
    {
      messaging: {
        // Load your messaging extensions here (e.g., RabbitMQ, Redis, Amazon SQS, etc.)
        // You can also load it in AppModule
        extensions: [MessagingRabbitmqExtensionModule],

        // Define global message buses
        buses: [{ channels: ['async-command'], name: 'command.bus' }],

        // Configure messaging channels
        channels: [
          new AmqpChannelConfig({
            name: 'async-command',
            connectionUri: 'amqp://guest:guest@localhost:5672/',
            exchangeName: 'my_app_command.exchange',
            bindingKeys: ['my_app_command.#'],
            exchangeType: ExchangeType.TOPIC,
            queue: 'my_app.command',
            avoidErrorsForNotExistedHandlers: false,
            deadLetterQueueFeature: true,
            autoCreate: true,
            // If true, consumers will run in the server app.
            // Set to false when running in HTTP server mode only (no consumers).
            enableConsumer: false,
          }),
        ],
      },

      // Optional: configure NestJS application options here
      nestApplicationOptions: {
        logger: new ConsoleLogger({ json: true }),
      },
    }
  );

  await app.init();
  app.listen(3000);
}

bootstrap();

Microservice / Worker Mode

// main.ts
import { AppModule } from './app.module';
import { AmqpChannelConfig, ExchangeType } from '@nestjstools/messaging';
import { MessagingRabbitmqExtensionModule } from '@nestjstools/messaging-rabbitmq-extension';
import { MessagingBootstrap } from './bootstrap';

async function bootstrap() {
  const app = await MessagingBootstrap.createNestMicroserviceWithMessagingConsumer(
    AppModule,
    {
      messaging: {
        // Register messaging extensions (e.g., RabbitMQ, Redis, etc.)
        // You can also load it in AppModule
        extensions: [MessagingRabbitmqExtensionModule],

        // Define global buses and the channels they use
        buses: [{ channels: ['async-command'], name: 'command.bus' }],

        // Configure individual messaging channels
        channels: [
          new AmqpChannelConfig({
            name: 'async-command',
            connectionUri: 'amqp://guest:guest@localhost:5672/',
            exchangeName: 'my_app_command.exchange',
            bindingKeys: ['my_app_command.#'],
            exchangeType: ExchangeType.TOPIC,
            queue: 'my_app.command',
            avoidErrorsForNotExistedHandlers: false,
            deadLetterQueueFeature: true,
            autoCreate: true,

            // Consumers are always enabled in worker mode
            // (i.e., when using createNestMicroserviceWithMessagingConsumer)
          }),
        ],
      },

      // Optional: provide NestJS microservice options here
      nestMicroserviceOptions: {
        logger: new ConsoleLogger({ json: true }),
      },
    }
  );

  await app.init();
  app.listen(3000);
}

bootstrap();