reference

Supabase Storage Buckets Setup

This document lists all storage buckets required for the application.

Required Buckets

1. avatars

  • Purpose: User profile avatars
  • Public: Yes
  • Setup: See supabase/storage_setup.md

2. tone-packs

  • Purpose: AI-generated tone pack images
  • Public: Yes
  • File size limit: 5MB
  • Allowed MIME types: image/png, image/jpeg, image/jpg, image/webp
  • Setup: Run migration 018_create_tone_packs_bucket.sql or see docs/TONE_PACKS.md

3. entry-backgrounds

  • Purpose: AI-generated background images for journal entries
  • Public: Yes
  • File size limit: 10MB (recommended)
  • Allowed MIME types: image/png, image/jpeg, image/jpg, image/webp
  • Setup: Create manually via Supabase dashboard or SQL

Quick Setup

Via Supabase Dashboard

  1. Go to https://supabase.com/dashboard
  2. Select your project
  3. Navigate to Storage in the left sidebar
  4. Click New bucket for each bucket above
  5. Configure settings as specified

Via SQL Migration

Run the migration files in order:

  • 018_create_tone_packs_bucket.sql - Creates tone-packs bucket with policies

For other buckets, use the Supabase dashboard or create similar migration files.

Storage Policies

All buckets use Row Level Security (RLS) policies to ensure:

  • Users can only upload/update/delete their own files
  • Public files can be viewed by anyone
  • Super admins have full access

Troubleshooting

"Bucket not found" Error

If you see this error:

  1. Check that the bucket exists in Supabase Storage
  2. Verify the bucket name matches exactly (case-sensitive)
  3. Ensure the bucket is public if it needs to be accessed via URL
  4. Check that RLS policies are set up correctly

"Permission denied" Error

If you see permission errors:

  1. Verify RLS policies are created
  2. Check that the user is authenticated
  3. Ensure the file path matches the policy conditions (e.g., user ID in path)
STORAGE BUCKETS — Docs | HiveJournal