Skip to main content
Find complete setup guide: See /docs/integrations/ProfilePhotos.md in the project

What Is Profile Photo Storage?

Cloud Storage

Photos stored in Supabase Storage

Cross-Device

Same photo on all devices

Automatic Compression

~500KB target size

Fallback

Works locally if upload fails

Quick Overview

1

Create Storage Bucket

In Supabase Dashboard:
  • Storage → New Bucket
  • Name: profile-photos
  • Public: ✅ Enable
2

Set RLS Policies

-- Users can upload own photos
CREATE POLICY "Users upload own" ON storage.objects
FOR INSERT TO authenticated WITH CHECK (
  bucket_id = 'profile-photos' AND
  auth.uid()::text = (storage.foldername(name))[1]
);

-- Photos are public (read)
CREATE POLICY "Photos public" ON storage.objects
FOR SELECT TO public USING (bucket_id = 'profile-photos');
3

Uncomment Implementation

In SupabaseProfilePhotoStorageClient.swift:
  • Uncomment import Supabase
  • Remove comment blocks
4

Enable in CompositionRoot

self.profilePhotoStorageClient = SupabaseProfilePhotoStorageClient(
    supabaseClient: supabaseClient,
    bucketName: "profile-photos"
)

How It Works

Upload Flow:
User selects photo → Compress (~500KB) → Upload to Supabase → Update profile

Download Flow:
App opens → Load from Supabase → Cache locally → Display
Benefits:
  • ✅ Photos sync across devices
  • ✅ Automatic compression
  • ✅ Public CDN URLs
  • ✅ Graceful fallback to local
  • ✅ Privacy-first (iOS 17+ PhotosPicker)

Prerequisites

  • Supabase project configured
  • Supabase dependency in Storage package
  • User authenticated

What You Get

After setup:
  • ✅ Upload profile photos
  • ✅ Photos sync across devices
  • ✅ Automatic compression
  • ✅ CDN-hosted images
  • ✅ Local fallback if upload fails
  • ✅ No camera permissions needed (PhotosPicker)

Complete Guide

The 12KB comprehensive guide includes:
  • Storage bucket configuration
  • Row Level Security policies
  • Upload implementation
  • Compression strategy
  • Error handling
  • Testing procedures

View Complete Setup Guide

Find complete profile photo storage guide in your project

Storage Module

Storage architecture

Chat Sync

Another optional sync feature

Supabase Setup

Required backend

Building Your App

Customize features

Need Help?

  • 📖 Complete troubleshooting in full guide
  • 💬 Create an issue
  • 🔍 Check Supabase Storage logs