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

@next-starters/skill-auth-org-onboarding

v1.0.0

Published

Scaffolds the auto-create-or-join-org-on-first-login flow that closes a real, independently-observed product gap: a brand-new signup with zero org membership hits a 403/no-access wall on every…

Readme

auth-org-onboarding

Scaffold the auto-create-or-join-org-on-first-login flow that closes the "new signup lands on a 403/no-access page" gap. Not part of the auth-email/auth-transactional-emails pattern — a separate, follow-up skill for the signup-adjacent gap those two don't cover.

Inputs

  • --org-resolution <live-db|jwt-embedded> — required, no default; the scaffolder rejects a missing or unrecognized value before writing any file. Picks which of two genuinely different, non-interchangeable architectures your repo needs:
    • live-db — org membership resolved via a fresh DB lookup on every request. No JWT claim, no session-refresh step.
    • jwt-embedded — org id/role minted into the JWT via a Supabase Auth Access Token Hook. Requires an explicit session-refresh step after onboarding.
    • Not sure which one your repo needs? Check for a custom_access_token_hook function registered in your Supabase project's Auth settings — if it exists, you're jwt-embedded; if org membership is just a normal table your API queries per request, you're live-db.
  • (jwt-embedded only) --users-table, --user-roles-table, --role-claim-key — table/column names substituted into access-token-hook.sql's tokens (defaults: users, user_roles, role).

What it does

  • Scaffolds exactly ONE variant's file set into <out>/<dir>/ via bin/add-auth-org-onboarding.mjs — write-by-default, --dry-run to preview, never overwrites, --org-resolution validated before any write.
  • Encodes the invariants that keep both variants correct (see SKILL.md): the required no-default flag, idempotent-check-first, advisory-lock race protection (grafted onto jwt-embedded as the one deliberate deviation from its ported source, which lacks it), an already-correct, faithfully-ported slug/name uniquification pattern for both (unit-tested directly), the Access Token Hook's deny-by-default fallback plus its RLS-policy and null-safe-claim-merge requirements, the two non-interchangeable session-refresh mechanisms, and live-db's no-refresh-needed self-heal.
  • Ships two complete reference route implementations (one per variant), a shared, unit-tested uniquification helper, one Access Token Hook SQL function, and two web-integration snippets — never mixed across variants in a single scaffold run.

Scaffold directly

# live-db variant
node bin/add-auth-org-onboarding.mjs --org-resolution live-db

# jwt-embedded variant, with real table/column names
node bin/add-auth-org-onboarding.mjs \
  --org-resolution jwt-embedded \
  --users-table app_users \
  --user-roles-table app_memberships \
  --role-claim-key workspace_role

Add --dry-run to preview, --dir <name> to change the output subdirectory (default org-onboarding), --out <dir> to target a repo other than the cwd. It refuses to overwrite existing files and exits non-zero (writing nothing) if --org-resolution is omitted or invalid.

After scaffolding:

  1. Port the copied reference route into your own API framework/route registration — keep the transaction/lock/uniquify logic close to verbatim, only the framework glue should change.
  2. (jwt-embedded only) Apply access-token-hook.sql as a migration AFTER your users/user_roles-equivalent tables exist, then register it as a Supabase Auth Access Token Hook in the project's Auth settings.
  3. Wire the matching web-integration reference into your authenticated shell — for jwt-embedded, pick the ONE session-refresh mechanism that matches your actual auth stack (direct Supabase vs. a framework like NextAuth in front of it); they are not interchangeable.

Install globally

Symlink into your global skills the same way as the other next-starters skills:

skills add [email protected]:catesandrew/next-starters.git \
  --skill skills/auth-org-onboarding -g

Layout

auth-org-onboarding/
  SKILL.md                                  the invariants + red flags + references
  metadata.json
  references/
    onboarding-live-db.reference.ts         live-db route (idempotent, advisory lock, uniquify)
    onboarding-jwt-embedded.reference.ts     jwt-embedded route (+ grafted advisory lock)
    org-uniquify.example.ts                 shared uniquify helper (unit-tested)
    access-token-hook.sql                    jwt-embedded only — Supabase Access Token Hook
    web-integration-live-db.reference.tsx    silent server-layout self-heal
    web-integration-jwt-embedded.reference.tsx  /welcome bootstrap + both refresh mechanisms

The scaffolder lives at next-starters/bin/add-auth-org-onboarding.mjs.