Skip to content

[ Anolilab — Article / AI ]

How to fix a vibe-coded app before real users break it

Your Lovable, Bolt or Cursor app works in the demo. What breaks on the way to production, how to fix a vibe-coded app, and when a rebuild is the better call.

Article by
Daniel Bannert · Founder · Anolilab

In short

A demo shows the path where everything works: one user, one database, no errors. Real users need more. Apps built with Lovable, Bolt, Cursor, v0 or Replit usually lack the same things: login emails that reach everyone, backups, migrations, separate environments, errors that someone actually sees, and spending limits with the providers. Almost all of it can be added to the existing code. A rebuild only pays off when the data model is wrong or nobody can change the code without breaking something else.

With vibe coding, you describe to an AI what the app should do and it writes the code. That gets you surprisingly far, right up to the first demo. Then come the questions the prompt never covered: what happens when a hundred people sign up at once? Who notices when a payment was not recorded? What if the database is gone?

This article walks through the areas where these apps typically break between demo and production, and how to fix each one. Security (keys in the frontend, Row Level Security, missing login checks) only gets a short mention here because it has its own article: Is AI-generated code secure? What an audit finds. At the end you will find a way to decide between fixing and rebuilding, and a launch checklist.

Why the demo works and the real app doesn't

AI tools optimise for what you can see: the page loads, the button does something, the data shows up. What you cannot see, nobody checks in the chat. In the demo there is exactly one user, you, you are on the project team, and every error happens in front of you.

Real users turn that around. They have unfamiliar email addresses, abandon flows halfway, open the app on a phone with a bad connection, and when something goes wrong they do not write to you, they leave. The sections below are ordered by what tends to hurt first.

What breaks at login once strangers sign up

The most common first failure after launch is mundane: the confirmation email never arrives. If your app runs on Supabase (a Lovable project connected to your own Supabase project, or a Bolt app claimed into your Supabase account), the built-in email service only sends, according to the Supabase docs, to members of the project's own team, and at most 2 messages per hour (as of November 2026). Supabase itself says it is not meant for production. As long as you test alone, you will not notice. With the first real user, you will.

What to fix:

  • Your own SMTP server: set up an email provider for auth emails. After that, messages go to any address, and you can raise the limit in the rate limit settings.
  • Site URL and redirect URLs: the Supabase docs say to change the Site URL from http://localhost:3000 to your real domain, because confirmation and password reset links depend on it. For production they recommend exact redirect URLs instead of wildcards.
  • Check logins properly on the server: according to Supabase, server code must not rely on getSession(), because it reads the session from the cookie without verifying it, and cookies can be forged. For access decisions, use getClaims() or getUser().
  • Permissions per record: making sure a logged-in user only sees their own data has to be enforced in the database or on the server, not in the interface. How to check that is in the self-check of the security article.

The database: schema, RLS, migrations and backups

The database is the part that is hardest to change after launch, because real data lives in it. Four things need settling first.

Row Level Security that is also fast

Row Level Security (RLS) means rules in the database that decide which rows a user may read or change. Why they must exist is covered in the security article. Less well known: badly written policies make the app slow once tables grow. The Supabase RLS docs give two rules. Every column a policy filters on needs an index, otherwise Postgres reads the whole table. And auth.uid() belongs inside a select, so Postgres computes it once per query instead of once per row.

RLS policy with an index
create index on public.invoices (user_id);

create policy "Users see their own invoices"
on public.invoices for select
to authenticated
using ((select auth.uid()) = user_id);

You do not have to hunt for either by hand. The advisors in the Supabase dashboard report, among other things, tables without RLS, foreign keys without an index and policies that re-run for every row (auth_rls_initplan). Supabase notes that some findings may be intentional, so check each one against your data model.

Migrations instead of dashboard clicks

In many prototypes the schema grew out of clicks in the dashboard or out of prompts, and nobody knows exactly which change happened when. The Supabase guide to migrations calls it the golden rule: never change the production database directly. Every change becomes an SQL file in the repository, tested locally and rolled out with supabase db push. If changes were already made directly in production, supabase db pull captures the current state as the first migration in the repository. From then on, every change goes through files.

Backups that actually exist

According to the Supabase docs, Supabase backs up projects daily from the Pro plan up and keeps those backups for 7 days, 14 days on the Team plan. For Free plan projects, Supabase recommends exporting the data yourself on a regular basis with supabase db dump. Files in Supabase Storage are not part of any database backup. If you need point-in-time recovery, it is an add-on.

A second point on the Free plan: Supabase pauses projects that see little database activity for a week. For an app with its first handful of users that is a real risk, and while a project is paused, every API call fails.

