9. Profile Image & File Storage
9.1 Requirement
- One profile/logo image per provider (and optionally per user).
- Upload from browser → backend or direct to storage → store URL in DB.
9.2 Cheapest Options (No AWS S3)
| Option | Free Tier | Best for |
|---|---|---|
| Supabase Storage | 1 GB free, unlimited egress on free tier | Small apps; fits if you use Supabase for DB. |
| Cloudinary | Free plan with credits (bandwidth + storage + transformations) | Image resizing/optimisation out of the box. |
9.3 Recommendation
- Supabase Storage: Use if you already use or plan to use Supabase for PostgreSQL; 1 GB is enough for many profile images (e.g. 100–500 at ~200 KB each).
- Cloudinary: Use if you want automatic resizing/optimisation and don’t mind the credit system; good for thumbnails and different sizes.
9.4 Implementation Outline
-
Backend:
- FastAPI endpoint: accept multipart file upload (or receive signed URL from frontend).
- Validate file type (e.g. image/jpeg, image/png) and size (e.g. max 5 MB).
- Upload to Supabase Storage or Cloudinary (using their SDK or REST API).
- Save returned URL in
usersorproviderstable (e.g.profile_image_url).
-
Frontend:
- File input or drag-and-drop; optional client-side crop/resize (e.g. browser canvas or a small library).
- Call backend upload endpoint with file; display returned URL in profile.
-
Cost:
- Supabase: free up to 1 GB; then low cost per GB.
- Cloudinary: stay within free credit limits; monitor usage in dashboard.