# Fix or rebuild? Deciding what to do with a vibe-coded app

Concrete signs that an app built with AI tools is worth fixing, signs that it needs a rebuild, and the middle path between them.

Published 2026-11-25.

Page: https://touji.dev/guides/fix-or-rebuild-vibe-coded-app

You built an app with Lovable, Bolt, Replit, v0 or Cursor. It got you a demo, maybe your first users. Now each new prompt seems to break something else, and someone has told you to throw it away and start again.

Sometimes that's right. Often it isn't. This guide gives you the criteria we use to decide, the trade-offs on each side, and the middle path most apps should consider first.

## What fixing and rebuilding actually mean

The words get used loosely, so it helps to pin them down.

- **Fix** means keeping the code and the database. You repair what's broken, close security gaps, remove dead code, add tests around the flows that matter, and set up deploys you can repeat. The app keeps running the whole time.
- **Rebuild** means writing a new code base. You keep what you learned: the screens, the flows, the copy and, almost always, the data. The old app runs until the new one is ready to replace it.
- **Replace in parts** sits between them. You keep the app running and replace one piece at a time behind it, until little of the original is left. Martin Fowler calls this the [strangler fig pattern](https://martinfowler.com/bliki/StranglerFigApplication.html).

## The case against starting over

Joel Spolsky's well-known essay on rewrites, [Things You Should Never Do](https://www.joelonsoftware.com/2000/04/06/things-you-should-never-do-part-i/), argues that old code is full of fixes for problems nobody remembers, and a rewrite throws them away. You lose time and ship nothing new while you rebuild what you already had.

That argument is weaker for a young AI-built app. There are fewer years of hard-won fixes buried in the code, and much of it may never have been read by a person. But two parts of the argument still hold:

- **A rebuild ships nothing new for a while.** Your users wait, and you're spending money on a version of the product you already have.
- **The new version will have its own bugs.** A clean start doesn't mean a correct one, and it won't have the real-world testing the old app got.

So the bar for a rebuild should be specific problems the old code can't get past, not general dislike of it.

## First, take an inventory

Don't decide from a feeling. Spend a day or two reading the app before you choose, or have someone do it for you. Look at:

1. **The data model.** List the tables and how they relate. Does each row that belongs to a user or a company say which one? Are relationships real foreign keys, or IDs stored as text?
2. **Access control.** Where are permissions checked: in the database, on the server, or only in the browser? If it uses Supabase, does every table have [Row Level Security](https://supabase.com/docs/guides/database/postgres/row-level-security) with sensible policies? Our [Supabase security checklist](https://touji.dev/guides/supabase-security-checklist) walks through this.
3. **Secrets.** Are any secret keys in the browser code or the repository?
4. **Where the business logic lives.** Prices, quotas, permissions and status changes should be decided on a server or in the database, not in the browser.
5. **Code shape.** Is the same thing implemented three ways? Are there very large files, or components nothing uses?
6. **Dependencies.** Run [`npm audit`](https://docs.npmjs.com/cli/commands/npm-audit/) for known vulnerabilities and check how far behind the main frameworks are.
7. **Tests and deploys.** Are there any tests? Can a developer clone the repository, run it locally and deploy it, without the AI tool?

Write down what you find. The decision usually becomes clear once the list is in front of you.

## Signs the app is worth fixing

- **The data model fits the business.** Tables match the real things your business deals with, and user-owned rows are tied to their owner. This matters most, because data is the hardest thing to change later.
- **The problems are in identifiable places.** Missing RLS policies, a leaked key, unverified webhooks, a few routes without permission checks. These are serious, but each has a known fix that doesn't require new code everywhere.
- **It uses a common stack.** React, TypeScript, Supabase or Postgres, Stripe. Plenty of developers know these, so you can hire help for the code you have.
- **You have real users or data.** A rebuild has to carry them over anyway, and every migration is a chance to lose something.
- **You can get the code out.** Both [Lovable](https://docs.lovable.dev/integrations/github) and [Bolt](https://support.bolt.new/integrations/git) can sync a project to GitHub, so the code can live outside the tool and be worked on with normal tools.

## When a rebuild is the honest answer

A rebuild is the better choice when the problems sit in the foundations, and fixing them means touching most of the app anyway. Concretely:

- **The data model is wrong at the root.** For example, a product sold to companies where data isn't scoped to a company, or where most of the data lives in loosely structured JSON with no stable IDs. Fixing that changes every query, every policy and most screens.
- **The logic lives in the browser and there's no server layer.** If the browser calculates prices, decides permissions and writes straight to every table, moving that to the server rewrites the core of the app.
- **The product has changed.** The prototype proved the idea, but the real product needs something it can't grow into, such as a native mobile app with offline use, or a multi-tenant system where the prototype was single-user.
- **Nobody can run it outside the tool.** If the code can't be built, tested and deployed without the AI tool, and attempts to export it keep failing, you don't really have a code base to fix.
- **The fix list touches nearly every file.** At that point a "fix" is a rebuild without the benefit of a clean design.

If two or more of these apply, plan a rebuild, and keep the old app running until the new one replaces it.

## The middle path: keep the data, replace the parts

Most apps sit between the two lists. For those, the most practical route is to keep the data and the running app and replace pieces one at a time.

- **Keep the database.** If the app runs on Supabase, the data is in Postgres. You can keep the same project, put the schema under version control with [migrations](https://supabase.com/docs/guides/deployment/database-migrations), and fix the data model one change at a time. If your data lives in a builder's hosted database, check how to move it first: Bolt lets you [claim its database into your own Supabase account](https://support.bolt.new/bolt-cloud/database/advanced), and Lovable documents how to [move from its built-in backend](https://docs.lovable.dev/features/cloud) to your own Supabase project.
- **Secure first.** Fix RLS, secrets and webhook verification before anything else. Those fixes carry over to whatever comes next.
- **Add tests around what you keep.** End-to-end tests for sign-up, payment and the core feature tell you whether a replacement works the same as the original.
- **Replace the worst part first.** Usually that's the part users touch most or the part that breaks most. Ship it, check it, then move to the next.

This takes discipline, but it means users keep getting improvements while the foundations change underneath them, and you can stop at any point with a working app.

## Trade-offs at a glance

**Fixing in place**

- Faster to the first real improvement.
- Keeps users, data and URLs exactly as they are.
- Keeps the code's quirks, and each fix costs more if the foundations are weak.

**Rebuilding**

- A chance to get the data model and access control right from the start.
- A long stretch with nothing new for users, plus a data migration at the end.
- New code with new bugs and no real-world testing yet.

**Replacing in parts**

- Improvements ship throughout, and you can stop when the app is good enough.
- Needs tests and careful planning, because old and new code run side by side for a while.

## Questions to answer before you decide

- Which parts of the app make money or hold data you can't lose?
- What does the inventory say about the data model and access control?
- Can a developer run and deploy the app without the AI tool?
- What do you need the product to do in a year that it can't do now?
- Who will maintain the code afterwards: you with AI tools, a hired developer, or a team?

The last question matters more than it looks. Code that will be maintained by people needs to be readable by people, and that changes how much cleanup is worth doing.

## Get a second opinion

We read the code and the database, then tell you plainly which parts are worth keeping and which won't hold up. The quote covers only the work we recommend. See [Vibe-coded app rescue](https://touji.dev/services/vibe-coded-app-rescue), [Stack and architecture consulting](https://touji.dev/services/stack-consulting) and [Engineering teams](https://touji.dev/services/engineering-teams), or [tell us about your app](https://touji.dev/contact). If the app is live and failing right now, start with [what to check first](https://touji.dev/guides/lovable-bolt-app-breaks-in-production).

## Contact

To start, book a call or send a short note about your business and the problem at https://touji.dev/contact. The intro call is free. After the call we send a written, fixed-scope quote, so the full cost is known before any work starts. We do not publish prices. On-site across Los Angeles and Orange County. Remote anywhere.
