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

@substrat-run/vertical-auth

v0.8.0

Published

Pluggable auth for Substrat verticals — the AuthProvider contract, an OIDC provider (Supabase/Auth0/AuthHero/Keycloak), a full relying-party login flow, and a per-tenant identity Durable Object (Better Auth + sub→principal directory). Workers-targeted; th

Readme

@substrat-run/vertical-auth

Pluggable auth for Substrat verticals — one interface the app codes against, and three interchangeable implementations behind it.

A vertical scaffolded with create-substrat answers /api/* with 401 until real auth is wired into authenticatedPrincipal. This is the package that fills that seam.

Full documentation: https://substrat.net/reference/vertical-auth

The contract

AuthProvider is the only identity type the application depends on. It proves who a caller is and nothing more — authorization stays in the kernel: roles, grants, and tenancy are never this package's concern.

import type { AuthProvider, AuthSubject } from '@substrat-run/vertical-auth';

interface AuthProvider {
  handle(request: Request): Promise<Response>;     // /api/auth/* — login, logout, callbacks
  resolve(headers: Headers): Promise<AuthSubject | null>; // request → verified subject
}

AuthSubject carries the provider's stable sub plus email/name. Mapping that sub to a Substrat PrincipalId is a separate, per-scope concern — the identity directory below — so swapping the implementation never touches the app.

Three implementations

  • oidcAuthProvider — token-based. The SPA logs in at the issuer and presents a JWT; this verifies it against the issuer's JWKS. Covers Supabase, Auth0, AuthHero, Keycloak, Zitadel identically. Discovery-driven, so the issuer URL is the only wired-in value.
  • oidcRpAuthProvider — the full relying-party browser flow: server-side Authorization-Code + PKCE, session cookie, returnTo handling. Built on @substrat-run/oidc-rp, the same verifier the platform's own surfaces use.
  • doAuthProvider — Better Auth running inside the per-tenant IdentityDO, for verticals that own their credentials rather than delegating to an issuer.

The identity directory

IdentityDO is one Durable Object per tenant, running its own SQLite. A tenant's users, sessions, and credentials live in that tenant's DO — there is no shared AUTH_DB for a bug to leak across tenants. It holds the provider-agnostic sub → principal mapping, so setPendingOwner / resolvePrincipal are used under every provider, including the two OIDC ones where Better Auth stays dormant.

That mapping is what makes first-run ownership work: the first authenticated subject claims the pending owner slot, and access is invite-only afterwards.

Also exported: resolveCookieDomain, which refuses to set a session cookie on a public suffix (guarded by @substrat-run/psl).

Runtime

Workers-targeted: jose + Web Crypto, no node:*. IdentityDO extends the cloudflare:workers DurableObject base, and the vertical's worker bundles this package and exports the DO class for wrangler.

Related packages

Status

Pre-release (0.x): interfaces change without notice until the first vertical ships.