Learn Supabase fundamentals by building an authenticated art gallery with user favorites. Authentication is pre-built. You will focus on database setup, data loading, and user-specific data.
- Set up Supabase tables and Row Level Security policies
- Import CSV data into PostgreSQL tables
- Query data through Supabase client
- Store user-specific data linked to authentication
- Click "Code" → "Codespaces" → "Create codespace on main"
- Wait for automatic setup to complete
npm install
npm run devCreate .env.local in the project root:
VITE_SUPABASE_URL=your_supabase_url
VITE_SUPABASE_ANON_KEY=your_supabase_anon_keyGet these from your Supabase project settings under API.
In Supabase Dashboard:
- Go to Authentication → Settings → Email Auth
- Disable "Enable email confirmations"
In Supabase Table Editor, import:
data/artist.csv→artisttabledata/work.csv→worktabledata/image_link.csv→image_linktable
In Supabase SQL Editor, execute in order:
- Copy and run
supabase/migrations/20260409_create_art_tables.sql - Copy and run
supabase/migrations/20260409_create_user_favorites.sql
This creates four tables:
artist- Artist records with biographical datawork- Artwork records linked to artistsimage_link- Image URLs mapped to worksuser- User favorites linked to auth accounts
- Start the dev server:
npm run dev - Create an account with any email and password
- Verify you see paintings and artists
- Click "Favorite" on a painting and an artist
- In Supabase Table Editor, check the
usertable to see your favorites saved
- Supabase handles user authentication in
auth.users - A database trigger auto-creates a row in
public.userfor each new user - RLS policies ensure users can only read/write their own data
- Each
workreferences anartistbyartist_id - Each
workcan have animage_linkbywork_id - Each
userstores onefavorite_artistand onefavorite_work
src/services/artData.ts- Data fetching logicsrc/services/favorites.ts- User favorites logicsrc/lib/supabase.ts- Supabase client setup
- How to structure PostgreSQL tables in Supabase
- How Row Level Security (RLS) protects user data
- How database triggers automate data management
- How to query related data with the Supabase client
- How to link application data to authenticated users