Skip to content
Product Building

Should You Fix Your AI Prototype or Start Over?

When to harden your vibe-coded B2B app for production, and when to bin the code and start again.

A B2B operator reviewing lines of code and database structures on a dual-monitor setup at an industrial desk.
Shreyansh Doshi Founder, Samvara Published Reviewed Read 7 min

What You Need to Know

Harden your AI prototype if the database schema is sound and only missing basic security rules, error handling, or API key management. Rebuild from scratch if the core data model is tangled, logic is hardcoded, or the app handles complex multi-step B2B transactions that AI tools routinely mismanage.

At a Glance

Cost to Review
Starts at £199
Fix Signal
Clean relational database schema
Rebuild Signal
Hardcoded logic or flat databases
Best AI Output
Frontend UI and single-step forms
Worst AI Output
Multi-step transaction rollbacks

Best For

  • B2B founders who have built an internal tool using AI platforms like Lovable or Bolt.
  • Operations managers deciding whether to deploy a vibe-coded prototype to real clients.
  • Teams looking to scale a working prototype past its first 50 users.

Not For

  • ×Consumer app developers looking for UI or growth hacking tips.
  • ×Enterprise teams already working with internal engineering departments.
  • ×Founders looking for advice on pitching AI tools to venture capitalists.

Key Takeaways

  • AI coding assistants excel at user interfaces but frequently skip security, rate limiting, and error handling.
  • A clean, relational database schema is the clearest signal that an AI-generated app is worth hardening.
  • Flat, unsearchable database tables or hardcoded user logic mean the application must be rebuilt.
  • A £199 code review is the fastest way to check for exposed API keys and missing Row-Level Security.
  • A discarded AI prototype is not a waste; it is the most effective technical specification you can give a development team.

You spent the weekend prompting an AI coding tool to build a partner portal. It handles PDF uploads, maps the data to a dashboard, and looks like a finished piece of software. You deploy it to a handful of test users, and for a week, it works beautifully.

Then a user uploads a 10MB file, and the application crashes. Another user tries to reset their password, and the email never arrives. Worse, an exhibitor accidentally views a competitor’s pricing tier because the system lacks proper data segregation.

Now you face a classic software dilemma: do you pay a developer to patch the holes in your AI-generated code, or do you scrap the backend and build it properly from scratch?

The instinct is always to save the code. You feel you are 90% of the way to a finished product. But in B2B software, that final 10%—the error handling, data security, and scalability—takes the majority of the work. If your foundation is built on AI hallucinations and tangled logic, pushing through that final 10% might cost more than starting over.

The illusion of the 'nearly finished' prototype

To understand why this decision is so difficult, you have to look at what AI coding assistants actually do well. Tools like Lovable, Bolt, and Cursor are exceptionally good at generating user interfaces and writing 'happy path' logic. They assume the user always clicks the right button, the network never drops, and the data is always perfectly formatted.

If you want to understand what actually happens when you export code from Lovable and Bolt, you will find that these platforms skip the unglamorous parts of B2B software. They routinely omit rate limiting, ignore relational database constraints, and leave API keys exposed in the frontend code.

This creates a dangerous illusion for non-technical founders and operations managers. The app looks complete. It clicks like a complete app. But structurally, it is a cardboard film set.

Three signals your AI build is worth saving

Not every vibe-coded application needs tearing down. Many AI-generated apps are perfectly viable with a few days of targeted hardening. If your application matches the criteria below, keep the code.

1. The database schema makes logical sense

The clearest indicator of a salvageable app is a clean, relational database. If you look at your Supabase or Firebase backend and see logically separated tables—one for 'Users', one for 'Companies', one for 'Invoices'—with correct foreign key relationships linking them together, you have a solid foundation.

AI tools sometimes get this right on simple builds. If your data structure is clean, applying the missing security rules over the top is straightforward.

2. The feature set is strictly bounded

Apps that do one thing well are easier to fix. If your tool is a simple internal checklist for warehouse staff, or a single-page form for capturing trade show leads, the complexity ceiling is low.

There is no complex, multi-step transaction logic to untangle. If a lead capture tool fails, you lose a single form submission. You do not accidentally double-bill a wholesale client or write corrupt data into an inventory ledger.

3. The frontend components are isolated

If the AI wrote clean, modular frontend code—where the visual buttons are separated from the database logic—a developer can easily swap out the broken backend without touching the user interface. You keep the design you spent weeks tweaking, but connect it to secure, production-ready infrastructure.

Three signals you need to start over

There is a point where patching bad code becomes more expensive than writing good code. If you see these structural flaws, stop trying to fix the application.

1. The 'Spaghetti Backend' problem

AI tools optimise for immediate visual feedback. To make a feature work quickly, an AI will often flatten your database. Instead of creating a proper relational structure, it will create one massive table called 'Data' and stuff every piece of user information, order history, and preferences into a single, unsearchable text field.

When you try to query that data—for instance, asking the system to 'show me all orders from UK clients in the last 30 days'—the application will freeze. You cannot secure or scale a flat database. The only fix is a total rebuild.

2. Complex B2B transactions are failing

Simple data entry is one thing. Multi-step B2B transactions are entirely different.

