Name(s)________________ Period ___ Date ______
| | Activity Guide - React + Supabase Potluck App | 🍽️ | | :—- | :—- | :—- |
Overview
Build a full-stack React application with Supabase database integration. Create a potluck meal management app that demonstrates CRUD operations, form handling, and database security policies.
Review the Supabase setup guides and try the database interface.
Discuss with a Partner:
Wireframes: Sketch the layout of your app pages. Use simple boxes and labels to show where elements will go.
Main App Layout:
┌─────────────────────────────────────┐
│ Potluck App │
├─────────────────────────────────────┤
│ [Fetch Meals] Button │
│ │
│ • Meal 1 by Guest serves 4 │
│ • Meal 2 by Guest serves 6 │
│ • Meal 3 by Guest serves 2 │
│ │
│ ┌─────────────────────────────────┐ │
│ │ Add Meal Form │ │
│ │ Meal: [_____________] │ │
│ │ Guest: [_____________] │ │
│ │ Serves: [_____] │ │
│ │ Type: [Dropdown ▼] │ │
│ │ [Add Meal] Button │ │
│ └─────────────────────────────────┘ │
└─────────────────────────────────────┘
Additional Components: Sketch similar layouts for Beverages and Utensils components.
Database Tables: Fill in the table below for each table you’ll need to create.
| Table Name | Purpose | Columns Needed |
|---|---|---|
| potluck_meals | Store meal information | meal_name, guest_name, serves, kind_of_dish |
| potluck_beverages | ||
| potluck_utensils |
Security Policies: List the policies you’ll need for each table.
| Table | Policy Type | Purpose |
|---|---|---|
| potluck_meals | SELECT | Allow everyone to read meals |
| potluck_meals | INSERT | Allow everyone to add meals |
| potluck_beverages | ||
| potluck_beverages | ||
| potluck_utensils | ||
| potluck_utensils |
React Components: Fill in the table below for each component you’ll create.
| Component Name | Purpose | Props Needed | State Variables |
|---|---|---|---|
| PotluckMeals | Display and add meals | none | meals (array) |
| PotluckBeverages | |||
| PotluckUtensils |
Functions: List the functions you’ll need to create.
| Function Name | Component | What It Does |
|---|---|---|
| handleFetchMeals | PotluckMeals | Fetch meals from database |
| handleAddMeal | PotluckMeals | Add new meal to database |
| handleFetchBeverages | PotluckBeverages | |
| handleAddBeverage | PotluckBeverages | |
| handleFetchUtensils | PotluckUtensils | |
| handleAddUtensil | PotluckUtensils |
Create React App:
npm create vite@latest practice-with-db -- --template reactcd practice-with-dbnpm installnpm install @supabase/supabase-jsnpm run devEnvironment Setup:
.env.local file in project root (not .env)VITE_SUPABASE_URL=your-project-url
VITE_SUPABASE_ANON_KEY=your-anon-key
📖 Complete Project Guide - Step-by-step instructions with code examples
Follow the step-by-step guide to build your potluck app. Complete each step before moving to the next.
Core Features (Steps 1-16):
Form Enhancement (Step 17):
Additional Components (Steps 18-19):
As You Code:
console.log() to debugTest your app and verify it works correctly for all scenarios:
| Test | What to Check | ✓ |
|---|---|---|
| Fetch meals button | Meals display from database | |
| Add new meal | Form submits and meal appears in list | |
| Form clears after submit | All input fields are empty | |
| Select dropdown works | Can choose dish type from dropdown | |
| Beverages component | Can fetch and add beverages | |
| Utensils component | Can fetch and add utensils | |
| Data persists | Data remains after page refresh | |
| RLS policies work | Can read and insert data |
Debug Using:
console.log() to check data valuesBefore you submit, check the rubric below to make sure your program meets the requirements.
| Category | Extensive Evidence | Convincing Evidence | Limited Evidence | No Evidence |
|---|---|---|---|---|
| Project Setup | React + Supabase project correctly set up and runs without errors. | Project mostly works but has minor setup issues. | Project has significant setup problems. | Project does not run. |
| Database Design | All three tables created with appropriate columns and RLS policies. | Most tables created with some policy issues. | Some tables created but missing policies. | Database not set up or missing tables. |
| State Management | All state variables properly created with useState and updated correctly. |
Most state variables work correctly but some issues. | Some state variables missing or not updating. | State management not implemented. |
| Form Handling | All forms work correctly with proper validation and data submission. | Forms mostly work with minor issues. | Forms have significant problems. | Forms do not work or are missing. |
| Database Operations | All CRUD operations (SELECT, INSERT) work correctly. | Most operations work with minor issues. | Some operations missing or broken. | Database operations not implemented. |
| Code Quality | Code is clean, well-organized, and includes helpful comments. | Code is mostly clean with some organization issues. | Code has significant quality issues. | Code is poorly written or incomplete. |
| Testing | All features tested and working correctly. | Most features tested and working. | Some features not tested or broken. | App not tested or major issues. |
Total Points: ___/40
What was the most challenging part of building this app?
How did you handle errors and debugging?
What would you do differently if you built this app again?
What database concepts did you learn?
How does this project connect to real-world applications?