This guide will help you set up Supabase for the BroCode application with real-time functionality.
- Go to https://supabase.com
- Sign up or log in
- Click "New Project"
- Fill in your project details:
- Name:
brocode(or your preferred name) - Database Password: (save this securely)
- Region: Choose closest to your users
- Name:
- Wait for the project to be created (takes ~2 minutes)
- In your Supabase project dashboard, go to Settings → API
- Copy the following:
- Project URL (under "Project URL")
- anon/public key (under "Project API keys")
- Create a
.env.localfile in the root of your project - Add your Supabase credentials:
VITE_SUPABASE_URL=your_project_url_here
VITE_SUPABASE_ANON_KEY=your_anon_key_hereExample:
VITE_SUPABASE_URL=https://abcdefghijklmnop.supabase.co
VITE_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...- In Supabase dashboard, go to SQL Editor
- Copy and paste the SQL from
DATABASE_SCHEMA.md - Run the SQL to create all tables, indexes, and policies
- In Supabase dashboard, go to Database → Replication
- Enable replication for the following tables:
spotsinvitationspaymentschat_messages
- In SQL Editor, run the admin user insert from
DATABASE_SCHEMA.md - Or use the Supabase dashboard to manually insert users
- Start your development server:
npm run dev - Try logging in with:
- Email:
ramvj2005@gmail.com - Password:
ramkumar
- Email:
- Create a new spot as admin
- Check if real-time updates work by opening the app in multiple tabs
- Make sure
.env.localexists in the project root - Check that variable names start with
VITE_ - Restart your dev server after creating
.env.local
- Check that replication is enabled for the tables
- Verify RLS policies allow reading the data
- Check browser console for errors
- Verify RLS policies are set correctly
- Check that user exists in
profilestable - Ensure password matches (if using custom auth)
- Never commit
.env.localto git (it's in.gitignore) - The
anonkey is safe for client-side use (RLS protects your data) - Use service role key only on server-side (never expose it)
- Set up email authentication in Supabase Auth (optional)
- Configure storage buckets for images (optional)
- Set up database backups
- Configure custom domains (optional)