SupabaseS
Supabase•4mo ago
jimalebob

Supabase Branches + Lovable Integration

Hey everyone 👋
I’m trying to set up two environments for my project with Supabase + Lovable:
I have main project in lovable and then i made a copy of it first one is main second one is for dev

Main (production) → should stay connected only to the Supabase main branch

Dev (development) → should stay connected only to the Supabase dev branch

The goal:
When I use Lovable in Dev, all schema changes, migrations, and function updates should go only to the dev branch. When I use Lovable in Prod, everything should stay only on main.

The problem:
No matter what I do, Lovable keeps resetting the env file back to the main branch API URL. That means even in Dev it’s writing to Main, which defeats the purpose of branching, i've changed the url and api key to match dev branch.

What I’ve tried so far:

Created a dev branch in Supabase Dashboard using branches via-dashboard.

Double-checked keys (anon & service role).

But Lovable still overwrites env with Main’s credentials.
Was this page helpful?