In one week, a client's coding agents added "around 10,000 lines of code" to a marketplace app its developer had spent a year building. The developer asked Hacker News what to do in April 2026. Most of the new features worked, and the client still wanted the developer on "the most critical parts of the application, DevOps and other parts" their agents couldn't handle.
One reply suggested working by pull request and approving every change. Another put the split in one line: "Basically treat yourself like an API that they consume."
Your situation is the client's side of that thread, except that you built the app in Lovable, Bolt or Replit yourself. It has users, your team wants to keep shipping by prompting, and you suspect the backend is shaky enough that the next prompt could break something you can't fix.
How it goes wrong
AI-written changes often look right and still fail. In Stack Overflow's 2025 survey, 66% of 31,476 respondents named "AI solutions that are almost right, but not quite" as their biggest frustration with AI tools, and 45% said debugging AI-generated code takes longer. Most of them can read the code.
In a survey of 200 US technology leaders, run by Hanover Research for New Relic (which sells production monitoring) and published in June 2026, 94% rated AI-generated code higher than human-written code at review. Yet 82% had suffered at least one major production failure caused by AI code in the previous six months, and 62% said their teams often or always ship it without line-by-line checks. These are self-reported answers from managers at upper mid-market and enterprise companies, which usually have more process than a team prompting straight to production.
In April 2026, an agent in Cursor working on a routine task in PocketOS's staging environment deleted the company's production database and its volume-level backups in one API call. It used a token it found in an unrelated file, created for managing custom domains but not limited to that. The data was eventually recovered.
Why prompts reach production
In a vibe-coding tool, the same chat box changes a button label and a database table. The tool can't tell "make the header blue" from "change who can read invoices", and by default nothing in the setup asks.
Lovable's docs show how short that path is.
When you accept a draft, changes to the database structure, storage settings and backend functions take effect in your live app before anyone publishes, and "Lovable doesn't take a backup of your database when it accepts a draft."
If the app runs on your own Supabase project, drafts share the live backend, so adding or deleting data in a draft changes it for your users.
Reverting a version restores code only. In the docs' words, "It does not restore or roll back your database data."
By default, editors and above can publish on every plan. Policies that require approval before publishing are Enterprise only.
So the only guardrail is the judgement of whoever types the prompt. For copy and layout, that's fine. For sign-in, access rules or payments, a change that looks fine in the preview can expose data or let people skip checkout.
Split who owns what
The thread's answer is to divide the app. Your team keeps prompting everything users see. One engineer, on staff or outside, owns the foundation underneath and exposes it like an API: a fixed set of tables, views and backend functions that the screens are allowed to call. Another commenter defined owning as "understanding the domain, working on new capabilities and handling fallout if anything goes wrong".
Area | Who changes it | Guardrail |
|---|---|---|
UI and copy | Your team, by prompt | Preview, teammate approves |
New pages and features | Your team, by prompt | Key-flow tests must pass |
Database schema | Foundation owner | Migration in a reviewed PR |
Access rules (RLS) | Foundation owner | Policy tests in CI |
Sign-in and payments | Foundation owner | Code-owner approval |
Deploys | Foundation owner | Only from main |
Write the boundary into the instructions your tool reads with every message. In Lovable that's Project settings, then Instructions: for example, "Changes under supabase/ (tables, access rules, edge functions) and the payment code go in their own pull request for the foundation owner to review. If a change needs a new table or column, say so before writing it." The tool will usually follow it, but an instruction can be ignored, so the guardrails below do the enforcing.
If nobody has secured the app yet, start with our two-week hardening plan and the pre-launch checklist.
Guardrails that enforce it
A protected main branch. In GitHub, protect main: require a pull request with one approval and passing status checks, and turn on "Do not allow bypassing the above settings", because admins skip the rules by default. In Lovable, use the branch picker to point the project at a working branch, and merge it into main through pull requests. If Lovable pushes to a protected branch, GitHub rejects it and Lovable moves the work to a branch called lovable-sync for you to review. On a private repository, protected branches and code owners need GitHub Pro or Team.
Code owners on critical paths. A CODEOWNERS file names who must review which paths, in lines such as "/supabase/ @your-engineer". List the foundation owner on /supabase/, the payment code, /.github/ (which holds CODEOWNERS and the CI workflows) and the test folders, so a prompt can't loosen the checks that block it. With "Require review from Code Owners" on, a pull request that touches those files can't merge without that person's approval. A teammate can approve a copy change; only the owner can approve a change to access rules.
A preview for every change. Hosts such as Vercel build a preview deployment for each pull request with its own URL, so you click through the change before it merges. Point the Preview environment variables at the development Supabase project, never the live one, and give CI a protection bypass secret so tests can open the preview. Supabase branching gives each Git branch its own database, empty by default, on paid plans only.
Tests on key flows. Write browser tests for sign-up, login, checkout and the app's main action, and run them against the preview on every pull request. Ask the foundation owner for database tests in supabase/tests that sign in as user B and fail if user A's rows come back (Supabase's pgTAP docs link to a guide on testing RLS policies). They run against a local copy with "supabase test db", so they never touch live data. Run the tests Lovable writes in CI too, and make the whole suite a required check.
Migrations and deploys only from main. First move the live site to a host that deploys from main, such as Vercel. Until the live domain has moved, any editor who presses Publish in Lovable changes what users see. Make sure supabase/migrations holds the live schema (the hardening plan shows how to pull it) and apply it to the development project. Then, in Lovable, open More, then Supabase, disconnect the live project and connect a development one. Lovable saves each schema change as a file under supabase/migrations, so it travels through the same pull request. On merge, Supabase's GitHub integration, set up on the live project, with "Deploy to production" on applies new migrations and deploys the edge functions listed in supabase/config.toml. Set new function secrets on the live project by hand, because they don't travel with the code. With branching on a paid plan, Supabase also recommends making its check required, so a failing migration blocks the merge.
Agent keys that can't touch production. Keep production keys out of the repository and out of every tool an agent can read. Give the development project its own keys, including Stripe test keys. If you connect an agent to Supabase through its MCP server, scope it to one project and use read-only mode; Supabase's advice is to connect to production "only when the task requires production evidence."
Practise one rollback before you need it. A developer in the same thread, joining a stuck project, gets the path from change to production working first, "together with practicing at least one rollback". A code revert leaves the data as it is, so include restoring a database backup into a new project (Free Supabase projects have none, so take one first).
What each tool lets you lock
Setup | Safe place to prompt | What still reaches live |
|---|---|---|
Replit | Development database | Schema changes on publish |
Lovable with your own Supabase | A development project | Only what merges to main |
Lovable Cloud | Draft with its own backend | Schema and functions on accept |
Replit already splits the two: its Agent can't modify the production database and only reads it. Schema changes still reach production when you publish. Publish asks for approval before changes that could remove data, so make the foundation owner the approver.
Lovable Cloud gives you no Supabase dashboard, SQL editor or direct database connection, so the migration and required-check route above isn't available there. Drafts with their own backend are the safest place to prompt, but accepting one changes the live schema with no backup. If your team prompts every day, a Supabase project of your own is what makes the full setup possible: tables you can migrate, and keys you control.
Where we fit
This is the role we take on for teams that want to keep prompting: we own sign-in, the data model, access rules, payments and deploys, review every pull request that touches them, and keep the tests and previews working. Your team keeps shipping screens and features the way it does now.

