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

@blackbelt-technology/pi-dashboard-app-kit

v0.11.0

Published

Client plumbing for a standalone SPA on its own origin that talks to a pi-dashboard host: runtime endpoint config, OIDC PKCE sign-in, bearer transport, single-use WebSocket tickets and a reconnecting socket.

Readme

@blackbelt-technology/pi-dashboard-app-kit

Client plumbing for a standalone SPA on its own origin (e.g. team.example.com) that talks to a pi-dashboard host (e.g. dash.example.com):

  • runtime dashboard endpoint (/config.json) — one static build, any host
  • identity modes from the host's login descriptor (oidc / none, fail-closed otherwise)
  • OIDC Authorization Code + PKCE public-client config (oidc-client-ts, react-oidc-context)
  • bearer-carrying fetch that never sends cookies and never leaks the bearer to another origin
  • single-use browser-scope WebSocket tickets — the bearer never appears in a URL
  • a reconnecting socket that mints a fresh ticket per attempt

Two entries:

| Entry | Contents | Imports React? | |---|---|---| | @blackbelt-technology/pi-dashboard-app-kit | loadAppConfig, configureDashboard, apiUrl, wsUrl, initIdentity, fetchLoginDescriptor, authedFetch, mintWsTicket, ticketSocketUrl, connectWithReconnect, identity state | no | | @blackbelt-technology/pi-dashboard-app-kit/react | buildOidcConfig, OidcIdentityBridge, IdentityProvider, useIdentity, useOptionalIdentity, operatorFromUser | yes (peer) |

Install

npm install @blackbelt-technology/pi-dashboard-app-kit react

Configure

Serve a config.json next to index.html:

{ "dashboardUrl": "https://dash.example.com" }

An absent or empty dashboardUrl means "the page's own origin". The file must be a JSON object: a 404, an HTML body (SPA fallback), a network error or a non-object fails with AppKitError code app_config_unavailable. Pass { allowMissing: true } behind a dev proxy to treat a 404 / HTML body as same origin. A non-http(s) or userinfo-bearing dashboardUrl fails with invalid_dashboard_url.

Boot

import { AuthProvider } from "react-oidc-context";
import { initIdentity, loadAppConfig, connectWithReconnect, ticketSocketUrl } from "@blackbelt-technology/pi-dashboard-app-kit";
import { OidcIdentityBridge, buildOidcConfig } from "@blackbelt-technology/pi-dashboard-app-kit/react";

await loadAppConfig();
const login = await initIdentity(); // sets the identity mode

const app =
  login.mode === "oidc" ? (
    <AuthProvider {...buildOidcConfig(login.descriptor, { redirectUri: `${location.origin}/auth/callback` })}>
      <OidcIdentityBridge providerLabel={login.descriptor.label}>
        <App />
      </OidcIdentityBridge>
    </AuthProvider>
  ) : login.mode === "none" ? (
    <OidcIdentityBridge>
      <App />
    </OidcIdentityBridge>
  ) : (
    <SignInUnavailable />
  );

// Sockets: a fresh single-use ticket per (re)connect.
connectWithReconnect({
  url: "/ws",
  resolveUrl: () => ticketSocketUrl("/ws"),
  onStatus, onOpen, onMessage,
});

Identity modes:

| Mode | When | Requests | |---|---|---| | unknown | descriptor not read yet | none (NoCredentialError) | | oidc | descriptor active with issuer + clientId | Authorization: Bearer to the dashboard origin only; none without a token | | none | descriptor {active:false} | plain; a dashboard 401/403 throws NotAdmittedError (not_admitted) | | unavailable | descriptor read failed / malformed / active without issuer+clientId | none — never falls back to none |

Roles are an app concern: pass resolveRole={(op) => …} to OidcIdentityBridge.

Host prerequisites

The kit changes nothing on the host; the deployment must provide:

  • CORS: the app origin in the dashboard's cors.allowedOrigins (REST and WS).
  • Host admission: the dashboard host in allowedHosts / publicBaseUrls.
  • HTTPS for the app and the dashboard: PKCE needs crypto.subtle (secure context).
  • Identity plugin publishing the browser login config (GET /api/identity/login-config returns { active: true, issuer, clientId }).
  • OIDC client: public (no secret), standard flow + PKCE, the exact redirect URI registered, silent renew allowed, and an audience mapper so access tokens carry the audience the host's resolver requires (the Keycloak resolver checks audience exactly).
  • none mode only from loopback or a trusted network: the host admits a credential-less caller only there.

Security notes

  • The access token is held in sessionStorage (per issuer + client), readable by script on the app origin. Ship a strict Content-Security-Policy (no inline script, connect-src limited to the dashboard and the issuer).
  • Requests always use credentials: "omit"; the bearer and WS tickets are attached only to URLs on the dashboard origin.

Provenance

Ported and generalised from InvoiceBot's finance SPA (BlackBeltTechnology/invoice-bot-dashboard, src/auth/*, src/reconnecting-socket.ts); signatures stay compatible with its call sites. See OpenSpec change extract-standalone-app-kit.