Launch sale: 20% off Fix Pack, Deep Audit and Monitor through Nov 30, 2026. The scan stays free. See sale prices →
Home / Guides / v0 / Next.js on Vercel security checklist

v0 and Next.js on Vercel: security checklist for AI-built apps

Apps generated by v0 (and many Cursor projects) are Next.js apps deployed to Vercel. Next.js gives you a real server, which is good news: secrets can stay server-side. The usual mistakes come from blurring that line.

Scan your live app free  Passive, no signup, never touches your database.

1. Audit every NEXT_PUBLIC_ variable

Next.js inlines NEXT_PUBLIC_-prefixed environment variables into the JavaScript sent to the browser at build time. Only public values (Supabase URL and anon key, Stripe publishable key) should use the prefix. Rename anything secret and read it only in server code.

2. Keep secrets in server code only

Use secret env vars only in route handlers, server actions and server components. If a file has 'use client' at the top, nothing in it is secret.

3. Authorize every server action and route handler

Server actions and API routes can be called directly, without going through your UI. Check the session and the user's permission inside each one, not just in the page that shows the button.

4. Mark env vars as Sensitive on Vercel

Vercel supports sensitive environment variables whose values can't be read back after creation. Use them for API keys and database URLs.

5. Add security headers in next.config.js

Add HSTS, X-Frame-Options, nosniff and Referrer-Policy via headers() (snippet in our HSTS guide). A strict CSP for Next.js needs nonces; follow the Next.js CSP guide.

6. Keep browser source maps off

Next.js doesn't publish browser source maps unless productionBrowserSourceMaps is set to true. Leave it off.

7. Protect preview deployments

Preview URLs often run against real data. Use Vercel Deployment Protection so previews need a Vercel login.

8. Scan production

Run Unspill on your production URL to catch leaked keys, open CORS on API routes and missing headers.

Fix guides for these issues

FAQ

Are NEXT_PUBLIC_ variables visible to users?

Yes. Next.js inlines them into the client JavaScript at build time, so anyone can read them.

Can people call my server actions directly?

Yes. Treat every server action and route handler like a public API endpoint: authenticate and authorize inside it.

Sources

Last checked against these sources on 2026-10-19. Platforms change; when in doubt, the official docs win.

Want help fixing this?

We're opening a done-for-you fix service, a deep audit (database rules, auth, user-to-user data access) and continuous monitoring. Join the waitlist to get first access. No spam, and we never share your email.