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

@spawn-llc/auth

v0.4.0

Published

Spawn shared identity — headless auth for the whole Spawn suite. One WorkOS project (named "Spawn") backs every app; this is the only place that touches it. WorkOS is an invisible engine.

Readme

@spawn-llc/auth

Spawn shared identity. One WorkOS project (named "Spawn") backs auth for the entire Spawn suite — sign up for one Spawn product and you have an account on all of them. This package is the only place that touches WorkOS: apps consume a Spawn-shaped API (signIn, signUp, currentUser, …) and never see a WorkOS type. WorkOS is an invisible engine (password security, OAuth, sessions, MFA, SSO, compliance — free to 1M MAU); the UI is ours (rendered from @spawn-llc/design-system). See IDENTITY.md for the architecture.

Install

pnpm add @spawn-llc/auth

Env (from the WorkOS "Spawn" application): WORKOS_API_KEY, WORKOS_CLIENT_ID, WORKOS_COOKIE_PASSWORD (32+ chars), NEXT_PUBLIC_WORKOS_REDIRECT_URI (the app's /callback). Optional: ALLOWED_EMAIL_DOMAINS (comma-separated — restrict to e.g. spawnpartners.com for internal tools), AUTH_PUBLIC_PATHS.

Subpaths

  • @spawn-llc/auth — core, edge-safe: the IdentityGateway (orgs / members / roles / invites) + createIdentityGateway(), domain types (Role, Session, Member, Invite), and policy (isWorkosConfigured, isAllowedEmail, isPublicPath).
  • @spawn-llc/auth/config — the edge-safe policy alone (import from middleware; no SDK): the gate + isPublicPath / appPublicPaths and the shared hardened matcher (AUTH_MATCHER + its AuthMatcher literal type for pinning an app's inlined config.matcher).
  • @spawn-llc/auth/nextjs — the Next server surface: the session seam (currentUser / requireUser / requireApiUser / session / signOut / switchOrganization), authProxy() / safeAuthProxy(), handleCallback(), and the headless flows (signInWithPassword, signUp, verifyEmail, requestPasswordReset, resetPassword, startOAuth).

Wire an app (Next.js)

Next 16 calls this file proxy.ts (the old middleware.ts name is deprecated). Next requires config.matcher to be an inline string literal — a const/imported object fails the build — so paste the matcher and pin it to the shared AuthMatcher type, which fails tsc if it ever drifts:

// proxy.ts (refresh the session on every route; gate in-app via requireUser())
import { authProxy } from "@spawn-llc/auth/nextjs";
import type { AuthMatcher } from "@spawn-llc/auth/config";
export default authProxy();
export const config = {
  matcher: ["/((?!_next/static|_next/image|favicon\\.ico|(?!(?:.*/)?api/).*\\.(?:svg|png|jpg|jpeg|gif|webp|ico)$).*)"],
} satisfies { readonly matcher: readonly [AuthMatcher] };

Need to fail closed when the WORKOS_* secrets are absent (a preview deploy)? Keep the same proxy.ts but wrap with safeAuthProxy({ onUnconfigured }) as the default export:

// proxy.ts (fail closed when identity is unconfigured)
import { safeAuthProxy } from "@spawn-llc/auth/nextjs";
import { isPublicPath } from "@spawn-llc/auth/config";
import { NextResponse } from "next/server";
export default safeAuthProxy({
  onUnconfigured: (req) =>
    isPublicPath(req.nextUrl.pathname)
      ? NextResponse.next()
      : NextResponse.redirect(new URL("/login", req.url)),
});
// (same `config` block as above)
// app/(any)/api/route.ts — gate a route handler (401 JSON, never a redirect)
import { requireApiUser } from "@spawn-llc/auth/nextjs";
export async function GET() {
  const user = await requireApiUser();
  if (user instanceof Response) return user; // 401 when signed out
  // ...use `user`
}
// app/callback/route.ts (social login round-trip)
import { handleCallback } from "@spawn-llc/auth/nextjs";
export const GET = handleCallback({
  returnPathname: "/",
  // Optional but recommended. Without it a failed round-trip returns AuthKit's catch-all 500
  // ("Something went wrong / …contact your organization admin") and the real reason only reaches
  // the server log. Log `error`, render your own screen — never show its message verbatim.
  onError: async ({ error }) => { /* ... */ },
});
// app/login/page.tsx — render the DS <SignIn>, wire it to the headless flow
import { SignIn } from "@spawn-llc/design-system/components/ui/sign-in";
import { signInWithPassword, startOAuth } from "@spawn-llc/auth/nextjs";
// (call these from "use server" actions; redirect on { status: "ok" })

startOAuth sets the PKCE verifier cookie that handleCallback checks, so it must be called from somewhere cookies are writable — a server action or route handler, not a server component.

Releases are tag-triggered — see RELEASING.md.