| Level Navigation: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19⚡ | 20 |
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.
Follow the Supabase setup guides to create your database tables and configure access policies.
potluck_meals table with these columns:
meal_name (text)guest_name (text)serves (integer)kind_of_dish (text).env.local file in your project’s root directory instructionssrc/util Note: do not copy the code for App.jsx for this project. We will put the code into a component in later steps 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.
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);
USING (true): For SELECT policies, means “allow if condition is true” (always true = everyone can read)WITH CHECK (true): For INSERT policies, means “allow if condition is true” (always true = everyone can insert)true: Always evaluates to true, so these policies allow public accessEnvironment variables explained:
VITE_SUPABASE_URL=https://your-project.supabase.co
VITE_SUPABASE_ANON_KEY=your-anon-key-here
VITE_ prefix: Required for Vite to include these variables in your build.env.local: More secure than .env (automatically ignored by git)📺 Learn More:
potluck_meals table exists with the correct columns