codex-lv3-may-2025

Level Navigation: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19⚡ 20

Level 3: Database Setup

Goal: Configure your Supabase database with tables and security policies.

User Story: As a developer, I want to set up my database tables and security policies so that I can store and retrieve potluck data securely.


What You’ll Do

Follow the Supabase setup guides to create your database tables and configure access policies.

Instructions

⚠️ Important Note: Do NOT use the starter code for App.jsx from the Supabase setup guide. That code puts everything in one file, but we’ll be organizing our app into separate components. Follow the component structure outlined in Levels 4-6 below instead.

Show Me: Sample data in database Sample data in database

🔍 Diving Deeper

What are Row Level Security (RLS) policies?

Understanding our policies:

-- Read policy: Allow everyone to read meals
CREATE POLICY "Enable read access for all users" ON potluck_meals
FOR SELECT USING (true);

-- Insert policy: Allow everyone to add meals  
CREATE POLICY "Enable insert for all users" ON potluck_meals
FOR INSERT WITH CHECK (true);

Environment variables explained:

VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key-here

📺 Learn More:

✅ Check

  1. Your Supabase project is created and accessible
  2. The potluck_meals table exists with the correct columns
  3. You have sample data in your table
  4. RLS policies are enabled and configured
  5. Environment variables are set up in your React project
  6. You can see your data in the Supabase dashboard

📚 Vocabulary