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

@dunx/openapi

v3.1.0

Published

OpenAPI 3.1 documents for dunx controllers, generated from the schemas the routes already validate, with Swagger UI mounted over them

Readme

@dunx/openapi

An OpenAPI 3.1 document generated from the routes an app already has, with Swagger UI served from the same Bun.serve as everything else.

The difference from a reflection-based generator is what it reads. A route's schemas are the objects the request path validates against, and its metadata is what its guards enforce. Both are already on the route, so the document is not a second description that can drift from the first.

Install

bun add @dunx/openapi zod

zod is a peer dependency: route validation targets Standard Schema, so Valibot and ArkType work for validation, but hoisting a schema into components/schemas needs z.toJSONSchema, which is zod's. swagger-ui-dist is a regular dependency - nobody writes code against it, so nobody has a version opinion about it.

Usage

import { HttpFactory } from '@dunx/http';
import { OpenApiModule } from '@dunx/openapi';

const app = await HttpFactory.create(
  OpenApiModule.forRoot({
    title: 'Payments',
    version: '1.4.0',
    root: AppModule, // the graph to document, and the graph that gets imported
  }),
);
app.setGlobalPrefix('api');
await app.listen(3000);
// GET /api/docs          the explorer
// GET /api/openapi.json  the document

forRootAsync takes a factory that may inject, which is what an app needs to read its title off ConfigService or to contribute another library's schema.

What is here

The OpenAPI guide is canonical.

| Piece | What it does | | -------------------- | -------------------------------------------------------------------- | | OpenApiModule | Wraps the root it documents, mounts the page and the JSON | | @ApiDoc | Summary, description, tags and deprecation on a route or a class | | @ApiHidden | A real route kept out of the document. Lives in @dunx/http | | describeRoutes | The routes as data, constructing nothing | | generateDocument | The document from those routes | | betterAuthDocument | better-auth's own paths merged in. Lives in @dunx/auth | | bunx dunx-openapi | The document written to a file, with no container and no server |

Security comes from the same @Public() and @Roles() metadata the guards read at runtime, so there is no second annotation for the document to disagree with. A response schema is documentation only: the verb decorators hold the handler's return type to it at compile time instead of validating every response.

Notes

  • .meta({ id }) on a zod schema is what hoists it into components/schemas. Without an id it is inlined at every use site, and .strict() after .meta() discards the metadata, so put .meta() last.
  • Prose belongs in description. Swagger UI labels a schema by title, which @dunx/openapi fills with the component name.
  • The page embeds the document rather than fetching it, and loads its two assets same-origin. Nothing reaches a CDN.

License

MIT