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

@mqttkit/asyncapi

v0.2.2

Published

AsyncAPI 3.0 documentation generator and HTTP plugin for mqttkit.

Downloads

26

Readme

@mqttkit/asyncapi

English

mqttkit 的 AsyncAPI 3.0 文档生成器与 HTTP 插件。读取 router().topic(...) 元数据,通过 HTTP 提供 JSON、YAML 和可浏览的文档页面。

完整文档:https://mqttkit.keyp.dev/zh/

安装

bun add @mqttkit/core @mqttkit/asyncapi

使用

import { aedes } from '@mqttkit/aedes'
import { asyncapi } from '@mqttkit/asyncapi'
import { MqttApp, router } from '@mqttkit/core'

const app = new MqttApp()
  .use(aedes({ tcp: { port: 1883 } }))
  .use(
    router().topic('devices/:uid/events', {
      qos: 1,
      schema: { type: 'object', required: ['temperature'], properties: { temperature: { type: 'number' } } },
      async onMessage(ctx) { /* ... */ },
      meta: { summary: '设备遥测上报', tags: ['device'] },
    }),
  )
  .use(asyncapi({
    info: { title: 'mqttkit demo', version: '0.1.0' },
    servers: { tcp: { host: 'localhost:1883', protocol: 'mqtt' } },
    port: 9000,
  }))

await app.listen()
// http://localhost:9000/docs
// http://localhost:9000/asyncapi.json
// http://localhost:9000/asyncapi.yaml

功能

  • 自带 HTTP serverasyncapi({ port, host, prefix })),或通过 createAsyncApiHandlers(app, options) 拿到 paths / json() / yaml() / html() / invalidate(),自己接到 Elysia / Hono / Express / Fastify。
  • Schema 集成 —— 普通 JSON Schema 与原始 TypeBox 原样嵌入;带 ~jsonSchema 的 Standard Schema(例如 @mqttkit/zodjsonify)使用挂上的 JSON Schema;裸 Standard Schema 退化为 { description: 'Validated by <vendor>' }
  • 路由元数据 —— meta.summary / meta.description / meta.tags / meta.examples / meta.message.{name,contentType} 进入 AsyncAPI 文档。
  • HTTP 与 MQTT-over-WebSocket 共用端口 —— 给 aedesws: { server },与 Elysia / Hono 用同一个 http.Server

文档