Skip to main content

Prerequisites

  • A Supabase project at supabase.com
  • Your project credentials (URL, anon key, service role key)

Database Migration

1

Open SQL Editor

Go to your Supabase dashboard → SQL Editor → New Query.
2

Run the migration

Copy the contents of supabase/migrations/001_initial_schema.sql and run it. This creates all tables, indexes, RLS policies, storage buckets, and triggers.
3

Verify tables

In Table Editor, confirm you see all 23 tables: profiles, recipes, recipe_images, recipe_tags, recipe_tagged_users, recipe_favorites, recipe_reposts, recipe_comments, recipe_comment_mentions, posts, post_images, post_tags, post_tagged_users, post_favorites, post_reposts, post_comments, post_comment_mentions, collections, collection_saved_items, saved_items, follows, notifications, lightroom_settings.
4

Verify storage buckets

Go to Storage and confirm: avatars, cover-photos, recipe-images, post-images.

Storage Bucket Configuration

All 4 buckets are public with no file_size_limit or allowed_mime_types restrictions at the bucket level:
BucketPublicBucket-Level Restrictions
avatarsYesNone
cover-photosYesNone
recipe-imagesYesNone
post-imagesYesNone
File size validation (max 5 MB) and MIME type checking (JPEG, PNG, WebP) happen client-side before upload — not at the bucket level. Storage RLS policies enforce that users can only upload to their own folder (auth.uid() matches the folder name).

Environment Variables

Mobile (apps/mobile/.env) — primary development target:
EXPO_CONFIG_MODE=development
EXPO_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT_REF.supabase.co
EXPO_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
Web Interim (apps/web-interim/.env.local) — only needed if working on auth callbacks or landing page:
NEXT_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT_REF.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
Web App (apps/web/.env.local) — Phase 2, not needed for current development:
NEXT_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT_REF.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
Never commit .env.local or .env files. They are in .gitignore.

Using the CLI (Alternative)

npm install -g supabase
supabase login
supabase link --project-ref YOUR_PROJECT_REF
supabase db push

Troubleshooting

Check for existing tables. If needed, drop and recreate the public schema:
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
Then re-run the migration.
Verify storage policies exist in Storage → Policies. Check that buckets are set to public. Verify the user session is valid.
Check policies in Authentication → Policies. Temporarily disable RLS to test:
ALTER TABLE table_name DISABLE ROW LEVEL SECURITY;
Re-enable after debugging.