afterbuild/ops
§ CS-10/fintech-mvp-rescued-from-lovable
Fintech (SMB accounting) · Lovable · Deploy-to-Production Pass

Lovable fintech MVP rescue — from broken auth to $12k MRR in 19 days

Lovable fintech MVP rescue: Ledgerlark, a two-person reconciliation-tools team for indie accountants, shipped a Lovable MVP with RLS off, OAuth pointed at localhost, and a Stripe webhook dropping half its checkouts — 47 paying pilots signed up, not a dollar collectable, client tax data exposed. Afterbuild Labs's Deploy-to-Production Pass closed 18 pgTAP-verified RLS policies, fixed auth, made payments idempotent, and shipped a staging environment in 19 days. Three weeks later: $12,000 MRR, zero data-leak incidents, and a clean response to the SOC 2 questionnaire their second-largest pilot had just sent over.

updated April 10, 2026/9 min read/by Hyder Shah/client · Ledgerlark (name changed)
§ CS-10.1/headline-numbers
18 (pgTAP-verified)
RLS policies
from 0
99.9% (idempotent + retried)
Stripe webhook success rate
from ~52% (silent drops)
98%
OAuth sign-in success (pilot)
from 36%
85 ms (4 covering indexes)
Avg DB response (dashboard)
from 1,240 ms (unindexed)
§ CS-10.2/client-context

About Fintech (SMB accounting) client

Ledgerlark (name changed) is a fintech (smb accounting) team at the seed, pre-revenue → paid pilot with 47 accountants stage. They built their product with Lovable and shipped it to pilot users before discovering that the generated scaffolding masked a set of production-grade failures. The engagement that followed was scoped as Deploy-to-Production Pass ($1,999 fixed fee).

Stack before
LovableSupabase (RLS off)Stripe (test mode)Lovable preview domain
Stack after
LovableSupabase (18 RLS policies)Stripe (live, idempotent)VercelResendSentry
§ CS-10.3/day-zero-autopsy

Audit findings on day zero

What the first production-readiness pass uncovered before a single line of code was changed. Each finding is a specific Lovablefailure mode we’ve seen repeat across engagements.

  1. F01

    Row-level security disabled on every table

    Any authenticated Supabase client could read every other tenant's transactions, plus the unauthenticated anon key — which ships in the public JavaScript bundle by design — could read every reconciliation, every uploaded bank statement, and the email of every accountant on the platform. The founder's words: "the entire database was accessible to anyone with the public Supabase API key." This is the pattern captured by the widely-reported February 2026 Lovable/Supabase RLS disclosure. We confirmed exposure with a 30-second curl request before writing the first policy.

  2. F02

    OAuth callback pointed at localhost:3000

    The Google sign-in button worked in Lovable's preview and nowhere else. Every pilot user hit a redirect_uri_mismatch on their first login. Two of them churned before the founder could email them a workaround. The Lovable preview had been silently overriding the redirect URI to its own subdomain; the moment the app was deployed to a real domain, every callback returned to a localhost URL nobody could reach. The founder didn't even know the OAuth provider supports a redirect URI allowlist; the Lovable chat interface had never asked for production URLs.

  3. F03

    Stripe webhook dropping ~50% of checkouts

    The endpoint returned 200 on receipt but didn't verify signatures and didn't handle retries. When Stripe retried events, the handler double-charged one pilot and silently lost three paid upgrades. The founder only noticed during manual reconciliation a week after the fact. The webhook handler also acted on the request body before checking the Stripe-Signature header, which meant any attacker who guessed the URL could POST a forged checkout.session.completed event and instantly upgrade their own account to a paid plan with no card on file. Trivially exploitable. Nobody had tested it.

  4. F04

    No migration history

    All schema changes had been made by clicking through the Supabase dashboard. There was no way to stand up a staging environment or reproduce production bugs locally. When we asked the founder to walk us through a recent change, the answer was "I think I added a column on Tuesday but I'm not sure which table." Without migrations there is no audit trail, no rollback, and no way for a second engineer to onboard. Every fix the founder shipped was permanent, irreversible, and undocumented.

  5. F05

    Deploy broke outside the Lovable preview

    Env vars weren't wired for Vercel, build scripts assumed Lovable's Node version, and edge functions referenced secrets that didn't exist in the target environment. The first attempt to deploy outside Lovable produced a build that compiled but immediately 500'd on the home page because three required environment variables were undefined and the app crashed at startup rather than failing gracefully with a clear error.

§ CS-10.4/root-cause-analysis

Root cause of the Lovable failure mode

The root cause wasn't any single bug — it was that Lovable had generated a working demo, and the founder had treated the demo as a product. The preview environment silently filled in for the missing pieces: it injected a service-role key that bypassed RLS, it rewrote OAuth redirects on the fly, it sandboxed Stripe to a test mode that never retried, and it auto-provisioned env vars the founder never saw. The moment the app left that environment, every shortcut became a production incident. The causal chain: generated-code convenience → invisible preview scaffolding → zero verification of the real production path → user data exposure and lost revenue. Every fix below is about making what was implicit in Lovable's preview explicit in the client's real infrastructure. The fintech context made the stakes worse — the data Lovable was leaking included bank account numbers, transaction descriptions, and IRS-relevant categorisations. Under FinCEN and several state-level financial-data regulations, the disclosure obligations alone would have ended the company before the first lawsuit. The remediation order was therefore: stop the bleed (RLS), make payments trustworthy (Stripe), restore the user funnel (OAuth and email), then build the infrastructure to keep all three honest going forward (migrations, staging, monitoring).

