Vibe-coded app to production: what to fix, what to rebuild and how to test each layer
A Lovable, Bolt, Replit or Cursor app that now has paying users is ready for production when five layers pass a test: auth, payments, the data model, deploys and secrets. Here is the fix-or-rebuild call for each layer, the test that proves it, and what fixing a real AI-built site involved.
A Lovable, Bolt, Replit or Cursor app is production ready when five layers pass a test: a second account can’t read your rows, a retried payment charges once, every row has an owner, the app deploys outside the tool and no secret key reaches the browser. Fix the layers that fail; rebuild only those with wrong foundations.
Listen to the summary ·
Read the transcript
A researcher scanned 1,645 apps built with Lovable and found 170 whose databases strangers could read. Lovable disputes the record, saying each customer is responsible for their own app’s data. Either way, the tool built the app, and making it safe to run is still the owner’s job.
If people already use your prototype, the idea works. What is left is the work a demo never shows. Veracode found security flaws in 45% of the AI-generated code it tested across more than 100 models.
The checklist starts with security: access rules checked on the server, row-level security that denies by default, and no secret keys in the app. Then data: backups you have restored once, separate development and production databases, and a ledger for any money the app holds. Payment and booking calls must survive a retry without charging or booking twice. Apple’s guideline 4.2.6 rejects apps from app generation services unless the content owner submits them, so publish from your own account. And every account belongs in your company’s name.
Fix the parts whose foundations hold, and rebuild the ones that don’t. Usually that means keeping the screens and rewriting the access rules.
If the app has no payments and no sensitive data, you may not need an agency. The guide explains how to tell.
AI-generated voice summary of this guide.
You built the app in Lovable, Bolt, Replit or Cursor, it works in the demo, and now real users sign in and pay through it. It is ready for production when five layers each pass a test: auth, payments, the data model, deploys and secrets.
The risk in those layers is documented. In March 2025 a researcher scanned the homepages of 1,645 apps built with Lovable and found 170, about 10.3%, whose database access rules let anyone pull data without logging in. In May he went back to one paid site maintained by a Lovable employee, dropped the login header from a request and inserted a record with its payment status set to paid, bypassing Stripe. The record for the issue, CVE-2025-48757, carries a CVSS score of 9.3 out of 10. Lovable disputes it, on the grounds that each customer is responsible for protecting their own app’s data.
For a founder, that dispute settles who carries the risk: you do.
Is a Lovable, Bolt or Replit app production ready?
It can be, once someone has tested the layers around the screens. What the builder leaves to you is checking who can read a row and what a retried payment does.
Security flaws are common in AI-generated code. Veracode tested more than 100 large language models on 80 coding tasks and found security flaws in 45% of the results. Larger models did not do significantly better than smaller ones. That was July 2025, and Veracode sells security testing tools, so treat 45% as a direction for AI code in general. It says nothing about your app’s rate.
Deploys fail in their own way. In a case Fortune reported in July 2025, Replit’s AI agent, during a code freeze, deleted a live production database in a test run by SaaStr’s founder, erasing records for more than 1,200 executives and over 1,190 companies. Replit then rolled out automatic separation of development and production databases. If your app uses one database for testing and for customers, it has the same exposure.
Fix or rebuild: the call for each layer
Fix a layer in place when its foundation can already express the rule it is missing. Rebuild it when it can’t. The call is made one layer at a time, and in our experience the five below carry the most risk once money and personal data arrive. Each row ends with the test that settles it.
You can run two of those tests yourself: sign in as a second user and try to open the first user’s record, and open the live app logged out and see what it shows. The other three need someone with access to the code, so ask whoever does the work to show them passing.
| Layer | Fix in place when | Rebuild when | The test that proves it |
|---|---|---|---|
| Auth and access rules | Every table records which user or organization owns each row, and the gaps are missing or loose policies | Ownership isn’t in the schema, so no policy can say who may read a row, or access is enforced only by hiding buttons | Sign in as a second user and request the first user’s record by its ID, then send the same request with no login header. Both must be refused. |
| Payments | The payment provider holds the state of each payment and the app acts on its verified webhooks | The browser tells the database an order is paid, or balances live in one column that each change overwrites | Repeat a charge with the same idempotency key, deliver the same webhook twice and try to mark an order paid from the browser. Expect one charge, one fulfillment and a refused write. |
| Data model | Tables match the things the product deals in, and changes can be added as migrations | Money, credits or commissions have no history of entries, or one table mixes unrelated data for every customer | Rebuild each balance from its entries and compare it with the payment provider’s records, then restore last night’s backup into a separate database. |
| Deploys | The code is in a repository you own and builds from written steps | It runs only inside the builder, or development and production share a database | A second engineer clones the repository, builds it and deploys to a staging copy from the README, and a migration runs on staging before production. |
| Secrets | Keys are already on the server, or a few need moving and rotating | Paid APIs (AI, payments, email) are called from the browser by design, so the keys can’t move without a new server layer | Search the shipped bundle for secret keys and confirm none is there. Rotate any that ever shipped and check that the old one now fails. |
Fix or rebuild, per layer, with the test that proves it
- Fix in place when
- Every table records which user or organization owns each row, and the gaps are missing or loose policies
- Rebuild when
- Ownership isn’t in the schema, so no policy can say who may read a row, or access is enforced only by hiding buttons
- The test that proves it
- Sign in as a second user and request the first user’s record by its ID, then send the same request with no login header. Both must be refused.
- Fix in place when
- The payment provider holds the state of each payment and the app acts on its verified webhooks
- Rebuild when
- The browser tells the database an order is paid, or balances live in one column that each change overwrites
- The test that proves it
- Repeat a charge with the same idempotency key, deliver the same webhook twice and try to mark an order paid from the browser. Expect one charge, one fulfillment and a refused write.
- Fix in place when
- Tables match the things the product deals in, and changes can be added as migrations
- Rebuild when
- Money, credits or commissions have no history of entries, or one table mixes unrelated data for every customer
- The test that proves it
- Rebuild each balance from its entries and compare it with the payment provider’s records, then restore last night’s backup into a separate database.
- Fix in place when
- The code is in a repository you own and builds from written steps
- Rebuild when
- It runs only inside the builder, or development and production share a database
- The test that proves it
- A second engineer clones the repository, builds it and deploys to a staging copy from the README, and a migration runs on staging before production.
- Fix in place when
- Keys are already on the server, or a few need moving and rotating
- Rebuild when
- Paid APIs (AI, payments, email) are called from the browser by design, so the keys can’t move without a new server layer
- The test that proves it
- Search the shipped bundle for secret keys and confirm none is there. Rotate any that ever shipped and check that the old one now fails.
The data model test comes from a platform we built: on Freedom Pro’s wallets, balances have to reconcile with the provider’s records. The other rules are informed by our production work, including the Freedom Pro fix below. They are decision rules from our projects; we haven’t measured them across apps.


