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

@rapidoc/embed

v1.0.0

Published

The RapiDoc integration contract: renders the standard host page for <rapi-doc>, with conformance fixtures for integrations in any language

Readme

@rapidoc/embed

The shared core of RapiDoc integrations: plugins and middleware that add a <rapi-doc> API reference to a web framework, a documentation site or another tool. It renders the standard host page, lists the routes to serve and finds the files of the installed rapidoc build, so every integration takes the same options and sends the same HTML.

If you only want <rapi-doc> on a page, you don't need this package: see the Quickstart.

npm install @rapidoc/embed
import { embedRoutes, renderHostPage, renderOAuthReceiverPage } from "@rapidoc/embed";
import { readAsset } from "@rapidoc/embed/node";

const options = { uiPath: "/docs", specUrl: "/openapi.json", options: { renderStyle: "focused" } };

for (const route of embedRoutes(options)) {
  // route.kind: "page" → renderHostPage(options)
  //             "oauth-receiver" → renderOAuthReceiverPage(options)
  //             "file" → readAsset(route.file)
}

For a server framework there is a shorter way: createResponder matches the request and produces the response, so the integration only passes values in and out.

import { createResponder } from "@rapidoc/embed";
import { readAsset } from "@rapidoc/embed/node";

const respond = createResponder(options, { readAsset });
const response = await respond({ method, path, mount, ifNoneMatch }); // null: not for RapiDoc
// otherwise { status, headers, body }

examples/node-server.js is a complete integration on node:http.

Options

| Option | Default | | | :-------------- | :-------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | uiPath | /docs | URL path of the reference page. An integration takes it as the path within the app or mount it is registered in; the render functions write it into the page, so they take the public path (below) | | specUrl | | URL of the OpenAPI document, which the browser fetches when the page opens | | spec | | The OpenAPI document itself (object or JSON text), written into the page so the browser makes no request for it. With both, spec is shown and specUrl is the download link | | title | API Reference | Page title | | assets | "bundled" | "bundled" (you serve the bundle), "cdn" (jsDelivr, pinned version with SRI hash) or { scriptUrl, integrity? } | | options | | Attributes of <rapi-doc>, in kebab-case or camelCase | | head, css | | Markup and CSS added to the page as given | | lang, nonce | en, none | Page language; Content-Security-Policy nonce |

An option that is null or an empty string counts as absent, so its default applies.

Paths under a mount

uiPath is what the integration's user writes: the path within the app, router or plugin the integration is registered in. renderHostPage, renderOAuthReceiverPage and embedUrls write the path they are given into the page, so they need the public path, the one the browser requests. createResponder joins the two: pass the prefix the framework took off the request as mount, and the pages get mount + uiPath.

const respond = createResponder({ uiPath: "/docs" }, { readAsset });
await respond({ method, path: "/docs", mount: "/api" }); // the page's script is /api/docs/rapidoc-min.js

Behind a proxy that strips a prefix the app never sees, set the option publicUiPath to the page's whole public path.

Caching

createResponder sends the pages and the bundle with cache-control: no-cache, and the bundle with an ETag (its SRI hash). The browser asks on every visit and gets a 304 until a deploy brings another RapiDoc build, so nobody keeps an old bundle next to a new page. Every response has x-content-type-options: nosniff.

Versions

Each release serves the current major of RapiDoc (rapidocManifest.version). A new RapiDoc major arrives as a minor release of this package and of the integrations built on it.

The contract has a version of its own (CONTRACT_VERSION), which is not this package's version: see the contract.

Entry points

  • @rapidoc/embed: the render functions, using the manifest of the rapidoc version this package depends on (rapidocManifest).
  • @rapidoc/embed/core: the same functions with no imports, for runtimes without JSON imports. Pass manifest yourself for assets: "cdn".
  • @rapidoc/embed/node: rapidocDistDir(), assetPath(file), readAsset(file).
  • @rapidoc/embed/sidebar: methodLabel, operationClass, sidebarCss, for docs-site integrations that show operations in their own sidebar. No JSON import, so require() can load it.
  • @rapidoc/embed/conformance/: the contract and its fixtures, for integrations written in other languages.

Node.js 22.12 or later. MIT.


Part of the RapiDoc family of open-source tools for OpenAPI and Arazzo: RapiDoc (<rapi-doc>), RapiFlow, RapiDoc Portal, RapiMock, RapiPdf, the RapiDoc CLI and integrations for Express, Fastify, Hono, FastAPI, ASP.NET Core, Go, Starlight, VitePress and Docusaurus.