Docs

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)

OptionFree TierBest for
Supabase Storage1 GB free, unlimited egress on free tierSmall apps; fits if you use Supabase for DB.
CloudinaryFree 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

  1. 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 users or providers table (e.g. profile_image_url).
  2. 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.
  3. Cost:

    • Supabase: free up to 1 GB; then low cost per GB.
    • Cloudinary: stay within free credit limits; monitor usage in dashboard.