AI-built work we finish for Freedom Pro
When the Freedom Pro team builds something with AI tools, such as a website, some of that work comes to us to fix and take to production. Freedom Pro is a direct-selling platform we built: a partner back office with commissions, a member portal, native apps, and wallets on Bridge’s API. The case file describes a typical example: “a website made with an AI app builder whose payment structure is broken and whose database has a lot of problems. We fix the payment flow and the database, then take the work to production alongside the platform we built for them.”
In the table above, that is the payments row and the data model row. On a platform that pays commissions, those are the layers where a mistake changes what someone is paid, and any commission engine has to be reproducible: “the same team activity must always produce the same number.” The same work is what our AI prototype to production service does for other teams.
Can you fix AI-generated code with the AI tool itself?
Partly. The tool can fix an issue once someone names it, but its own checks can pass an app that leaks data, so a person still has to decide what to test.
The Lovable case shows the gap. After the disclosure, Lovable added a security scan. According to the researcher, the scan as released in April 2025 checked whether a row-level security policy existed, not whether it was correct. A policy that exists and lets everyone read still passes a check like that. The tests in the table catch it, and a person has to run them.
The production-readiness checklist for an AI-built app
An AI-built app is ready when each item below can be shown passing. If nobody can show an item passing, treat it as open. If what you built is an AI agent rather than an app, the matching list is in our guide to taking AI pilots to production.
Security
- Server-side access rules. Every read and write is checked on the server, not hidden in the interface.
- Row-level security, deny by default. Every table with user data has row-level security switched on and a policy per action. A table with no policy should return nothing.
- Secrets out of the client. No secret, AI or payment keys in the browser bundle or the mobile app. Calls that need them go through your server. On Supabase, the publishable key (the older anon key) is meant to be public; the secret key (the older service role key) bypasses row-level security and must never ship.
- Input validation. Every form and API input is validated on the server for type, length and format, and output is escaped.
- Auth that can be revoked. Email verification where identity matters, rate limits on login and password reset, and sessions you can end from the server.
Data
- Backups you have restored. Automatic backups, plus one restore into a separate environment to prove they work.
- Separate development and production. A different database and different keys for each, so a test, a migration or an agent can’t touch live data.
- Migrations in version control. Schema changes are scripts in the repository, so every change can be replayed on staging first.
- A ledger for money. If the app holds balances, credits, commissions or payouts, record every movement as an entry and derive the balance from the entries.
Reliability
- Idempotent payment and booking calls. Stripe’s API takes an idempotency key so that a request repeated after a connection error does not create a second object. Your own order and booking endpoints need the same rule.
- Webhooks handled once. Payment webhooks are verified, stored and processed once, even when the provider sends them twice.
- Retries with limits. Calls to outside services retry with backoff, then stop and record the failure.
- Errors that reach a person. Alerts on failed payments, failed jobs and spend on AI APIs, with rate limits on anything that costs money per call.
Integrations
- Gated APIs found early. Some systems have no self-serve key and need a partner agreement first. Find out which of yours work like that before you promise a launch date.
- Writes that can be undone. Every write to another system has error handling and a way to correct it.
App stores
- Apple guideline 4.2. An app needs “features, content, and UI that elevate it beyond a repackaged website.” A web prototype wrapped in an app shell is the case this rule describes.
- Apple guideline 4.2.6. Apps “created from a commercialized template or app generation service will be rejected unless they are submitted directly by the provider of the app’s content.” Submit from your own developer account.
- In-app purchase. Apple’s guideline 3.1.1 requires in-app purchase for unlocking features or functionality inside the app, subscriptions included. Check the fee before you price the plan.
Code ownership and upkeep
- Accounts in your company’s name. The repository, cloud, database, domain, Apple and Google developer accounts, payment provider and every API key.
- Tests on the paths that move money or data. Sign-up, login, payment, booking and anything that deletes.
- One way of doing each thing. Prompt-by-prompt building can leave duplicate libraries and parallel auth flows. Keep one of each and delete the rest.
- A README a new engineer can follow. How to run it, how to deploy it and where the secrets live.
When you don’t need an agency
You don’t need an agency if the app is a demo, a waitlist or an internal tool with a handful of users, no payments and no sensitive data. Keep building with the AI tool, work through the security and data sections yourself, and turn on backups.
One experienced freelance engineer is often enough when the app has one clear risk: a missing access policy, an exposed key or a deploy that only works from the builder. Ask them to show you the test from the table passing.
A senior team earns its cost when several of these are true at once: money moves through the app, it stores personal data, an integration needs partner approval, a native app has to pass review, or investors will look at the code.
What the free readiness review gives you
A senior engineer reads your code and a preview build against our production checklist, without writing to anything. Within 2 days of getting access you get a short written report: each layer marked as blocking launch, fix before launch or fine for now, with a first fix-or-rebuild call.
If you then want the work done, a paid Discovery Sprint tests every item and ends in a fixed quote. A fix list big enough to be a project runs as a Fixed-Price Build in our $25k–$120k band.
Get a free readiness review with read-only access to your repository and a preview link. If the code lives only in the builder, connect it to GitHub first: Lovable syncs with GitHub on every plan, and Bolt and Replit can push to it too.
Sources
- CVE-2025-48757 Detail, NIST National Vulnerability Database (published May 30, 2025; disputed by the supplier; checked November 23, 2026)
- Statement on CVE-2025-48757, Matt Palmer (May 29, 2025)
- AI-Generated Code Poses Major Security Risks in Nearly Half of All Development Tasks, Veracode Research Reveals, Veracode (July 30, 2025)
- An AI-powered coding tool wiped out a software company’s database, then apologized for a ‘catastrophic failure on my part’, Fortune (July 23, 2025)
- Understanding API keys, Supabase Docs (checked November 23, 2026)
- Idempotent requests, Stripe API reference (checked November 23, 2026)
- Taking a Lovable, Bolt or Replit App to Production, Fly.io (October 12, 2026)
- App Review Guidelines (4.2 Minimum Functionality), Apple Developer (checked November 23, 2026)
Prototype to Production
We take Lovable, Bolt, Replit and Cursor apps to production. Start with a free readiness review of access, payments and data to decide what to fix or rebuild.