Run a test before launch: restore a backup into an empty project and check that the app runs on it. A backup that has never been restored is a hope.

Separate development from production

How costly a shared database for development and production can be showed in July 2025: Replit's AI agent deleted the production database of an app that SaaStr founder Jason Lemkin was building, during an explicit code freeze (The Register, 21 July 2025). According to Replit, changes made during development could affect production at the time. The data was restored through the rollback feature. Since the end of July 2025, Replit separates development and production databases by default.

Lovable went the other way: on 23 October 2026 it retired its separate Test and Live environments. Since then every project on the built-in backend runs on a single database, and according to the Lovable docs the new drafts do not provide a second database either. Lovable fully deletes the detached Test databases on 1 December 2026. If you run production on Lovable, you need a second database of your own for experiments, for example a second Supabase project.

Secrets and configuration

A prototype often has exactly one set of keys, and it sits somewhere in the code or in an .env file that got committed at some point. The Twelve-Factor App asks for strict separation of config from code and offers a simple test: could you make the codebase public at any moment without exposing a credential?

For an app that goes live, that means:

  • Each environment (local, preview, production) has its own keys, and test keys do not work in production.
  • Keys live in the host's environment variables, not in the repository.
  • Whatever reaches the browser is public. Which variables that covers in Vite and Next.js, and how to find leaked keys in your Git history, is in the security article.
  • Every key that has ever appeared in the code or in a chat with the AI gets revoked with the provider and replaced.

Error handling and monitoring

In the demo you see every error in the browser console. In production only the user sees it, and often what they see is a blank page: when a React component throws during rendering, React by default removes the whole UI from the screen. An error boundary shows an error message instead and can report the error to a service. It does not catch errors in event handlers or async code; those need their own try/catch.

At least three things should be in place before launch:

  1. Error tracking: a service such as Sentry, or a self-hosted equivalent, collects errors from browser and server with a stack trace and notifies you.
  2. Server logs: every server function logs enough on failure to reproduce the case, but no passwords, tokens or health data.
  3. Reliable webhooks: payments are where silent errors cost money. Stripe asks you to verify the signature of every webhook, reply quickly with a 2xx status and only then run your logic. In live mode Stripe retries failed deliveries for up to three days, and occasionally sends the same event more than once. So you store the IDs of processed events and never process one twice.

Performance and costs after launch

An app that is snappy with ten records can stall with ten thousand. The usual causes are missing indexes (see above), lists without pagination that load every row at once, and pages that send a separate query for each item. The Supabase Performance Advisor finds part of this; for the rest, look at the Network tab in your browser's developer tools: how many requests does a page send, and how large are they?

Open cost taps are more expensive than slow pages. Every endpoint that calls an AI API costs money per call, and without a limit you pay for every bit of abuse. Set a hard limit with every provider that offers one (as of November 2026):

ProviderWhat existsWhat to watch
OpenAI APIHard spend limit per organisation and per project; after that the API returns error 429Only with "Enforce a hard limit" turned on. Spend alerts alone cap nothing, and spend can briefly go past the limit
VercelTeam and project budgets on the Pro plan, with notifications at 50, 75 and 100%A budget stops nothing on its own. Only "Pause production deployments" halts the project, and Vercel checks only every few minutes
SupabaseSpend Cap on the Pro plan: nothing beyond the quota is billedCompute, point-in-time recovery, custom domains and some add-ons are not covered

Also limit, inside your own app, how often a user may call the expensive features. Why that is a security issue too is in the rate limiting section of the security article.

Deployment and environments

Many vibe-coded apps have exactly one environment: the one the AI is working in right now. Every change goes live immediately, including the one that breaks something. An app with real users needs at least:

  • The code in Git, in your account: Lovable syncs both ways with GitHub, GitLab and Bitbucket, v0 creates a private repository and works on its own branch per chat, according to its docs, and Bolt also syncs both ways with GitHub, according to its help page. That makes every change traceable and reversible.
  • A preview before production: every pull request gets its own preview URL; with v0 and Vercel that happens automatically. Test there before you merge.
  • A separate database for previews: otherwise you test with real customer data; see the Replit case above.
  • One fixed route to production: code and migrations only go live through the main branch, not with a click in the chat.

Missing tests

A typical AI prototype has no tests. That is fine for a demo but becomes a problem once the AI keeps working on the code: every new instruction can change something that used to work, and without tests a user is the first to notice.

I would not try to cover everything after the fact. A few end-to-end tests, for example with Playwright, make more sense, for the flows where money or trust is at stake: sign up, log in, pay, and the app's main action. Add one test that uses two accounts to check that user A cannot see user B's data. These tests run on every pull request before anything goes live. They are also the best instruction you can give the AI: a failing test tells it more precisely than any prompt what is broken.

