Cloud

Storage

S3-compatible object storage for files — images, PDFs, videos, documents.

Buckets

A bucket is a top-level container for files. You can create it in Cloud → Storage or via a prompt.

File upload

ts
const file = event.target.files[0];
const path = `${user.id}/avatar.${file.name.split(".").pop()}`;

const { data, error } = await supabase.storage
  .from("avatars")
  .upload(path, file, { cacheControl: "3600", upsert: true, contentType: file.type });

Public URL

ts
const { data } = supabase.storage.from("avatars").getPublicUrl(path);
const url = data.publicUrl;

Private files

ts
const { data } = await supabase.storage
  .from("documents")
  .createSignedUrl(path, 3600); // valid for 1 hour
Generate Signed URLs on the server when you need access control.

Working with images

ts
const { data } = supabase.storage
  .from("avatars")
  .getPublicUrl(path, { transform: { width: 200, height: 200, resize: "cover" } });

Limits and pricing

  • Max file size: 50 MB (free tier), 5 GB (paid)
  • Free storage: 1 GB
  • Free bandwidth: 5 GB / month