Run this checklist every time you create a new Storage bucket or add file upload functionality.

Standard: Supabase Standards — Multi-Tenant & Storage


1. Bucket Configuration



[ ] Public bucket: files accessible via URL without auth (only for truly public assets)

[ ] Private bucket: all access goes through RLS policies or signed URLs




2. RLS Policies on Storage

Supabase Storage uses RLS on the storage.objects table.

[ ] RLS policies defined for storage.objects
[ ] Separate policies for: SELECT (read), INSERT (upload), UPDATE (replace), DELETE (delete)

COMMON PATTERNS:
[ ] User can upload to their own folder: storage.foldername(name) = auth.uid()::text
[ ] Workspace members can access workspace files: ownership verified via workspace_members lookup
[ ] Public read: allow SELECT with no auth check (for public buckets only)
[ ] Owner-only delete: auth.uid() matches uploader's user_id stored in metadata or path

3. File Path Convention


— User files: {user_id}/{filename}

— Workspace files: {workspace_id}/{entity_type}/{entity_id}/{filename}

— Public assets: public/{filename}





4. Upload Validation (Frontend)









5. Upload Validation (Backend / RLS)







6. Serving Files



— Temporary download: 60 seconds

— Short-lived preview: 5 minutes

— Long-lived link (e.g., invoice): 7 days





7. File Deletion







8. Security Rules








9. Documentation







Done When










Practice Task

Storage Setup Task Create a storage bucket for project attachments, set RLS policies, and design the upload/download/delete flow with signed URLs.