← Writing5 min read

SYMPTOM

An agency says I have to rebuild my prototype from scratch

Why you should audit your AI-built app before you rebuild it

An agency may tell you to throw away your Cursor or Lovable prototype and quote a full rewrite. Why a 1-week bounded audit is the safer, cheaper first step.

You used Cursor, Lovable, v0, or Claude Code to build a functional prototype in two weeks. The buttons work, the database connects, and the demo looks impressive.

Then comes the moment of hesitation:

"Is this actually safe to show real paying customers?"

You ask an external development agency or a freelance senior engineer for a second opinion. Within ten minutes of looking at your repo, they give you the standard answer:

"This code is messy AI slop. It can't scale. We need to throw it away and rebuild it from scratch in our clean architecture. Here's our quote for the rewrite."

Accepting that answer without checking can be an expensive mistake for a non-technical founder.

The Rebuild Trap

Your AI-generated prototype does not need a full rebuild. It needs a bounded technical audit.

  1. 01An agency that bills by the hour has an incentive to rewrite code you already paid for.
  2. 02In the AI-built prototypes I have reviewed, the same three invisible boundaries come up again and again: database permissions, webhook retries, and disaster recovery.
  3. 03A 1-week audit gives you a ranked risk table and a 48-hour patch plan, allowing you to launch without burning your runway.

1. What agencies get wrong about AI-generated code

Traditional software developers are trained to value code aesthetics: clean folder structures, strict design patterns, and micro-abstractions. When they open an AI-generated codebase, they see duplicate utility functions and large components, and instinctively call it "unmaintainable."

But your MVP is not a failure. It proved your product hypothesis faster and cheaper than a from-scratch build would have.

The goal of an MVP is not to win an architectural beauty contest. Its goal is to handle real user traffic and process payments without catastrophic data leaks.

Messy component styling won't kill your startup. An unconfigured Row-Level Security (RLS) policy that leaks customer invoices to competitors will.

2. The three boundaries where AI code actually breaks

When I audit AI-coded and outsourced web applications, the issues are rarely in the core business logic. AI models write perfectly adequate React components and SQL queries.

Where I see them fail, again and again, is at the platform boundaries—the invisible plumbing between services:

Boundary A: Database Authorization (Supabase / Firebase RLS)

AI tools routinely filter data in the React frontend (.filter(item => item.userId === currentUser.id)), but leave PostgreSQL tables open to any authenticated user. In the browser, User A can open DevTools and fetch User B's entire account history via the Supabase REST API.

Boundary B: Asynchronous Billing Webhooks (Stripe / Paystack)

When a user subscribes, Stripe sends a webhook event. If your server does not return a successful response in time, Stripe retries. Without an idempotency guard table, your AI-generated handler processes the event twice, issuing double credits or duplicate subscription seats.

Boundary C: Migration Rollbacks and Backup Drills (Disaster Recovery)

AI tools will happily alter database tables, but rarely generate backward-compatible rollback migrations. If a deployment fails on launch day, you have no verified script to restore your staging or production state.

3. The 4-Way Decision Matrix

Before committing budget to a full rewrite, put your codebase through a structured Launch Review. You will receive a clear, plain-English decision based on facts, not developer opinions:

Decision table

A simple Go / No-Go test

SignalDecision
0 P0 risks, minor UI glitches or style inconsistenciesGO: Launch immediately. Clean up tech debt post-revenue.
1–3 P0 risks (missing RLS policies, webhook replay, unhandled env secrets)FIX FIRST: 48-hour patch sprint. Do not touch UI. Flip to GO.
Core database schema fundamentally violates domain model / data loss guaranteedPARTIAL REMODEL: Isolate DB schema and Edge functions; preserve frontend.
Product concept changed entirely during prototypingREBUILD: Only justified if the business workflow itself is completely different.

4. How to protect your runway

If someone tells you to rewrite your app, ask them three specific questions:

  1. "Can you point to the exact file and line number where data corruption or leaks will occur?"
  2. "Can we write a two-session test script to reproduce the vulnerability right now?"
  3. "Can this specific vulnerability be patched with a targeted database policy or middleware within 48 hours?"

If they cannot answer with line numbers and test cases, you may be buying billable hours rather than security.

More writing

Written by Jaeil Lee — independent reviewer of AI-built apps. About