v0 and Vercel: What to Check Before You Deploy
v0 generates the interface, Vercel hosts it. Before you deploy, check environment variables, public prefixes, preview deployments, headers and the backend your code talks to.
๐ก The short version: a v0 and Vercel app is usually a Next.js project, so the security work is the same as for any Next.js app. Keep secrets on the server, be careful with
NEXT_PUBLIC_variables, set security headers and make sure the backend behind it enforces its own rules.
v0 gives you a polished interface in minutes and Vercel puts it on the internet just as fast. Lovely. Before you hit deploy, spend ten minutes on these nine things. They're the ones that bite later. ๐
โ Nine checks
- Know what
NEXT_PUBLIC_means. Next.js only exposes a variable to the browser if it has that prefix, and it then inlines the value into the JavaScript at build time. A secret behind that prefix is public. Publishable keys only. - Keep secrets in server-only code. Variables without the prefix are available only on the server. Read them in route handlers, server actions or server components, and never import one into a client component.
- Separate your environments. Vercel keeps Preview and Production variables apart. Give previews their own keys, so a leaked preview link can't touch real data.
- Look at your preview deployments. Every branch and pull request gets its own URL. New Vercel projects start with Vercel Authentication switched on for previews, but check that setting for your project, and check which data those deployments connect to.
- Set security headers. In
next.configor a proxy, send a Content-Security-Policy,Strict-Transport-Security,X-Content-Type-Options: nosniffand a Referrer-Policy. A policy that only allows scripts from your own pages blocks a large family of injection attacks. - Check every API route. Each route handler needs its own sign-in and permission check. Being "hidden" in the interface protects nothing.
- Enforce rules at the data layer. With Supabase, turn on row level security. With Firebase, write Security Rules. The frontend can't be the only thing saying no.
- Limit anything that costs money ๐ธ. AI routes and email routes need sign-in and rate limits.
- Look for source maps and stray files. Production source maps publish your original code. Request
/.envand/.git/configand expect "not found".
๐ See your real headers in one line
curl -sI https://your-app.vercel.app | grep -i -E "content-security|strict-transport|x-content-type|referrer-policy"
If nothing prints, none of those four headers are set.
๐ Why your live address is the one to check
The address your users visit is what a stranger can test. A scan reads that address: the certificate, headers, exposed files and keys left in public JavaScript, plus the DNS records for the email you send. Not sure which keys are fine in the browser? This guide sorts them out.
๐ Before you share the link, run a free scan on your live address.