A developer opens your AI-built app, looks uncomfortable, and says: “We should probably rebuild this.”
That recommendation might be right. It also might be the most expensive way to avoid understanding the system you already have.
My default is not “never rebuild.” It is: make the rebuild earn its cost.
I build products with AI-assisted tools and then inspect the architecture, permissions, data model, tests and deployment around them. The useful lesson is that the decision should start with what the product must keep true, not whether the code looks elegant.
First separate fix, refactor and rebuild
These are three different decisions.
Fix
A bounded problem is wrong and you can correct it without restructuring the whole system.
Examples:
- one broken auth redirect;
- one missing authorization policy;
- one webhook handler that is not idempotent;
- one deployment branch pointing at the wrong target.
Refactor
The product behavior is mostly correct, but the same structural problem makes changes dangerous or expensive.
Examples:
- permissions are duplicated across many UI components;
- the same business rule is implemented differently in five places;
- API calls are scattered with no clear boundary;
- generated code works but is difficult to test safely.
Rebuild
You intentionally replace a substantial foundation because keeping it creates more risk than recreating the working behavior.
A rebuild may still preserve the existing data, interface concepts, workflows and business knowledge. “Rebuild” should not mean “forget everything we learned.”
The seven questions I use
1. Can you state the product rules clearly?
Before judging code, write the invariants.
For example:
- A user can only see records they own or were explicitly granted.
- A confirmed payment cannot be fulfilled twice.
- Archived financial records are reversed, not silently deleted.
- Ownership changes must preserve audit history.
If nobody can state what must remain true, a rebuild is dangerous because you may recreate the UI and lose the business logic hidden in the old system.
2. Is the data model fundamentally wrong?
This is one of the strongest rebuild signals.
If the current database treats concepts that must be separate as one field or one table, every feature may be fighting the model.
But distinguish “not how I would design it today” from “cannot represent the product correctly.” The first may justify refactoring. The second can justify rebuilding a layer.
3. Are authorization boundaries recoverable?
If users can see or modify data they should not, inspect where authorization actually lives.
A weak frontend check can often be replaced with correct server or database enforcement. That does not require rebuilding the entire interface.
For Supabase-backed apps, current Supabase guidance is explicit: exposed tables should use Row Level Security and least-privilege grants, while secret or service-role credentials must stay off the frontend because they bypass RLS.
If identity, ownership and tenancy relationships are fundamentally confused throughout the data model, the security problem may be structural.
My Lovable + Supabase troubleshooting guide goes deeper on separating auth, grants and RLS before changing the whole app.
4. Can the app build and deploy reproducibly?
If a clean checkout can install, test and build, that is useful evidence that the system can be reasoned about and recovered.
If nobody knows which repository is production, environment variables exist only on one laptop, and deployments cannot be traced to commits, fix the operational foundation before assuming the source code itself must be thrown away.
Deployment ownership matters too. Production should have a known source branch, controlled secrets and a repeatable release path rather than a sequence of manual steps that only one person understands.
5. Are the failures local or everywhere?
Count them.
If three important bugs all come from one payment module, fix the payment module.
If every new feature breaks because state, data access and permissions are tangled across the entire app, you may have a structural refactor or rebuild case.
Do not turn “I found ugly code in six files” into “the whole product is unsalvageable.”
6. What working product knowledge would a rebuild throw away?
A working AI-built app contains more than code:
- screen flows;
- field names users understand;
- edge cases discovered through use;
- integrations;
- content and copy;
- customer feedback;
- pricing logic;
- data accumulated in production.
A rebuild has to re-earn those decisions.
That is why an audit-first approach is usually more defensible than deciding from the first uncomfortable look at the repository. Current AI-app rescue services themselves increasingly position the work as diagnose, stabilise and keep what works rather than automatically replacing the entire product.
7. What is the migration risk?
For a prototype with no users or production data, rebuilding can be cheap.
For a live product, you need a migration plan for accounts, data, payments, URLs, webhooks, domains and ongoing user activity.
The new app is not “done” when the screens match. It is done when users and data can move without breaking the business.
If another developer is taking over, use my Lovable developer handoff checklist to make the repository, backend, domains, integrations, product rules and critical journeys explicit before the work starts.
A practical decision matrix
| Situation | Better default |
|---|---|
| One or two isolated bugs | Fix |
| Repeated unsafe pattern, sound data model | Refactor |
| UI is messy, backend rules are sound | Fix or refactor UI |
| Database cannot represent core business rules | Rebuild data layer or larger foundation |
| Auth/RLS is incomplete but relationships are clear | Fix authorization |
| Every module encodes contradictory ownership rules | Strong rebuild or refactor signal |
| Prototype has no users or data and architecture is fundamentally wrong | Rebuild may be cheapest |
| Live product has substantial working behavior and data | Audit before any rebuild |
Partial rebuilds are underrated
The choice is not always “patch forever” versus “start from zero.”
You can replace:
- the auth layer;
- the payment state machine;
- the database schema with a migration;
- one generated module;
- the deployment system;
- a fragile frontend route;
while keeping the rest.
That is often the highest-leverage option because it concentrates cost where the architecture is actually weak.
What I would ask before accepting a rebuild quote
Ask the person recommending it:
- Which specific product invariant cannot be made reliable in the current system?
- Which layer causes that limitation?
- What working parts will be preserved?
- How will production data migrate?
- How will we prove the rebuilt version behaves correctly?
- What is the rollback plan during cutover?
If the answer is mainly “AI code is messy,” get a second opinion.
A serious proposal should separate diagnosis from the commercial incentive to win a full rebuild.
The better goal: reduce uncertainty first
A rescue audit should leave you with a map:
- what is safe;
- what is broken;
- what is structurally weak;
- what is untested;
- what can be repaired;
- what genuinely needs replacement.
Then cost the options.
That is more useful than starting with the conclusion that AI-generated software is either magically production-ready or automatically garbage.
If you want to assess the system yourself first, start with the broader AI-built app production checklist.
If the product needs hands-on architecture, debugging, refactoring or a carefully scoped rebuild, see my MVP development service or contact me. I can help you determine what should be preserved before you spend the rebuild budget.



