S8.11
Database and Auth for Vibe Coded Apps: The Supabase Guide
The short answer
TL;DR
- →Supabase handles auth, database and storage for vibe coded apps in one platform
- →Lovable connects to Supabase automatically, so setup is mostly handled for you
- →The part you must do yourself is row-level security policies for every user-data table
- →Test auth end-to-end with two separate accounts before showing the app to anyone
- →Supabase's free tier covers up to 50,000 monthly active users, which is plenty to start
Why Supabase Is the Standard for Vibe Coded Apps
Supabase combines a Postgres database, user authentication, file storage and a real-time API in one platform. For vibe coded apps, it is the default choice because Lovable integrates it automatically. You do not have to set up a server, write database migrations manually or configure an auth flow from scratch.
Here is how to use it correctly.
This sits inside the vibe coding hub.
Step-by-Step: Setting Up Supabase in a Vibe Coded App
If you are using Lovable:
- Build your app to the point where you need to store data.
- Lovable will prompt you to connect a Supabase project. Accept.
- It creates the project, sets up the tables it needs and connects the API keys automatically.
- You now have a live database. No manual setup required.
If you are using Cursor or Claude Code:
- Create a Supabase project at supabase.com.
- Copy the project URL and anon key from the Settings panel.
- Add them to your
.envfile asVITE_SUPABASE_URLandVITE_SUPABASE_ANON_KEY. - Install the Supabase client:
npm install @supabase/supabase-js. - Ask the AI to create a Supabase client file and use it for all database calls.
How Do You Set Up Auth Correctly?
Supabase Auth handles email/password login, magic links and OAuth providers like Google. Lovable adds auth when you ask for it. Cursor and Claude Code can wire it up with a prompt.
The critical step after auth is set up: test it manually.
- Create Account A with a real email address.
- Create some data while logged in as Account A.
- Log out completely.
- Create Account B with a different email.
- Log in as Account B.
- Try to access Account A's data by navigating to its URL directly.
If Account B can see Account A's data, your row-level security is not set up. That is the most common and most serious gap in vibe coded apps.
How Do You Configure Row-Level Security?
Row-level security lives in Supabase, not in your app code. Here is how to add it:
- Open your Supabase project dashboard.
- Go to Table Editor. Select a table that stores user data.
- Enable RLS using the toggle at the top of the table.
- Go to Authentication > Policies.
- Add a policy for SELECT:
auth.uid() = user_id. This means a user can only read rows where theuser_idcolumn matches their own user ID. - Add similar policies for INSERT, UPDATE and DELETE.
Ask Lovable or Claude Code: "Add row-level security to every table that stores user data." Then go into the Supabase dashboard and verify the policies were created correctly.
What About File Storage?
Supabase Storage handles file uploads. The same RLS logic applies. Make sure storage bucket policies are set so users can only access their own files.
For apps where users upload documents, images or exports, this is non-negotiable. An open storage bucket means any authenticated user can access any file.
What Does Supabase Cost at Scale?
| Tier | Price | Limits |
|---|---|---|
| Free | $0/mo | 50k MAU, 500MB DB, 1GB storage |
| Pro | $25/mo | 100k MAU, 8GB DB, 100GB storage |
| Team | $599/mo | Custom limits, SLA |
For a new product, the free tier is enough. Move to Pro when you are approaching limits or when you need daily backups and priority support.
The vibe coding security guide covers the full security checklist beyond just database configuration.
If you want the whole stack set up correctly from the start, Devwiz handles database architecture as part of every build.
Frequently Asked Questions
- Is Supabase free to use for a vibe coded app?
- Supabase has a free tier that covers up to 50,000 monthly active users and 500MB of database storage. That is enough for most early-stage products. Paid plans start at $25 per month.
- Can I use a different database instead of Supabase?
- Yes. PlanetScale, Neon and Firebase are alternatives. But Supabase integrates most smoothly with Lovable and most vibe coding tools, so it is the path of least resistance.
- What is row-level security and why does it matter?
- Row-level security is a Postgres feature that controls which users can access which rows in a table. Without it, any authenticated user can read all rows in all tables. With it, users only see their own data.
Related Services