6 min readEngineering
Should you fix your AI-generated MVP or rewrite it?
Most AI-built MVPs don't need a rewrite. What technical debt in v0 and Cursor apps looks like, how I audit a codebase in 3 to 5 days, and how to decide.
Updated
Usually, fix it. An app that works for its first users has already answered the hardest question, whether people want it, and most of its code is fine. A rewrite makes sense when the data model is wrong for the business, or when every change breaks something else. Here's how to tell which one you have.
1Why a rewrite is tempting
Developers like rewrites: a clean start, their own choices. Founders hear "the code is a mess" and reasonably think "start again". But a rewrite means months with no new features, finding again the bugs the old app already fixed, and losing small details users rely on without knowing it.
This isn’t new. Joel Spolsky called rewriting from scratch "the single worst strategic mistake" a software company can make, back in 2000, about Netscape. AI tools make writing code cheap, which makes starting again feel cheap too. Getting the new version to where the old one already is still isn’t.
2Signs a fix will do
- Users can do the main thingSign-up, the core action and payment work. The problems are at the edges: errors, slow pages, odd states.
- The problems are specific"Some orders don't get marked as paid" or "the dashboard is slow" are bugs with causes. They get found and fixed one at a time.
- The database makes senseThe tables match the things in your business (users, teams, orders, invoices), even if the code around them is untidy.
- Changes are slow, not impossibleGiant files and copied code make every change take longer. They can be split up gradually, while the app keeps running.
3Signs part of it needs rebuilding
- The data model is wrongYou sell to teams, but everything belongs to one user. Money is stored in a way that rounds. When the core shape of the data is wrong, most code that touches it changes anyway.
- Every change breaks something elseThe same logic lives in ten places, and fixing one bug makes two. Past a point, fixing that part costs more than rebuilding it.
- The platform can't do what you needYou need offline mobile, long background jobs, or data kept in a particular country, and the stack the tool chose can’t do it.
Even then, it is rarely all or nothing. Rebuild the part that is wrong and keep the rest.
The usual way is what Martin Fowler named the strangler fig: build the new part beside the old one, move one feature or route across at a time, and switch the old part off when nothing uses it. Users keep a working app the whole way.
4Technical debt in v0 and Cursor apps: what it looks like
- The same logic in several placesEach prompt solved its problem locally, so the price calculation lives in four files. Usually a fix: keep one, delete three.
'use client'everywhereIn a Next.js app from v0, a client directive at the top of every file means nothing renders on the server. Slower, worse for search, and usually a fix, page by page.- Types switched off
any,@ts-ignoreand casts around money and sign-in. A fix, but the errors that appear when types go back on are your real bug list. - No migrationsThe database was changed by hand or by prompt, so nobody can make a second copy of it. A fix: capture the schema as it is, then change it only through migration files.
- Leftovers from abandoned attemptsThree half-finished versions of a feature, packages nobody chose. Cheap to remove once tests cover what stays.
- A data model that fights the businessThe one that can mean a rebuild, as above. Everything else on this list is cleaning.
5How to decide without guessing
- Write down where you need to be in six monthsHow many users, which features, which customers. A rewrite only pays off if the current app can’t get there.
- Get the app auditedSecurity, data model, the main flows, deploys and speed, written up area by area. Opinions from someone who hasn’t read the code are guesses.
- Price fix against rebuild for each areaBilling might need rebuilding while the rest only needs cleaning. Decide per area, not for the whole app.
- Do security first either wayOpen database rules and exposed keys are urgent whatever you choose. They don’t wait for the rewrite.
6How I audit an AI-generated codebase in 3 to 5 days
- Run it and read the data modelThe app on a staging copy, the tables and how they relate. Most fix-or-rebuild answers start here.
- SecurityDatabase rules tested from outside the app, every key, and the checks on each server route.
- The main flowsSign-up, the core action and payment, end to end, including the ways they fail.
- Structure, deploys and speedWhere changes are hard and why, how the app ships, and how it loads on a mid-range phone.
- The reportFindings ranked by risk, and for each area a recommendation, fix or rebuild, with hours.
The audit is ₹15,000 – ₹40,000, fixed by the size of the app. What moves the price, and what you should get for it, has its own post.
7Fixed-price code rescue
The fixes are quoted from the audit, usually ₹40,000 – ₹1,50,000, and the price is fixed before I start. That only works because the audit comes first: the scope is written down, so the risk of a surprise is mine, not yours. You can also take the report to your own developer.
8What a fix usually looks like
- Close the security holes: database rules, keys in the browser, checks on the server. My Supabase checklist lists them.
- Add error tracking, so you hear about failures before your users tell you.
- Split the biggest files, and add types and tests around money and sign-in.
- Set up a deploy you can repeat, with a staging copy to test on.
- Then search and speed.
That's the order I work in on a fix: keep what works, fix the rest in order of risk, and leave code that you, the next developer or your AI tool can keep building on.
Questions people ask
- Can AI-generated code be production ready?
- Yes, with the same review any code gets before real users rely on it. AI tools write working code quickly; what they often skip is the boring part: access rules, error handling, limits and tests. Adding those is usually a fix, not a rewrite.
- How long does a rewrite take?
- It depends on the app, but a rewrite has to rebuild every feature and fix many of the same bugs again before it catches up. A fix gets to a production-ready app sooner, because the app already works.
- Can I keep building with Lovable or Cursor after a fix?
- Yes. A good fix keeps the structure the tool already understands and leaves notes on what changed and why, so you can carry on prompting without undoing it.
- How much does it cost to audit an AI-generated codebase?
- Published prices run from a couple of hundred dollars for an automated scan to a few thousand for a person reading the whole app. Mine is ₹15,000 – ₹40,000, fixed by app size, with the report in 3 to 5 days.
- What is technical debt in an AI-built app?
- The shortcuts that make the next change slower or riskier: copied logic, types switched off, no migrations, leftovers from abandoned attempts. Most of it is cleaned up in place; only a wrong data model tends to mean rebuilding part of the app.