← Back to Blog
ENGINEERINGJuly 28, 202512 min read

How to Take a Vibe-Coded App to Production

AI coding tools let you ship a working prototype in hours. Getting that prototype to a production-grade system that can handle real users, real data, and real edge cases is a different problem entirely.

The vibe-coding gap

Tools like Lovable, Bolt, Cursor, v0, and Replit have compressed the time to a working prototype from weeks to hours. A non-technical founder can describe a product and have something clickable and deployed by end of day. That is genuinely remarkable — and it has permanently changed what "building an MVP" means.

But a prototype is not a product. The gap between "this works in a demo" and "this handles 500 concurrent users without losing data" is where most AI-generated codebases quietly fall apart — not in a visible crash, but in a slow accumulation of correctness failures, security gaps, and architectural debt that compounds until the whole thing needs to be rebuilt.

This guide covers the specific steps you need to take to move an AI-generated prototype into production safely.

Step 1: Audit the architecture before touching a line of code

Before you make any changes, read the entire codebase at a high level. AI tools generate code that works locally but makes structural choices that are expensive at scale: everything in one file, no separation of concerns, API keys hardcoded in client-side components, business logic in UI layers, no input sanitisation.

Document what you have before you start changing things. The things to look for:

Write this down. You will make better prioritisation decisions with a written inventory than by trying to hold everything in your head while coding.

Step 2: Fix secrets and authentication first — always

This is non-negotiable before anything goes to a real production environment. AI tools frequently hardcode API keys in components, leave service role keys in client-side code, or implement authentication that has no actual authorisation layer (the user is "logged in" but nothing actually checks whether they have permission to do what they are doing).

Specifically:

Step 3: Add error boundaries and observability

AI-generated code handles the happy path well. It almost never handles failures gracefully. In production, failures happen constantly: network timeouts, third-party API rate limits, malformed user input, race conditions on concurrent updates. Without proper error handling, your users see blank screens, broken states, or silent data corruption.

The minimum you need before launch:

Step 4: Refactor the data layer

The data layer is where most AI-generated apps have the most structural problems. Common patterns that need to be addressed:

N+1 queries. If you fetch a list of items and then fetch related data for each item in a loop, you are making one database query per item. For 10 items that is fine. For 500 it kills your database. Replace with joins or batch queries.

Missing indexes. AI tools create schemas that are correct but not optimised. If you are querying by a field regularly — user ID on a posts table, for example — that field needs an index or your queries will do a full table scan on every request.

No pagination. Fetching all records from a table without limits means a single API call fetches your entire dataset as your product grows. Implement cursor-based or offset pagination on any endpoint that returns lists.

Cascading deletes and referential integrity. AI tools often skip foreign key constraints and cascade rules in database schemas. Check that deleting a user does not leave orphaned records that reference them.

Step 5: Harden the API surface

Every API endpoint is a surface for abuse. Before you have real users, you also have attackers probing for weaknesses. At minimum:

Step 6: Set up a real deployment pipeline

Vibe-coded apps are often deployed by clicking "deploy" in a browser UI and sharing the link. That is fine for a prototype. For production you need:

Step 7: Know what to keep and what to rebuild

Not every part of an AI-generated codebase needs to be rewritten. The UI layer — components, layouts, styles — is often the most faithful part, because AI tools are very good at translating visual descriptions into working React components. Business logic and data layer code is where the structural problems concentrate.

A useful heuristic: if the code is purely presentational and the correctness is obvious from reading it, keep it. If the code makes decisions, stores data, enforces rules, or interacts with external services, audit it carefully and rewrite the parts that do not hold up.

The goal is not a clean codebase for its own sake. The goal is a system that handles failure gracefully, scales under load, keeps user data safe, and can be maintained by a human engineer without needing to understand how the AI thought about the problem.

How long does this take?

For a typical Lovable or Bolt prototype — a single product with a database, authentication, and a handful of core features — the productionisation work takes between 4 and 10 weeks with one or two experienced engineers. That sounds like a lot relative to the hours it took to build the prototype, but it is fast relative to building the same system from scratch.

The alternative — shipping the prototype directly and fixing problems as they appear in production — is almost always slower and more expensive. Security incidents, data loss events, and reliability failures all take significant time to recover from, and they happen at the worst possible moment: when you are trying to grow.

Vibe coding is a legitimate and powerful tool for founders. The fastest path to a production product is often: vibe code the prototype, then bring in engineers to harden it. Not rebuild from scratch — harden what you have.

WRITTEN BY
JavaScript Instruments
Product development studio in New York. We rebuild, rearchitect, and productionise SaaS and mobile applications for founders.

Have a vibe-coded app that needs to go to production?

We do this regularly. Book a product audit and we will tell you exactly what the path from your prototype to production looks like.

Book a Product Audit →