Code nobody can maintain

The problem that shows up last: the code works, but every change takes longer and breaks something else more often. Typical signs are the same logic in five files, components with more than a thousand lines, errors swallowed by empty catch blocks, and type casts that silence the compiler.

GitClear's data suggests this is becoming more common with AI tools. In its analysis of 623 million code changes from 2023 to 2026, the share of moved lines, a sign of refactoring, fell from 21% in 2022 to 3.8% in 2026, while duplicated code blocks rose by 81% compared with 2023 (GitClear, The Maintainability Gap, 2026). GitClear measures a trend over time, not each line an AI wrote, and it sells code analysis tools itself.

You can fix this step by step: first tests for the critical flows, then merge duplicated logic, then split large files, never more than the tests cover. For cleaning up what AI agents leave behind in a branch, my open source skill deslop (MIT licence, no commission) removes narrating comments, needless defensive code and casts that hide errors, without changing behaviour.

How easily you can leave the platform

How locked in you are depends less on the code than on data, secrets and server functions. All the big tools let you export the code (as of November 2026):

ToolCodeData and backend
LovableTwo-way sync with GitHub, GitLab or Bitbucket; the repository stays when you disconnect; ZIP download on paid plansBuilt-in backend, or your own Supabase project. Since October 2026, only one database per project
BoltTwo-way sync with GitHub, private repositoryThe built-in Bolt database, data included, can be claimed into your own Supabase account on Pro and Teams plans; there is no way back
v0Private GitHub repository with two-way sync, ZIP exportEnvironment variables and deployments depend on the connected Vercel project

My advice: connect Git on day one, not the day before you move, and put the database in an account you own. Then switching tools is tedious work rather than an emergency.

Fix or rebuild?

Most of the problems above can be fixed in the existing code: emails, backups, migrations, monitoring, spending limits and tests get added without changing much about the app itself. A rebuild costs more than it looks at first, because it also has to recreate everything that already works in the prototype.

This is how I would decide:

FindingLean towards fixingLean towards rebuilding
Data modelFits the business; indexes or policies are missingFundamentally wrong, for example customers not separated or everything in one table
SecurityA few open tables or routesPermission checks missing everywhere and never centralised
CodeMessy, but changes stay localEvery change breaks something somewhere else
StackCommon stack (React, Vite, Next.js, Supabase)The platform cannot do something you need, and it cannot be exported
Users and dataReal users and data already in itNo users yet, and the prototype was mainly a test of the idea

Even a rebuild does not waste the prototype. It is the most precise spec you can hand a developer or an AI: screens, flows and data fields already exist. A middle way often pays off: keep the interface, set up the database and server logic cleanly from scratch.

Checklist before launch

  1. Check security

    Work through the self-check in the security article: keys in the frontend, RLS on every table, permissions per record, Git history.

  2. Test login with an outside address

    Your own SMTP server for auth emails, Site URL set to the real domain, exact redirect URLs. Sign up with an address that is not on the project team.

  3. Restore a backup

    Check which plan includes which backups and restore one into an empty project. Back up files in Storage separately.
  4. Move the schema into migrations

    supabase db pull captures the current state in the repository. From then on, only a migration changes production.

  5. Separate environments

    Own database and own keys for preview and production. Code only goes live through the main branch.
  6. Make errors visible

    Error boundary, error tracking for browser and server, webhook signatures verified and duplicate events caught.
  7. Set spending limits

    Hard limits on AI APIs, the pause option at your host, the Spend Cap at Supabase, and rate limits on expensive features inside the app.

  8. Test the critical flows

    End-to-end tests for sign-up, login, payment and the main action, plus one test with two accounts. They run on every pull request.

When to get help fixing your vibe-coded app

With some experience you can get through the checklist yourself. It gets hard when you cannot read the code the AI wrote and so cannot judge whether a fix breaks something else. Or when the choice between fixing and rebuilding decides how much money you spend.

That is the gap vibe coding fix services fill. For these apps I offer the Vibe-Code-Audit: I read the code and the database, check security, code quality and performance, and write you a report with a prioritised list of what to fix first and a recommendation on whether fixing is worth it. Then you decide who does the work: you, your team or me.

[ Anolilab — Blog ]

More hands-on writing on AI, web development and infrastructure.

Related articles.

[ Anolilab — Contact ]

Tell me what you're building. I'll tell you how I can help.

Let's talk.

Quick response.
If you're ready to create and collaborate, I'd love to hear from you.
Clear next steps.
After the consultation, I'll give you a detailed plan.
Alternatively, you can email me directly at hello@anolilab.com