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

@ts-pf/openapi

v0.1.4

Published

Opt-in OpenAPI 3.1 document from catalog() (POST JSON RPC)

Readme

@ts-pf/openapi

Project a @ts-pf/docs catalog() into an OpenAPI 3.1 document that describes the existing POST JSON RPC.

Agent skill: skills/ts-pf-openapi/. Sync with npx skills experimental_sync -y.

The catalog is the portable spec. This package is the polyglot export. For a TypeScript client in another repo, use @ts-pf/codegen (emitcreateClient<Contract>), not OpenAPI-TS.

This package does not serve HTTP, embed Scalar/Swagger, invent REST paths, or change FetchHandler. Path params, GET/PUT, and flattened bodies are out.

import { catalog, docs } from '@ts-pf/docs'
import { openapi } from '@ts-pf/openapi'

procedure.meta(docs({ description: 'Find a planet by id' }))

const spec = openapi(catalog(contract, { prefix: '/rpc' }), {
  info: { title: 'Planet API', version: '1.0.0' },
  servers: [{ url: 'https://api.example.com' }],
})

Every path is POST {prefix}/{router keys} with body { "input": … } and { "ok": true, "output": … } / { "ok": false, "error": { "code", "message", "data?" } }. The protocol header comes from catalog.protocol.

Serve the JSON in userland, outside the RPC prefix (GET /rpc/... is not a spec):

if (url.pathname === '/openapi.json') {
  return Response.json(spec)
}
const result = await handler.handle(req, { prefix: '/rpc', context })

Point Scalar or Swagger UI at that URL. Do not put those UIs in this package.

openapi() is a dumb projection of the catalog. Filter/hide procedures with catalog(..., { filter }). Mutate the returned object for security, extra components, or operation overrides.

Stream procedures advertise application/jsonl (item schema from the catalog). Pass sse: true to also list text/event-stream. Pass multipart: true to also list multipart/form-data on unary requests. Default is JSON (and JSONL for streams).

$ref values inside converted JSON Schema (#/$defs/…) are rewritten to the component they live under. $anchor / $dynamicAnchor across schemas are not rewritten.

Message transports (WebSocket, stdio, MessagePort) are not HTTP and are not in this document.

Typed split-repo clients: @ts-pf/codegen.