← ClaudeAtlas

site-pin-gatelisted

Put a shared-PIN gate in front of an entire Next.js site from the proxy/middleware layer: one env var arms it, a self-contained unlock page sets an HMAC-derived HttpOnly cookie, and the app behind it stays untouched. Use when: (1) a pre-launch, staging, client-preview or investor-preview site must be hidden from the public and from crawlers without adding user accounts, (2) an existing PIN or password gate in middleware.ts or proxy.ts needs auditing, (3) the user mentions: site PIN, password-protect the site, access code, pre-launch gate, coming-soon lock, staging password, SITE_PIN, "hide the site behind a PIN", "lock the preview deployment", "temporary password page". Carries the return path resolved against the request origin, the 303 unlock redirect, the cookie token keyed by a server-side secret, constant-time comparisons, an attempt budget answering 429 with Retry-After, and the suite that holds them. Next.js App Router, proxy.ts or middleware.ts; the attempt store is a seam, so a shared store can repla
timerise-ai/site-pin-gate · ★ 0 · AI & Automation · score 67
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