nextjs + supabase

Next.js + Supabase production launch checklist

Next.js + Supabase is the most common stack we scan, and the same handful of issues come up repeatedly. This checklist focuses on those repeat offenders and the framework-specific fixes (App Router middleware, server actions, env var conventions).

Paste this into Next.js

One prompt that runs the entire checklist as a code review pass.

Audit my Next.js + Supabase app: enable RLS with explicit policies on every public table, move every server-only secret out of NEXT_PUBLIC_, confirm the service_role client is imported only in route handlers / server actions / cron, ensure .env is not deployed, add middleware that runs supabase.auth.getUser() before protected pages, set CSP via middleware with a per-request nonce (drop unsafe-inline), set HSTS in next.config.js headers, replace X-Frame-Options with frame-ancestors in CSP, allowlist CORS origins on /api/* routes (or remove CORS for same-origin only), set Secure+HttpOnly+SameSite=Lax on auth cookies, add @upstash/ratelimit on /api/* and Server Actions, set poweredByHeader: false, ensure TLS validity and no mixed content, and publish SPF + DMARC for the sending domain.

FAQ

Frequently asked questions

Should middleware or page-level checks enforce auth?
Both. Middleware blocks anonymous traffic from reaching protected routes; the page-level check confirms the user identity matches the resource (defense in depth). Skipping middleware risks slow page loads for unauthorized users; skipping page-level risks IDOR attacks.
Why drop unsafe-inline from CSP?
unsafe-inline allows any inline <script> to run, defeating the main XSS protection CSP provides. Per-request nonce + strict-dynamic gives you the same flexibility for legitimate scripts (analytics, tag managers) without the XSS hole.

Run the scan to confirm each check

60 seconds. Free. No account required.