ContactBook a call

Security

Taking a v0 app to production: security checks

Before a v0 app gets real users: auth inside every server action, NEXT_PUBLIC_ variables, Supabase rules, preview deployments and GitHub branch checks.

Cover for “Taking a v0 app to production: security checks”, with the line: Every server action is a public endpoint, so each one has to check who is asking.
Every server action is a public endpoint, so each one has to check who is asking. Image: SBD.

A v0 app is a Next.js project on Vercel, so it is as safe as its server code and the rules on its database. The two gaps we find most are server actions or API routes that change data without checking who is signed in, and secret keys placed in variables that start with NEXT_PUBLIC_, which Next.js copies into the code every visitor downloads. If v0 connected Supabase, the row-level security on each table decides what the public key can read. You can check all three yourself in under an hour, before real customers arrive.

This post is for founders and product leads who built an app in v0 and want to put real users on it. It explains where a v0 app tends to leak, what v0 and Vercel already handle, the checks to run by hand, and when to bring in help.

The short answer

Open the project's environment variables and make sure nothing secret has a NEXT_PUBLIC_ name. Then search the code for every server action and API route that writes data, and confirm each one reads the signed-in user and checks their permission before doing anything. If the app uses Supabase, try to read each table from a private browser window with the public key. You should get nothing back from tables that hold private data.

How a v0 app is put together

v0 writes a Next.js app from your prompts and runs a preview of it as you work. When you publish, it deploys to Vercel. If you connect GitHub, v0 can create a private repository, and from then on the repository holds the code. Each chat works on its own branch with its own preview deployment, and publishing merges a pull request into the base branch, according to v0’s GitHub documentation.

For data, v0 offers one-click integrations with Supabase, Neon, Upstash and Vercel Blob. Supabase is the common choice because it brings sign-in as well as a database. That matters for security, because a Supabase app often reads the database straight from the browser, and then the table rules do the work a server would otherwise do.

So there are three places to look: the server code Next.js runs on Vercel, the environment variables, and the database rules.

Server actions are public endpoints

Next.js server actions look like ordinary functions in the code, and v0 uses them a lot for forms and buttons that save data. Each one is reachable over HTTP by anyone who knows how to send the request. The Next.js documentation on data security says to treat them like public API endpoints and to check authentication and authorisation inside each action.

The failure we see is a page that hides a button from users who are not admins, while the action behind the button does no check of its own. Someone who copies the request from their browser’s network tab can call it anyway. The same applies to route handlers under app/api.

Middleware is not a substitute. In March 2025, CVE-2025-29927 showed that Next.js middleware could be skipped by sending one crafted header, on self-hosted apps running versions before 12.3.5, 13.5.9, 14.2.25 and 15.2.3. Vercel said apps hosted on its platform were not affected. The lesson holds anyway: put the permission check next to the data, in the action or route itself.

Environment variables and NEXTPUBLIC

v0 stores environment variables encrypted on Vercel, and you choose whether each one applies to Production, Preview or Development. v0’s preview panel only sees Development variables, which catches people out when a feature works in production and fails in the preview, or the other way round.

The rule that matters is the prefix. Next.js copies any variable whose name starts with NEXTPUBLIC into the JavaScript bundle at build time. v0’s own security page says variables without the prefix stay on the server, that v0 warns about risky NEXTPUBLIC use, and that you should rotate keys and keep separate keys for development and production. A Stripe secret key, an OpenAI key or a Supabase secret key with that prefix is readable by anyone who opens developer tools. We cover how to search for these in Exposed API keys in AI-built apps.

The Supabase public key is different. The publishable key, or the older anon key, is meant to be in the browser, and Supabase says so. It is safe only when row-level security is on.

The database rules behind the app

If your v0 app talks to Supabase from the browser, the same failure that hit Lovable apps applies. We wrote about it in Your Lovable app is probably public, and the fuller explanation of policies is in Supabase row-level security for AI-built apps. In short, a table without RLS can be read and written by anyone holding the public key, and a policy whose condition is true has the same effect.

If v0 connected Neon or another Postgres database through server code only, there is no public key to worry about, and the server action checks above carry the whole load.

The checks to run yourself

Set aside an hour. You need access to the v0 project, the Vercel project settings and, if you use one, the Supabase dashboard.

  1. List the environment variables. In v0, open the project menu, then Settings, then Environment Variables, or open the same list in Vercel. Any name starting with NEXTPUBLIC is public. Only the Supabase URL, the publishable or anon key and similar public identifiers belong there.
  2. Search the build. Run npm run build locally and search .next/static for sk_, sk-, sb_secret_, service_role and the first few characters of each key you use. Anything you find has shipped to browsers. Move the call to a server action or route and rotate the key with the provider.
  3. Find every write. Search the code for "use server" and for files under app/api. For each function that creates, changes or deletes data, check that it reads the current user from the session and refuses the request if that user should not do this.
  4. Call one action logged out. In a private window, open the network tab, trigger a save while signed in as a test user in another window, then replay the request without the session cookie. It should fail.
  5. Test the database logged out. If you use Supabase, copy the project URL and publishable key from the page source and query each private table from the browser console. You should get an empty list. Then run Supabase’s Security Advisor and fix every error.
  6. Check preview deployments. Every branch gets a preview URL. If previews point at the production database, anyone with a preview link is working on live data. Give Preview its own keys and, ideally, its own database.
  7. Protect the production branch. In GitHub, turn on branch protection for the branch that deploys to production, with at least one required review. v0’s documentation says it leaves the pull request open when protections block the merge, so a person signs off before code goes live.

