site-pin-gatelisted
Install: claude install-skill timerise-ai/site-pin-gate
# Site PIN gate: one PIN in front of the whole site
A PIN gate is the smallest possible access control: one shared secret, one
cookie, zero user accounts. Its whole value is that the app behind it never
knows it exists. The insight that shapes this module is that **everything
dangerous lives in the two places the gate touches the outside world**: the
return path it redirects to, and the cookie it hands out. Everything else is a
form and a cookie check.
Written by the engineer who has shipped this module. The earlier implementation
it was audited against was a temporary gate on a marketing site kept private
ahead of its launch. The facts and rules below are what the behaviour contract
and the handler suite verify; `references/provenance.md` has the record.
## When to use
A public-by-default Next.js site that must be hidden for a while: before
launch, during a client or investor review, on a staging domain. Everyone who
should see it can be told one PIN. The gate sits in `proxy.ts` (Next 16) or
`middleware.ts` (Next 13 to 15) and is removed by unsetting one env var.
## When NOT to use
| Instead of this | Use |
|---|---|
| Real users with real accounts | the host's auth (Clerk, NextAuth, Supabase Auth); a shared PIN cannot be revoked for one person |
| Per-route or per-tenant authorization | the host's authorization layer; this gate is all-or-nothing by path matcher |
| Only preview deployments, on Vercel, for team members | Vercel Deployment Protection, which needs no cod