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

@ublitzjs/openapi

v0.0.4

Published

![ublitzjs](https://github.com/ublitzjs/core/blob/main/logo.png)

Readme

ublitzjs

@ublitzjs/openapi package for typed documentation

Supported in - @ublitzjs/core, @ublitzjs/router

serverExtension

This function lets you decorate "server" object, given by "extendApp" from "core" package, which provide you with easy control over your docs

import { serverExtension } from "@ublitz.js/openapi";
import { extendApp } from "@ublitzjs/core";
import { App } from "uWebSockets.js";
var server = extendApp(
  App(),
  serverExtension({
    info: { title: "Your server", version: "0.1.0" },
    openapi: "3.1.0",
    /**
     * and components
     * and externalDocs
     * and security
     * and servers
     * and tags
     * and webhooks
     */
  })
);
/**
 * then you define some schemas and routes
 * Examples are below in readme.
 * So several routes later:
 */
var BUILD_OPENAPI_TO_JSON = false as boolean;

if (BUILD_OPENAPI_TO_JSON === true)
  server.buildOpenApi(
    /*path*/ "openapi.json",
    /*exit from node.js (better for performance, if app will be compiled afterwards without these schemas)*/ true
  );
await server.serveOpenApi(
  /*url (but it is fully working ONLY by http://localhost:port/docs/ with last slash, sorry)*/ "/docs",
  {
    // whether to use buildOpenApi before starting server. Mostly useless. But if development - ok
    build: false,
    /**same as in @ublitzjs/static package */
    clearMimes: true,
    path: "openapi.json",
    /**OPTIONAL, but if you moved UI somewhere - use this */
    uiPath: "node_modules/@ublitzjs/openapi/ui",
  }
);
server.listen(9001, () => {});

routeAddOns, methodAddOns, routePlugin, RouterPlugin

First two - typescript interfaces, second too - function for registrating openapi.

server.route from @ublitzjs/core

import { routePlugin } from "@ublitz.js/openapi";
import { DeclarativeResponse, type onlyHttpMethods } from "@ublitzjs/core";

server.route<onlyHttpMethods, methodAddOns>(
  {
    method: "get",
    controller: new DeclarativeResponse()
      .writeHeaders({
        "Content-Type": "text/plain",
        "Last-Modified": new Date().toUTCString(),
      })
      .end("hello"),
    path: "/",
    // here are used comments, designated for clearing unwanted code by @ublitzjs/dev-comments
    /*_START_DEV_*/ openapi: {
      description: "hello",
      deprecated: false,
      produces: ["text/plain"],
      responses: {
        200: {
          description: "usual response",
          headers: {
            "Last-Modified": {
              description: "for caching",
              schema: { type: "string" },
            },
          },
          content: {
            "text/plain": { schema: { type: "string" } },
          },
        },
      },
    },
    /*_END_DEV_*/
  },
  // this function uses your openapi
  // If you build your project with @ublitzjs/dev-comments, then you should mark this plugin
  /*_START_DEV_*/ [routePlugin] /*_END_DEV_*/
);

ExtendedRouter with extPaths from @ublitzjs/router - go here

Optimizing performance using @ublitzjs/dev-comments

it is a good practise to clean openapi from project using @ublitzjs/dev-comments after building it into openapi.json file. So you might want to create a script, which

  1. runs your app for the first time with a specific setting for calling buildOpenApi("openapi.json", true) and quits from node.js
  2. then runs minifyFile OR minifyFolder (depending on your project size) for removing unwanted openapi docs
  3. runs esbuild for bundling your project into single file FROM newly created direcory or file by dev-comments
  4. removes directory or file, created by dev-comments This script will help you free several (or LOTS OF) kilobytes of ram, by ensuring that openapi.json is always static and doesn't need to be loaded