What the checks do not cover

These steps catch the problems that expose the most data for the least effort. They do not tell you whether sign-up can be abused, whether forms and AI features have rate limits, whether the app logs errors anywhere a person reads, or whether you have backups you have tried restoring. They also cannot judge business rules: whether a discount, a refund or a role change can be triggered by the wrong person depends on how your business works.

When to get a second pair of eyes

If the app holds customer data, takes payments, or you are about to show it to investors or a first large customer, an outside review is cheaper than an incident. Our vibe-coded app audit starts at $500, and you get a written report within a week, ranked by risk, covering database rules, keys, auth, server actions, rate limits and backups. If the fixes are more than you want to take on, Harden starts at $1,000 and we make the changes, and Rebuild starts at $8,000 for apps that need a proper server layer.

The same review applies to apps from other builders. See Is my Bolt.new app secure?, Replit app to production and Cursor app security review. For how we work with v0 projects, see the v0 integration page, or go straight to the audit page.

Questions we get asked

Does Vercel’s hosting make my v0 app secure?

It secures the hosting: isolated functions, encrypted environment variables and HTTPS. It cannot know which of your users may see which records, and that is where most problems in generated apps sit.

Is the Supabase key in my page source a leak?

The publishable or anon key is designed to be public. It becomes a problem when a table has RLS off or a policy that lets everyone in. The secret or service role key bypasses RLS and must stay on the server.

v0 warned me about a NEXTPUBLIC variable. What should I do?

Rename it without the prefix, move the code that uses it into a server action or route, and rotate the key, because it has already been in a public bundle.

Should I move off v0?

Usually not. The code is a standard Next.js project in your own repository, so developers can fix it in place. A rebuild makes sense when the data model is wrong at its core or business logic sits in the browser.

Sources and further reading

  • v0
  • Vercel
  • Supabase
  • Vibe coding
  • Security
  • MVP audit

Keep reading

Cover for “Is my Bolt.new app secure? The checks to run”, with the line: The database is reachable from the browser, so the rules on each table decide who sees what.

Security

Is my Bolt.new app secure? The checks to run

How to check a Bolt.new app before launch: row-level security on Supabase or Bolt Database, keys in the bundle, Netlify secrets and the Security page.

Cover for “Supabase row-level security for AI-built apps”, with the line: The public key reaches every table, so each table needs a rule that says whose rows are whose.

Security

Supabase row-level security for AI-built apps

How row-level security protects a Lovable, Bolt or v0 app on Supabase, the policy mistakes AI builders make, and the checks to run in under an hour.

Cover for “Your Lovable app is probably public”, with the line: The anon key is in the browser. Without row-level security it is a master key.

Security

Your Lovable app is probably public

Over 170 Lovable-built apps had open databases in one disclosure. How the leak works, the three named breaches of 2026, and the twenty-minute check to run.

Find out what is worth automating

About 95% of AI pilots never reach the profit line. We start with the work your team still does by hand and measure each build by the hours it saves.

See how we work

Cookie preferences

Choose what this site may use on your device. You can change this at any time from “Cookie settings” in the footer.

Strictly necessary

Keep the site working and remember the choices you make here. These cannot be switched off, and none of them track you.

Always on
What this includes (4)
NameProvider PurposeDuration
sbd-consentThis site Remembers your cookie choices12 months
Vercel Web AnalyticsVercel Inc. Counts page views in aggregate. Sets no cookie and stores nothing on your deviceNone
ticker-dismissed, sbd-note-offThis site Remembers that you closed a notice or language tipUntil the tab closes
sbd-voice-resume, sbd-voice-prefillThis site Carries a voice conversation across pages, only if you start oneUntil the tab closes

Analytics

Tell us which pages are read and where visitors leave, so we can improve them. IP addresses are anonymised and nothing is used for advertising.

What this includes (2)
NameProvider PurposeDuration
_gaGoogle Analytics (Google LLC) Distinguishes visitors with a random ID13 months
_ga_FPXDMQPRV1Google Analytics (Google LLC) Keeps the session state for this site13 months

Functional

Embedded services that set their own cookies. Without them the site still works; you get a link to open the service instead.

What this includes (1)
NameProvider PurposeDuration
Booking calendarCal.com Inc. Shows live availability and books the call on the booking pageSet by Cal.com

Advertising

Not used. This site has no advertising, retargeting or social media tracking, and we never sell data.

Not used

Questions about your data: hello@smallbaydigital.com