Consider an application that handles customs clearance documents. When a user hits 'Submit', the system might need to generate a PDF, deduct a credit from the user's account, write an entry to an audit log, and ping an external government API.

If the network drops mid-transaction, what happens? Does the app refund the credit? Does it retry the API call? AI-generated code almost never includes 'rollback' logic. It will happily deduct the credit and fail to generate the document. If your app handles complex state changes and money, and the AI hallucinated the transaction logic, you must rebuild it.

3. Hardcoded logic disguised as dynamic features

AI assistants are notorious for faking functionality to make a prototype work. The app might look like it supports multiple user accounts, but under the hood, the AI has hardcoded user_id = 1 into every database query.

When you try to add a second user, everything breaks. Untangling hardcoded state from an application is painstaking work. It is usually faster for a developer to look at what the AI tried to do, delete the file, and write the logic correctly.

The £199 reality check

Before you make a permanent decision to either sink thousands into refactoring or bin the project entirely, you need an objective baseline. You need to know exactly what is broken.

This is why structural review and hardening starts at £199. A developer will look at your repository, examine your database structure, and run the basic security checks before your Lovable app hits production.

They are looking for three specific things:

  1. API Key Exposure: Are you leaking your live Stripe or OpenAI keys to the public web?
  2. Row-Level Security (RLS): Can any authenticated user read your entire database?
  3. Database Normalisation: Is the data structured in a way that can actually scale past 100 users?

If the review comes back clean—or only highlights missing security rules—you pay for a few days of hardening and launch your app. If the review reveals a hopelessly tangled database and hardcoded logic, you stop right there. You cap your losses at £199 and transition to a proper build.

Beating the sunk cost fallacy

Founders hate throwing away code. You might have spent three weeks writing prompts, adjusting colours, and testing user flows. Scrapping that feels like admitting defeat.

But treating an unscalable AI prototype as a loss is the wrong way to look at it. You have not wasted your time; you have built the ultimate requirements document.

Historically, commissioning custom B2B software meant spending a month writing a 40-page technical specification document. You had to guess how users would interact with the system. You had to try and explain your operational workflows to a business analyst who had never seen the inside of your warehouse.

Now, you can hand a development team a fully interactive, working prototype. You can say: "Look at this app. This is exactly how the onboarding flow should work. This is exactly what the dashboard should look like. But the backend is a mess. Build this, but make it secure, scalable, and ready for 5,000 users."

Using an AI prototype as an interactive wireframe dramatically accelerates the discovery phase of any product building project. The developers do not need to guess what you want. They just need to engineer it properly.

Map the transition

If you decide to rebuild, do not shut off the prototype immediately. Keep it running for a small, trusted group of internal users or friendly clients. Use it to gather actual user feedback.

Watch where they get stuck. Note which features they use daily and which they ignore.

By the time you commission the real build, you are not just handing over a prototype; you are handing over a validated prototype. You know exactly what to cut from the MVP scope because you have seen what real users actually care about.

Building B2B tools with AI accelerates your time to market, but only if you know when to treat the output as a final product and when to treat it as a first draft. Stop guessing about the structural integrity of your code. Get it reviewed, make a definitive choice, and move forward.

Quick Comparison

Criteria Harden the Code (Fix) Start Over (Rebuild)
Database Schema Properly separated, relational tables Single flat table or complex JSON dumps
Logic & State Clean, dynamic variables Hardcoded IDs and fake user states
Feature Complexity Simple CRUD (Create, Read, Update, Delete) Multi-step transactions (e.g. invoicing + stock)
Frontend Code Modular and separated from database queries Tangled directly with backend logic

Frequently Asked Questions

Can I use an AI-generated app for production B2B software?
Yes, but rarely without manual intervention. AI tools frequently omit critical security configurations like Row-Level Security (RLS) and environment variable management, which must be hardened by a developer before real client data is handled.
Why do AI coding tools build bad databases?
AI assistants optimise for immediate visual results. Setting up proper relational tables with foreign keys takes time and context, so the AI often takes shortcuts, dumping all data into a single, flat table just to make the prototype function.
What happens during a £199 code review?
A developer inspects the codebase for exposed API keys, checks the database for missing security policies, and evaluates whether the core schema is scalable or needs to be entirely rewritten.
Is it cheaper to fix or rebuild an app?
It depends entirely on the database structure. Fixing a structurally sound app is cheap. Untangling a poorly structured, hardcoded app costs significantly more in developer hours than simply rewriting the logic from scratch.

Bottom line

Do not sink thousands into patching a fundamentally broken data model. Book a structural review; if the database schema holds up, harden the existing code. If it is tangled, treat the prototype as an interactive wireframe and rebuild it properly from the ground up.

How Samvara researches this guide

We write for exhibition organisers and import/export operators in Australia, the UK, Europe, the US and India. Guides favour specific, verifiable operational advice over generic tips — grounded in systems we have shipped, client workflows, and current industry practice. We revisit articles as tooling and regulations change.

Written by

Shreyansh Doshi, Founder of Samvara

Shreyansh Doshi is the founder of Samvara Technologies, a product studio building operator software and SaaS products for exhibition, import/export, travel and fitness businesses in the UK and Australia. He writes about product delivery, operations systems, and where AI does and does not belong in a real workflow.

Keep Reading

Popular in Product Building

Guides readers open next