For SaaS founders, Nontechnical founders, AI SaaS founders, Agency owners · Intermediate · Commercial · Solves: App works in Lovable preview and fails after publish, Payments work in test mode only, Users can see other users data, No idea who owns the repo or the database
Key takeaways
- Vibe coding is a valid way to get an MVP in front of people. Production is a different job.
- Most Lovable apps fail at auth cookies, RLS, Stripe webhooks, and ownership, not at UI polish.
- Do not rewrite by default. Harden the parts that touch money, identity, and other people's data.
- Hire the person who can explain those four surfaces in plain English, not the person who promises a new stack.
Your Lovable app did not suddenly become a bad idea. It left a preview environment that was covering for it.
In the builder, you are usually signed in. The database request often carries a session. Stripe is in test mode. Secrets live where the platform put them. Then you publish, invite real users, flip live payments, and the product starts lying. The login loop. Empty dashboards. Checkout that charges a card and never unlocks the workspace.
That is not proof vibe coding is fake. It is proof that shipping an MVP and running production software are two different jobs. I am in favor of the first. I will not pretend the second is optional once money and other people's data show up.
I build product software in Next.js with Supabase and Sanity. I work independently through ZedNova Studios. I am not going to invent a Lovable rescue story. The failure modes below come from the platforms' own docs, plus one public incident that made the same mistake at scale.
Vibe coding is legitimate. Production is not automatic.
The goal of software is a useful product. Spending six months hunting bugs nobody has asked you to solve, so you can feel like a 'real' engineer, is how founders overbuild. Lovable, Bolt, v0, and Cursor are valid ways to get something in front of people fast.
The rule I use is simple. Ship fast enough to learn. The moment real users arrive, stop treating security, payments, and ownership as later. Later is how you leak a customer table.
Build quickly to validate. Harden aggressively the week the first stranger can log in.
Lovable's own security best practices say the same thing in vendor language: the frontend is always public, authentication decisions belong in Edge Functions, and RLS is the last line if the UI or the backend logic fails. If you shipped without reading that page, you shipped a demo with a custom domain.
What actually breaks first
1. Auth that only worked because you were already in the session
The classic pattern: it works in preview, then production returns empty data or a permission error after a hard refresh. The UI still thinks you are logged in because it read a token from localStorage. The server request that loads the dashboard did not attach the user, so auth.uid() is null and Postgres correctly refuses the row.
Lovable is explicit: client-side auth checks can be bypassed and should never enforce access. Validate the session in an Edge Function with supabase.auth.getUser(). On a Next.js host, that same idea is a request-scoped server client that reads the cookie, plus the production domain in Supabase Auth redirect URLs.
2. A database that is public because RLS was never the product
Lovable's Supabase integration docs say the quiet part: missing RLS policies are the most common way app data gets exposed. Supabase's own RLS guide is sharper. A table in an exposed schema without RLS is readable and writable by any role that still has a grant. Adding a pretty policy later does not revoke those grants.
This is why 'it works on my account' is a useless test. You need a second user. You need an anonymous request. If the second user can read the first user's invoices, you do not have a SaaS. You have a shared spreadsheet with a login screen.
3. Stripe that charged the card and never updated the product
Test mode hides the production webhook problem. In live mode, Stripe retries events, events arrive more than once, and the only safe handler is one that verifies the signature and processes each event id once. If your builder wrote 'on success, set plan = pro' in the browser, a user with DevTools can skip the invoice. If the webhook URL still points at localhost, checkout will succeed and entitlements will stay empty.
I will not quote a fake conversion rate. I will say this: payment state belongs in a signed webhook, stored against a workspace id you already trust, with a unique constraint on the Stripe event id. Anything less is hope.
4. Ownership that still sits in the builder account
Lovable can export and two-way sync to GitHub. It cannot import an existing repo. If the only copy of the app lives in a personal Lovable workspace, you do not own the product. Same for the Supabase org, the Stripe account, and the Vercel team. Put those under the company before you spend money on features.
Rewrite versus harden
| Situation | First move | Why |
| UI is ugly, users still complete the job | Harden, then polish | Looks are not the production risk |
| Login, roles, or data leaks | Harden auth and RLS this week | Identity and data access are the product |
| Stripe live, entitlements wrong | Harden webhooks and idempotency | Money state cannot live in the browser |
| Wrong object model, cannot express teams or billing | Targeted rewrite of the data layer | Policies cannot save a schema that lies |
| Agency wants to start over in a new stack | Ask which of the four surfaces they will own | A rewrite that skips RLS is the same incident with nicer files |
Most founders overbuild the rewrite. They are embarrassed that AI wrote the first version, so they pay for a ceremonial restart. If users already do the job, keep the product and fix the dangerous parts. If nobody cares yet, you do not have a production problem. You have a distribution problem.
If you are still deciding who should own a Next.js-shaped product after the export, read how to scope a real Next.js product build. Agency versus freelancer is the wrong first question. The scope is the question.
The production pass I would run
- Export to a company GitHub org and confirm you can open a pull request without the original builder login.
- Inventory secrets. Stripe secret, OpenAI key, and service role stay on the server. Publishable keys can live in VITE_ variables. Lovable documents that split clearly.
- List every table in an exposed schema. Enable RLS. Revoke leftover anon grants you do not intend. Write one allow and one deny test per operation.
- Walk the auth path on the production domain: sign up, magic link or OAuth, hard refresh, invite a second user, confirm isolation.
- Put Stripe in a staging clone first. Verify webhook signatures. Replay an event and confirm the workspace does not double-credit.
- Only then add the next feature. New tables inherit the same RLS and grant ritual.
If you leave Lovable Cloud for managed Supabase, Lovable's external hosting guide is honest: there is no one-click migration. You take backups, auth providers, redirect URLs, and incident response with you. That is fine. It is still cheaper than pretending Cloud will babysit a growing SaaS forever.
How to hire without getting a theatrical rewrite
Ask the candidate to do four things on a call, with your actual app if you can share a staging clone:
- Name the tables that should be private and how they would prove a second user cannot read them.
- Explain where the Stripe webhook lands, how they verify the signature, and what happens when Stripe sends the same event twice.
- Point at one secret that must never appear in the browser bundle, and one value that is allowed to.
- Tell you who should own GitHub, Supabase, Stripe, and hosting after week one.
If they cannot do that in plain English, they are not a production engineer. They are a prompt operator with a rate card. If they insist the only professional move is a greenfield Next.js app before they have looked at the schema, they are selling hours.
A strong independent operator can often beat a process-heavy agency here. Fewer handoffs. One person who will still be in the repo when the first live invoice fails at 11pm. That is the job clients actually buy.
What this means if you are the founder
You did not waste the last month. You bought a validated shape of the product for a fraction of a traditional build. The mistake is treating the builder as a production department.
If you have no users yet, keep shipping and talking to people. Do not spend a quarter 'making it enterprise.' If you have users, or you are about to take cards, the production layer is now the product. Auth, RLS, webhooks, ownership.
The same post-launch mindset applies to marketing sites. I wrote about why I build for the post-launch web. SaaS just has a sharper version of that decay: a pretty dashboard that leaks rows.
If you want a second set of eyes, send the live URL, whether Stripe is test or live, and who currently owns the Supabase project. I will tell you whether you need a harden pass, a data-model rewrite, or more distribution. I will not sell you a ceremonial restart because the first version came from a prompt.
Implementation table
| Fix | Problem | What to change | Metric | Tool |
|---|---|---|---|---|
| Auth on the live domain | Works in preview, 401 after publish | Attach the user session on every server request and add the production URL to auth redirects | Hard refresh stays signed in | Supabase Auth |
| RLS on every exposed table | Users can query other users rows | Enable RLS, revoke leftover grants, write allow and deny tests | Anon cannot read private rows | Supabase SQL + supabase test db |
| Live Stripe webhooks | Checkout succeeds, entitlements stay empty | Verify signatures, handle retries, process events idempotently | invoice.paid updates the right workspace | Stripe webhooks |
| Company-owned Git | Code lives only in a builder account | Export to the company GitHub org and document env vars | You can deploy without the builder login | GitHub + Vercel |
Sources & references
- Security best practices for Lovable appsLovable
Official guidance: frontend is public, auth and payments belong in Edge Functions, review RLS before publish.
- Connect to SupabaseLovable
Lovable states missing RLS policies are the most common way app data gets exposed.
- Secrets in LovableLovable
Backend secrets versus VITE_ browser-exposed values.
- Sync your Lovable project with GitHubLovable
Export and two-way sync. Import of existing repos is not supported.
- Deploying and hosting outside LovableLovable
What you take over when the backend leaves Lovable Cloud.
- Row Level SecuritySupabase
A table in an exposed schema without RLS is readable and writable by any role with a grant.
- Receive Stripe events with webhooksStripe
Signature verification, retries, and idempotent handlers.










