Guides / v0
Is v0 secure? Checklist for v0 and Vercel apps
v0 generates Next.js apps that deploy to Vercel in a click. Here's what to check so your v0 app doesn't leak keys, data or admin access.
v0 by Vercel generates Next.js code, and most v0 apps deploy straight to Vercel. That's a solid foundation: Next.js can keep secrets on the server, and Vercel serves everything over HTTPS. But the framework only protects you if the generated code uses it correctly. Here's what to check.
1. Environment variables: NEXT_PUBLIC_ means public
In Next.js, any environment variable whose name starts with NEXT_PUBLIC_ is built into the JavaScript sent to every visitor. Everything else stays on the server.
- Fine with
NEXT_PUBLIC_: your site URL, a Supabase URL and anon key, a Stripe *publishable* key. - Never with
NEXT_PUBLIC_: OpenAI or Anthropic keys, Stripe *secret* keys, database passwords, the Supabase service_role key, email API keys.
If a secret has the prefix, rename the variable in Vercel, move the code that uses it into a Server Component, Route Handler or Server Action, and rotate the key, because it has already been public.
2. Server Actions and Route Handlers check who's calling
Server Actions and API routes are public endpoints, even if no button in your UI calls them. Each one that reads or changes data must check:
- Is the visitor logged in?
- Is this visitor allowed to touch this record (their own order, not someone else's)?
AI-generated code often checks the first and forgets the second.
3. Database rules
If your v0 app uses Supabase or Firebase from the browser, the database rules are your real security. See the Supabase RLS checklist and the Firebase rules checklist.
4. Security headers in next.config or vercel.json
Next.js doesn't add security headers by default. Add them once for every route, either with headers() in next.config.js or in vercel.json:
// next.config.js
module.exports = {
async headers() {
return [{
source: '/(.*)',
headers: [
{ key: 'Strict-Transport-Security', value: 'max-age=31536000; includeSubDomains' },
{ key: 'X-Content-Type-Options', value: 'nosniff' },
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
{ key: 'X-Frame-Options', value: 'SAMEORIGIN' },
],
}]
},
}
Add a Content-Security-Policy once you know which domains your app loads scripts from. More options: security headers on Vercel, Netlify and Cloudflare.
5. Browser source maps
Check that productionBrowserSourceMaps isn't set to true in next.config.js, unless you mean to publish your source code.
6. Preview deployments
Vercel creates a public preview URL for each branch. If previews connect to your production database or show unfinished admin features, protect them (Vercel Deployment Protection) or point them at a test database.
7. AI search and SEO
If you want ChatGPT, Claude and Perplexity to cite your site, make sure robots.txt doesn't block their crawlers, and give each page a title and meta description.
Check it automatically
Scanora checks your live v0 app for keys leaked into the browser bundle, missing headers, exposed source maps, SSL, vulnerable libraries, speed and AI-search readiness in one scan, with the fix for each issue.
Check your site in one minute
Scanora runs these checks for you: leaked keys, open files, headers, SSL, speed and AI-search readiness. Free, no signup.