Supabase Backend
Storage (Avatars)
Create a storage bucket for user profile pictures and assets.
If your application allows users to upload profile pictures or any other files, you need to set up a Storage Bucket in Supabase.
1. Create a Public Bucket
Launch-Native uses a default bucket named avatars for user profile pictures.
- In your Supabase dashboard, go to Storage (the folder icon in the left sidebar).
- Click on New Bucket.
- Name the bucket exactly:
avatars. - Important: Toggle the Public bucket switch to ON. (This allows the images to be displayed in your React Native
<Image>components without needing complex signed URLs). - Click Save.
2. Security Policies (RLS for Storage)
Even though the bucket is public for viewing, you must restrict who can upload or delete files.
- Click on your newly created
avatarsbucket. - Go to the Policies tab.
- Click New Policy under the
avatarsbucket. - Choose For full customization.
- Create a policy for INSERT (Uploads):
- Policy Name:
Users can upload their own avatar - Allowed operation:
INSERT - Target roles:
authenticated - USING expression:
auth.uid() = owner
- Policy Name:
- Click Save Policy.
Your storage is now secure: anyone can see the profile pictures, but a user can only upload and modify their own!
