To take a vibe-coded prototype to production, you almost always need to add six pieces: proven authentication, a tested database restore, usable logs, versioned migrations, a CI pipeline that runs the app, and a rollback you have already rehearsed. Each one can be checked with a test that passes or fails.
The most common trap is assuming that going back to the previous version of the code also puts the database back where it was. Vercel's rollback documentation says so plainly: databases and external APIs do not follow.
01What a prototype proves, and what it doesn't
A prototype answers one question: does anyone want this? Production asks different ones. What happens when a user deletes their data by mistake, when a migration breaks a column, when Friday evening's deploy starts returning errors? AI is very good at the first question, because a working screen needs little context. The others require knowing what already exists, what must not break and how to go back.
A heavily upvoted r/ClaudeAI thread captures the split well. On one side, experienced engineers argue that the UI is the easy part and the real cost sits in maintenance, security and edge cases. On the other, people point out that most apps will never need huge scale, and an internal tool or a first version doesn't have to be built like a tech giant. Both are right: the question isn't scale, it's whether you can repair things.
That's why this article doesn't cover performance or scaling. It lists what separates a demo from a service customers rely on, and points to detailed guides for each piece. Security already has its own list in the vibe coding security checklist: run it before this one, because it blocks launch.
02The six pieces and their tests
Judge each piece by a concrete test, not by how the code looks. If you can't run the test, treat the piece as missing.
1. Authentication you didn't write yourself
A prototype often has a login that works and nothing around it: no password reset, no email verification, no account deletion, sessions that never expire. The recommendation is simple: use a maintained authentication solution rather than generated code, and test the flows nobody looks at in a demo. The options and the Next.js-specific pitfalls are covered in authentication in a Next.js app.
2. A backup you have already restored
A backup you've never restored is a guess. First check what your host actually does. On Supabase, for example, automatic daily backups cover the Pro, Team and Enterprise plans, with 7 days of history on Pro, and the docs advise free projects to export their own data and keep it elsewhere. The same page notes that the project is inaccessible while a restore runs: better to find that out in staging.
The test that matters is a full restore into an empty database. With PostgreSQL, pg_dump in custom format produces an archive that pg_restore reads back, and the --no-owner option avoids role errors when the target database doesn't have the same users.
Replace users with a table that matters to you. Time the whole thing: that's your real recovery time, not the one you imagine. The full strategy, with rotation and off-site storage, is in backups that actually work.
3. Logs someone actually reads
Without logs, the first sign of an outage is a user's message. The Twelve-Factor App principle is still the right starting point: the app writes its events to standard output, and the runtime collects them and ships them to a tool where you can search and set alerts. Add two things generated code often forgets: a request ID on every line, and no personal data or secrets in messages.
The test: trigger an error in staging, find it in the logs in under a minute, and check that an alert fires. Tools and thresholds are covered in monitoring: logs, alerts, uptime.
4. Migrations in the repo, never by hand
The classic prototype symptom: the database schema was changed in the host's dashboard, or by the agent directly on production. Nobody can rebuild the database or tell what changed. Every schema change should be a versioned migration file, reviewed, applied by CI and never edited afterwards.
Review destructive migrations above all. Prisma's documentation is blunt about it: its apply command runs destructive operations without asking for confirmation, so review is the moment to catch them. To rename or drop a column without breaking the live version, split the change into three steps, what Martin Fowler calls expand and contract: add the new thing, migrate code and data, then remove the old one.
This split is what makes a code rollback possible: as long as the old column exists, the old version of the app still works.
5. A CI that runs the app before a human approves
Reading a generated diff isn't enough. In an r/devops thread on the operational debt of AI code, several people argue for a simple rule: nothing reaches a higher environment without being tested, and the pipeline should run the built artifact rather than just read text. The original poster adds that they have no dedicated infra team, which is true of most small teams: CI has to play that role. These are personal accounts, but the logic holds.
The minimum: on every pull request, install dependencies from the lockfile, build, run the tests. The GitHub Actions docs recommend npm ci over npm install, because it installs exactly the versions in the lockfile.
Make this check required before merge in the repository settings, or it stays decorative. Then add a test that calls the app deployed to staging, for example a health route that queries the database. If you're on GitLab, the same logic is in using GitLab CI/CD well.
6. A rollback you have already done
Rehearse the rollback before you need it. On Vercel, Instant Rollback puts a previous deployment back live, but the same page lists three limits worth knowing: environment variables are not updated, external databases and APIs don't roll back, and automatic assignment of the production domain is turned off after the rollback, so new pushes won't go live until you re-enable it. It also notes that on the Hobby plan, only the immediately previous deployment is available.
Hence the rule: a code rollback is only safe if that deploy's migration was additive, as in piece 4. Do the exercise once in staging, time it, and write the procedure in five lines in the README. How to make every release predictable is covered in make a deployment boring.
03Where to start
The pieces don't weigh the same depending on what your app stores. This decision table gives the order, most urgent first.
04Rules that apply in every case
Secrets live neither in code nor in git history: the steps are in handling secrets properly. And staging should look like production: the Twelve-Factor App recommends using the same backing services, such as database and queue, in every environment rather than a lightweight database locally and another in production.
Finally, keep the agent in its lane. It can write tests, migrations and CI, but it should not have write access to the production database. The most common workflow mistakes with a coding agent are described in the common mistakes with Claude Code.
These six pieces say nothing about handling load or meeting a regulation. They are what let you see a problem, roll back and recover your data. That's the minimum before customers depend on it.
05FAQ
Should I rewrite the prototype before production?
Rarely. The six pieces wrap around the existing code: most are configuration, tests and procedures, not rewrites. Rewriting becomes a real question when nobody understands the code anymore or every change breaks something else; the reasoning is in rewrite vs refactor.
Aren't my host's backups enough?
They're a good start, as long as you know what they cover. On Supabase, daily backups don't apply to the free plan, and a daily backup can still lose up to a day of data, which is why point-in-time recovery exists as a paid option. Either way, keep a copy outside your host and test the restore.
Can I ask the AI to set all this up?
Yes for writing the CI, the migrations, the backup scripts and the rollback procedure. No for signing off: you run the restore, trigger the error and do the rollback, and you look at the real result. A generated file describing a procedure doesn't prove the procedure works.
How long does it take?
It mostly depends on the state of the prototype and its hosting. An honest way to estimate: run the six tests from the table, count the failures, and fix them in the order of the decision table. If you want an outside view of what's missing, that's the starting point of a technical audit.
06Sources
Start with the tested restore and the rehearsed rollback: they are what turn an incident into a bad hour instead of a bad week. Add the rest one piece at a time, each with its own test.
Talk about your project ↗