implementing-saaskit-nextjs
Installation
SKILL.md
Scalekit Auth — Next.js App Router
Reference repo: scalekit-inc/scalekit-nextjs-auth-example
Guardrails
- MUST validate auth in
middleware.tsfor protected paths AND re-check withisAuthenticated()in Server Components; MUST NOT rely onmiddleware.tsas the only auth check. - MUST store session tokens in the
scalekit_sessionHttpOnly cookie; MUST NOT exposeaccess_token/refresh_tokento client-side JavaScript. - MUST set
sameSite: 'lax'onscalekit_sessionandoauth_statecookies; MUST NOT use'strict'— it drops the cookie on the OAuth callback redirect. - MUST validate the
nextredirect param as a relative path server-side; MUST NOT redirect to an arbitrary URL (open redirect).