How do I connect Supabase to Lovable?
Last checked 31 Aug 2026
Short answer
In your Lovable project, open the Supabase integration and authorise Lovable to connect to an existing Supabase project (or create a new one), then Lovable can read and write to it the same way it does with Lovable Cloud.
When to do this instead of using Lovable Cloud
Connect your own Supabase project if you already have one with existing data/users, need direct Supabase dashboard access, or have infrastructure requirements Lovable Cloud doesn't fit. See when should I use Lovable Cloud if you're still deciding.
Steps
- In your Lovable project, find the Supabase integration option (or ask in chat).
- Authorise Lovable to access your Supabase account.
- Choose an existing project, or let Lovable help create a new one.
- Once connected, describe what you need built:
Connect this project to my existing Supabase project. Create a
customerstable matching the structure I already have for users.
Lovable can now generate tables, edge functions and auth flows against that Supabase project, the same way it would with Lovable Cloud — the difference is you retain full dashboard access to that Supabase project outside of Lovable too.
Migrating an existing schema
If you have existing tables, describe them precisely (column names, types, relationships) or export the schema so Lovable can match it exactly rather than guessing structure from a vague description.
What usually goes wrong
- Row-level security surprises: an existing Supabase project may have RLS policies (or the lack of them) that don't match what a Lovable-generated feature expects — review policies after connecting, especially on tables Lovable didn't create.
- Conflicting schema changes: if you or a teammate also edit the Supabase dashboard directly, changes can diverge from what Lovable expects — keep schema changes in one place where possible, or tell Lovable about dashboard edits so it stays in sync.
- Auth provider mismatches: if your existing project uses custom auth configuration (social providers, custom SMTP), confirm those still work as expected once Lovable is generating auth-related code against it.
For a non-trivial existing Supabase project, it's worth having PromptSites.com review the connection and RLS policies once, rather than discovering a security gap after launch.
Sources
Was this answer helpful?
Related questions
- AnswerHow do I back up my Lovable database?Lovable Cloud stores backups you can restore from directly in the Database screen; for extra safety, also ask Lovable to export your data periodically.
- AnswerHow do I safely store API keys?Store keys as secrets in your backend (Lovable Cloud/Supabase) and call the third-party API from a server/edge function — never put keys in front-end code.
- AnswerHow do I view my database data?Open the Cloud tab (or ask Lovable) to browse tables, edit rows and run SQL directly inside your project — no separate Supabase login needed.
- AnswerHow do I use environment variables?Use `VITE_`-prefixed variables only for non-sensitive, public values baked into the front-end build; use Secrets for anything sensitive that a server/edge function needs.