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

@nmime/nestjs-asyncapi

v2.0.9

Published

NestJS AsyncAPI module - generate documentation of your event-based services using decorators. Supports AsyncAPI 3.0, 2.x, and 1.x specifications.

Readme

@nmime/nestjs-asyncapi

npm version npm downloads license

AsyncAPI module for NestJS. Generate AsyncAPI documentation for event-based services (WebSockets, microservices, Kafka, AMQP, etc.) similar to @nestjs/swagger.

Features

  • AsyncAPI 3.0 support (default) - Latest specification
  • Full backward compatibility - Supports AsyncAPI 2.x (2.6.0 - 2.0.0) and 1.x (1.2.0 - 1.0.0)
  • Decorator-based documentation
  • Support for WebSocket gateways and controllers
  • Kafka and AMQP bindings support
  • HTML documentation generation
  • YAML/JSON spec export
  • Compatible with NestJS 9, 10, and 11

Demo

Installation

npm install @nmime/nestjs-asyncapi

To skip Chromium installation (used by AsyncAPI generator for PDF generation):

PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install @nmime/nestjs-asyncapi

Quick Start

1. Configure AsyncAPI in your bootstrap function

import { NestFactory } from '@nestjs/core';
import { NestExpressApplication } from '@nestjs/platform-express';
import { AsyncApiModule, AsyncApiDocumentBuilder } from '@nmime/nestjs-asyncapi';

async function bootstrap() {
  const app = await NestFactory.create<NestExpressApplication>(AppModule);

  const asyncApiOptions = new AsyncApiDocumentBuilder()
    .setTitle('Feline')
    .setDescription('Feline server description here')
    .setVersion('1.0')
    .setDefaultContentType('application/json')
    .addSecurity('user-password', { type: 'userPassword' })
    .addServer('feline-ws', {
      url: 'ws://localhost:3000',
      protocol: 'socket.io',
    })
    .build();

  const asyncapiDocument = await AsyncApiModule.createDocument(app, asyncApiOptions);
  await AsyncApiModule.setup('/async-api', app, asyncapiDocument);

  await app.listen(3000);
}

bootstrap();

2. Specify AsyncAPI Version (Optional)

By default, the module uses AsyncAPI 3.0.0. You can specify a different version:

const asyncApiOptions = new AsyncApiDocumentBuilder()
  .setAsyncApiVersion('3.0.0')  // Default - AsyncAPI 3.0
  // .setAsyncApiVersion('2.6.0')  // Use AsyncAPI 2.6
  // .setAsyncApiVersion('2.5.0')  // Use AsyncAPI 2.5
  // .setAsyncApiVersion('1.2.0')  // Use AsyncAPI 1.x
  .setTitle('My API')
  .build();

Supported versions: 3.0.0, 2.6.0, 2.5.0, 2.4.0, 2.3.0, 2.2.0, 2.1.0, 2.0.0, 1.2.0, 1.1.0, 1.0.0

3. Add decorators to your controllers/gateways

The module automatically explores Controllers and WebSocketGateway classes. Use @AsyncApi() decorator for other classes that need AsyncAPI documentation.

import { Controller } from '@nestjs/common';
import { ApiProperty } from '@nestjs/swagger';
import { AsyncApiPub, AsyncApiSub } from '@nmime/nestjs-asyncapi';

class CreateFelineDto {
  @ApiProperty()
  name: string;

  @ApiProperty()
  breed: string;
}

@Controller()
class FelineController {
  @AsyncApiPub({
    channel: 'feline/created',
    message: {
      payload: CreateFelineDto,
    },
  })
  async publishFelineCreated() {
    // Publish logic
  }

  @AsyncApiSub({
    channel: 'feline/create',
    message: {
      payload: CreateFelineDto,
    },
  })
  async onCreateFeline() {
    // Subscribe logic
  }
}

Templates

This package includes support for multiple AsyncAPI templates:

| Template | Description | |----------|-------------| | @asyncapi/html-template | Static HTML documentation (default) | | @asyncapi/nodejs-template | Node.js service using Hermes package | | @asyncapi/nodejs-ws-template | Node.js service with WebSockets support |

API Endpoints

When you call AsyncApiModule.setup('/async-api', app, document), the following endpoints are available:

| Endpoint | Description | |----------|-------------| | /async-api | HTML documentation | | /async-api-json | JSON specification | | /async-api-yaml | YAML specification |

Examples

For detailed examples, check out the sample application.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Credits

This project is a fork of the original nestjs-asyncapi by Ilya Moroz. Thank you for the excellent foundation!

License

MIT - see LICENSE for details.


If you find this library helpful, please consider giving it a star on GitHub.