lovable
The playbook we use when founders call us with a broken Lovable app in production: the 6 ways they break, a 30-minute audit, and the fix patterns.
Your Lovable app shipped. It looked great on the preview. Now it is in production, a real user just signed up, and something is very wrong. Payments are failing silently. The page that was supposed to rank on Google is invisible to the bot. Your Supabase dashboard is lighting up with warnings you do not understand. Or worse, somebody already downloaded a CSV of your customers because RLS was never turned on.
This is the playbook we use when founders call us with a broken Lovable production app. It is the same sequence every time, because Lovable apps break in roughly the same six ways. None of this is a dig at Lovable as a tool. Prompt-based builders ship fast on purpose, and the tradeoff is that the things a senior engineer would catch in code review are easy to miss when you are iterating on features at prompt speed. The fix is almost never a rewrite. It is a triage, a patch list, and a few guardrails so the same problems do not come back the next time you ask Lovable to add a feature.
Read this end to end before you touch anything. The order matters. Fixing SEO before you fix RLS is how you get more traffic to a leaking database.
A Lovable rescue is a bounded engineering engagement to diagnose and fix a Lovable-built app that is broken, leaking data, or failing to rank — covering what Lovable shipped, what it left unfinished, and what to do next.
After running a lot of rescue engagements, almost every issue falls into one of six buckets. Each has a loud symptom, a quiet symptom, and a fix pattern. Work through them in this order.
Lovable scaffolds tables in Supabase but does not always enable Row Level Security, and when it does, the default policies are often wide open. The loud symptom is a Supabase advisor warning in the dashboard. The quiet symptom is nothing at all, until somebody with a network tab exfiltrates your profiles table via the anon key that ships in your bundle.
The bad version:
-- RLS disabled, anon key reads everything
alter table public.profiles disable row level security;
The correct version:
alter table public.profiles enable row level security;create policy "users read own profile" on public.profiles for select using (auth.uid() = user_id);
create policy "users update own profile" on public.profiles for update using (auth.uid() = user_id);
Fix direction: enable RLS on every public table, write explicit policies per operation, and run the Supabase advisor until it is clean.
Lovable can wire up Stripe Checkout in a few prompts. What it rarely gets right is webhook signature verification. The loud symptom is subscriptions that do not activate after payment. The quiet symptom is a webhook endpoint that will happily flip any user to paid if somebody POSTs the right JSON shape.
The bad version:
// Edge function trusts the body. Anyone can call this.
const event = await req.json();
if (event.type === "checkout.session.completed") {
await markUserPaid(event.data.object.customer_email);
}
The correct version:
const sig = req.headers.get("stripe-signature")!;
const body = await req.text();
const event = stripe.webhooks.constructEvent(
body, sig, Deno.env.get("STRIPE_WEBHOOK_SECRET")!
);
if (event.type === "checkout.session.completed") {
await markUserPaid(event.data.object.customer_email);
}
Fix direction: verify every webhook signature, store the Stripe event ID to make handlers idempotent, and reconcile against the Stripe API as the source of truth.
Lovable apps are client-rendered React. The HTML Google receives is a near-empty shell. Your content is injected by JavaScript after the bundle loads. Google can render JS, but it is slow, flaky on large apps, and AI crawlers like Perplexity and ChatGPT mostly do not render at all. The loud symptom is zero impressions in Search Console weeks after launch. The quiet symptom is ranking for your brand name and absolutely nothing else.
Fix direction: either put a bot-detecting edge worker in front that serves prerendered HTML to crawlers, or migrate the public pages to SSR. Both routes are covered in SEO for Lovable apps.
You fix something by hand. You ask Lovable for a new feature. Lovable regenerates the file and your fix is gone. This is the single most demoralising failure mode, because it silently reintroduces bugs you already solved. The loud symptom is "why is this bug back". The quiet symptom is a drifting codebase where nobody can tell which changes were made by humans and which by prompts.
Fix direction: isolate hand-written code into clearly named files that Lovable does not touch (utils, hooks, edge functions). Keep a short list of "protected" paths. For anything non-trivial, plan a migration to a framework where you fully own the source. See AppHandoff: Lovable to Next.js.
any debtMost Lovable scaffolds ship with strict: false and noImplicitAny: false. The loud symptom is runtime crashes from undefined that should have been caught at build. The quiet symptom is nothing for a week, then a feature refactor that breaks ten unrelated screens because types were never enforced.
// tsconfig.json — fix this
{
"compilerOptions": {
"strict": true,
"noUncheckedIndexedAccess": true,
"noImplicitAny": true
}
}
Fix direction: flip strict on, fix the fallout file by file, generate types from Supabase with supabase gen types typescript, and ban any in PR review.
Lovable hosting is convenient until it is the only thing between your customers and downtime. No staging, no rollback, no CI. The loud symptom is a failed deploy with no way to revert. The quiet symptom is knowing you are one prompt away from a white screen in production and having no plan B.
Fix direction: export the repo to GitHub, wire CI on every push, configure Vercel or Cloudflare Pages as a parallel deploy target, and keep the Lovable deploy as the fallback until the new pipeline is green for two weeks.
Before you fix anything, run the full audit. You want the complete damage list in front of you, not a whack-a-mole session.
supabase inspect db plus a manual review of pg_policies. Any public table without at least one policy per operation is a finding.constructEvent. If it is not there, the webhook is unsigned.pagespeed.web.dev. Confirms Lighthouse with CrUX field data. Field-data LCP over 4s is the threshold I treat as broken.curl -A "Googlebot" https://yourapp.com/. If the HTML body is empty, your SEO fix list just got longer.npm run build and inspect dist/. Any single JS chunk over 500KB gzipped is a problem.git log --stat on the default branch. Large, unexplained diffs on src/integrations/* or src/hooks/* usually mean Lovable overwrote hand edits.dist/ for sk_ and service_role.Thirty minutes. Write the findings down with severity. You now have a rescue plan.
RLS: enable on every public table, write select, insert, update, delete policies scoped to auth.uid(), test with the anon key from an incognito tab, confirm the advisor is clean.
Stripe: move signature verification to the top of the handler, store processed event IDs in a dedupe table, reconcile subscription state nightly against Stripe as the source of truth, never trust client-side price IDs.
SEO: ship a Cloudflare Worker in front of the app that detects bot user-agents and serves prerendered HTML. Add per-route <title>, meta description, canonical, and JSON-LD. Generate a static sitemap at build. Full pattern in SEO for Lovable apps and technical SEO.
Custom code preservation: isolate hand-written modules, document protected paths in a LOVABLE.md at the repo root, and plan an AppHandoff export so the Lovable regeneration risk goes to zero.
TypeScript debt: flip strict on in a branch, fix the worst offenders, generate Supabase types, merge in passes of 20 to 50 files.
Lock-in: export to GitHub, wire CI, add a second deploy target, run both in parallel until the new one is proven.
Rescue if less than half the codebase is broken, the fix list is bounded, the data model is sound, and you have timeline pressure. Rescues are usually one to three weeks of focused work. A senior AI developer experienced in Lovable codebases can move through the triage checklist above in a day.
Rewrite if the data model is fundamentally wrong, auth was bolted on in a way that cannot be untangled, the team is changing and nobody understands the generated code, or you need SSR and full framework control. In that case, exporting to Next.js via AppHandoff is often cheaper than patching. Also consider the guide on how to hire a Lovable developer before committing to either path. If you are unsure which path is right, a fractional CTO can give you a two-hour architecture review before you commit budget to either route.
Senior Lovable rescue work in the UK and EU sits between GBP 800 and GBP 1,200 per day depending on depth and on-call requirements. A typical rescue scope looks like: 1 to 2 days for the audit and triage, 3 to 7 days for the critical fixes (RLS, Stripe, SEO edge worker), and 3 to 5 days for the longer-tail work (TypeScript strict, CI, lock-in reduction). Call it GBP 6k to GBP 15k for a full rescue of a production app with real revenue on it.
A full rewrite via AppHandoff to Next.js runs larger: 2 to 6 weeks of engineering depending on feature surface. The rule of thumb we use: if the rescue estimate is more than 60 percent of the rewrite estimate, rewrite. You stop paying the same fix cost every time Lovable regenerates a file.
Almost certainly yes. The failure modes are predictable and well-understood: RLS off, unsigned webhooks, client-rendered SEO, custom code overwritten on re-runs. If your data model is sound and the feature surface is bounded, rescue is faster than rewrite in the majority of cases. The 30-minute audit above will tell you definitively.
A typical rescue runs one to three weeks. Day one to two covers the audit and triage; days three to seven cover the critical fixes (RLS, Stripe, SEO edge worker); the remainder handles TypeScript hardening, CI wiring, and lock-in reduction. Scope creep is the main variable — a clean, bounded fix list keeps it at the short end.
Yes, if your custom code lives in files Lovable regenerates. The fix is to isolate hand-written modules into clearly named paths that Lovable does not touch, document a short protected-paths list in a LOVABLE.md at the repo root, and consider an AppHandoff export for any code you cannot afford to lose. After a rescue, this guardrail is non-negotiable.
If rescue cost is less than 60 percent of the migration estimate, rescue first. If you are post-PMF, SEO is a real growth lever, and you are tired of the regeneration risk, migration pays off. The full migration playbook is in AppHandoff: Lovable to Next.js — read it before deciding either way.
If your Lovable app is on fire and you want a second pair of eyes, start with the Lovable rescue service page or contact us directly. Send the repo, the Supabase project ref, and a one-paragraph description of the loud symptom. We reply the same working day with a triage summary and a fixed-scope proposal. No retainer required, no long contract. Just get the thing stable and shipping again.
// keep reading
lovable · 4 min
A production guide for porting Lovable-built app slices into a Next.js monorepo with SSR safety, schema contracts, and SEO guardrails.
lovable · 10 min
Decision framework for choosing between a Lovable agency and a freelance Lovable expert, with honest rate comparisons and failure modes.