§ CS-10.5/remediation

How we fixed the Lovable rescue stack

Each step below is one remediation workstream from the engagement. In cases where the underlying data includes before/after code vignettes, those render inline; otherwise we describe the change in prose.

  1. 01

    Exported the Supabase schema into a git-tracked migrations folder (Supabase CLI) and added a staging project with the same migrations applied. No more dashboard clicks; every change is now a reviewable migration.

  2. 02

    Wrote 18 RLS policies covering every read and write path, plus a Postgres test suite (pgTAP) that fails CI if a policy is missing or too permissive. Verified with a red-team script that attempts cross-tenant reads.

  3. 03

    Rebuilt the OAuth flow with environment-specific redirect URIs (pulled from NEXT_PUBLIC_SITE_URL), added email verification, and wired password reset via Resend with domain authentication and SPF/DKIM/DMARC.

  4. 04

    Made the Stripe webhook idempotent: signature verification, an events table with a unique constraint on event.id, explicit handling for checkout.session.completed, invoice.payment_failed, and customer.subscription.updated. Added dead-letter logging to Sentry.

  5. 05

    Moved the deploy to Vercel with environment variables split across preview/production, a staging branch tied to the staging Supabase project, and a rollback runbook the founder can execute alone.

  6. 06

    Added Sentry error tracking, PostHog product analytics, and a daily cron that reconciles Stripe charges against internal records — the check that caught the original double-charge.

  7. 07

    Wrote a 6-page handoff doc: architecture diagram, env var reference, incident runbook, and a prioritised backlog of follow-ups (all flagged at a severity level the founder can triage alone).

  8. 08

    Built a SOC 2 evidence pack covering RLS policy definitions, audit log retention configuration, env var rotation cadence, and a one-page narrative explaining the data isolation model — small enough to send to a pilot's compliance team in a single email, structured enough to reuse in the next 30 questionnaires the founder will inevitably receive.

  9. 09

    Replaced the Lovable preview banner with a clear production environment indicator and added a hard env check at app startup that refuses to boot if any of the 14 required production secrets is missing or matches a known test value. Future deploys can no longer accidentally ship with a sk_test or a localhost URL in a critical place.

§ CS-10.6/founder-quote
Sample client perspective — composite, not an individual testimonial
We thought we had a product. What we had was a very convincing demo. Afterbuild Labs found the things Lovable silently papered over and made them real. Three weeks later we took our first real payment.
Maya Okonjo· Co-founder, Ledgerlark
§ CS-10.7/outcome-delta

Outcome after the rescued rescue

Every metric below was measured directly — RLS coverage via pgTAP, webhook success via Stripe dashboards, response times via production APM, MRR via Stripe billing.

Before / after — Fintech (SMB accounting)
MetricBeforeAfter
RLS policies018 (pgTAP-verified)
Stripe webhook success rate~52% (silent drops)99.9% (idempotent + retried)
OAuth sign-in success (pilot)36%98%
Avg DB response (dashboard)1,240 ms (unindexed)85 ms (4 covering indexes)
Tenants with data-leak exposureAll 47 pilots0
Time from rescue kick-off to prod launch19 days
MRR 30 days post-launch$0$12,000
User-reported bugs per week91
§ CS-10.8/engineer-note
Engineer retrospective — technical lesson
We'd run the red-team RLS script on day one, not day four. We spent three days refactoring policies before we noticed two of the tables weren't actually in the app's schema — they were Lovable demo fixtures still being hit by the frontend. A two-hour anonymous-curl audit at the start would have surfaced the live versus dead tables and let us scope the policy work more precisely.
Hyder Shah· Founder, Afterbuild Labs
§ CS-10.9/replicate-this-rescue

How to replicate this Lovable rescue

The same engagement path runs across every fintech (smb accounting) rescue we take on. Start with the diagnostic, then route into the service tier that matches the breakage surface.

§ CS-10.10/related-rescues

Similar fintech (smb accounting) rescues

Browse the full archive of Lovable and adjacent AI-builder rescue write-ups.

§ CS-10.11/industry-deep-dive

Related industry deep-dive

vertical · fintech (smb accounting)
Read more fintech rescue patterns

RLS gaps, dropped Stripe webhooks, and FinCEN-adjacent data exposure are the recurring fintech failure modes behind this rescue. The vertical page walks the full fintech production-readiness checklist — auth isolation, idempotent payments, audit trails, SOC 2 evidence — in the order we apply it on every engagement.

Next step

Got a broken Lovable app that looks like this one?

Send the repo. We'll tell you what it takes to ship — in 48 hours, fixed fee. Free diagnostic, no obligation.

Book free diagnostic →