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

@kdhelpbook/cf-registry

v0.0.3

Published

Central .khb docs registry: OIDC publish from GitHub Actions, Range streaming from R2, dynamic docsets.json.

Readme

@kdhelpbook/cf-registry

Reusable Cloudflare Worker for a self-hosted KD Help Book registry. It serves the web viewer, stores immutable .khb editions in R2, streams SQLite pages with HTTP Range requests, and accepts secretless publishes from explicitly allowed GitHub Actions repositories.

Most users should not clone this package source. Start from KDHelpBook/cf-registry-template, which creates a repository, Worker, and R2 bucket through Cloudflare:

Deploy to Cloudflare

Instance configuration

Each deployed instance has one khb-registry.yml:

# yaml-language-server: $schema=./node_modules/@kdhelpbook/cf-registry/schema/khb-registry.schema.json
schema: 1

site:
  order: [product-docs]
  folders: []
  config:
    externalSources: true
    pwa: false
    prefetch: false
    prefetchLocked: false

publishers:
  - repository: acme/product
    ref: refs/heads/main
    environment: null
    docsets: [product-docs]
    force: false

publishers is the authorization boundary. The Worker verifies GitHub's OIDC signature and claims, then derives every R2 key from the allowed docset id. There are no publishing tokens or shared Cloudflare credentials.

The OIDC audience is the registry URL origin. A publishing workflow only needs the public registry-url; there is no separate audience setting.

Package interface

import { createRegistry } from "@kdhelpbook/cf-registry";
import config from "../.khb-registry/config.json";

export default createRegistry(config);

The package exports createRegistry, RegistryConfig, the public registry types, and the editor schema at @kdhelpbook/cf-registry/schema. Its CLI provides:

khb-cf-registry validate khb-registry.yml
khb-cf-registry prepare khb-registry.yml

prepare validates the YAML, writes .khb-registry/config.json, and copies the version-matched viewer into .khb-registry/public for Wrangler Static Assets.

Publishing a docset

Consumer repositories call the reusable workflow:

jobs:
  publish:
    uses: KDHelpBook/monorepo/.github/workflows/publish-registry.yml@v1
    with:
      registry-url: https://your-registry.workers.dev
      source: docs
    permissions:
      contents: read
      id-token: write

The workflow compiles the source, reads metadata through khb inspect --json, mints an origin-scoped GitHub OIDC token, uploads and finalizes the edition, then verifies that the published file answers a Range: bytes=0-0 request with 206 Partial Content.

HTTP contract

| Route | Purpose | | --- | --- | | PUT /publish/<id>/<version>/<file> | Upload an authorized .khb/.khba | | POST /publish/<id>/<version> | Atomically update latest.json | | GET /d/<id>/<version\|latest>/<file> | Raw, Range-capable docset bytes | | GET /docsets.json | Dynamic viewer manifest derived from R2 | | GET /config.json | Viewer profile from the instance YAML |

Published version objects are immutable unless both the request and publisher permission explicitly allow force. The main object's R2 ETag becomes the optional manifest hash used by the viewer's HTTP and offline caches. Older pointers without hash remain compatible.

Package development

npm ci
npm run typecheck
npm test
npm run build

# Build the real viewer before checking the release package:
(cd ../viewer-ts && npm ci && npm run build)
npm run stage-viewer
npm pack

Worker tests use a local workerd R2 binding. Deployable instance configuration belongs in the template or an instance repository, never in this package.