Storage
Store files in buckets, control who can read and write them, and serve them with public or signed URLs.
Files live in buckets. A bucket has a size limit per file, an optional list of allowed content types, and access rules that decide who can upload, download and delete. Files are addressed by a path such as avatars/<user-id>/photo.png.
#Create a bucket


In Storage → New bucket, pick a name, whether it is public, and who can access it. The defaults are the safe ones: signed-in users manage files in their own folder (<user id>/…) and project admins can do everything.


| Access rule (as shown in the dialog) | What it allows |
|---|---|
| Signed-in users manage files in their own folder | Upload, download and delete only under <their user id>/. Other paths are refused. |
| Any signed-in user can download any file | Read access for every signed-in user. |
| Any signed-in user can upload and replace any file | Write access for every signed-in user. |
| Any signed-in user can delete any file | Delete access for every signed-in user. |
| Project admins can do everything | App users with the admin role (and the service role key). |
| Nobody can delete | Overrides the rules above — good for receipts and audit trails. |
| Public bucket (switch) | Anyone with the link can download, without signing in. |
Visitors who are not signed in (requests with only the anon key) get nothing from a private bucket unless you add a rule for them.
sov storage create-bucket avatars
sov storage buckets#Upload and download
const me = await sovaria.auth.me()
const path = `${me.id}/avatar.png`
await sovaria.storage.upload('avatars', path, file, { upsert: true, contentType: 'image/png' })
const blob = await sovaria.storage.download('avatars', path)
await sovaria.storage.remove('avatars', path)#Names, paths and overwrites
- Bucket names are lowercase letters, digits,
.,_and-, start with a letter or digit, and are at most 128 characters. Creating a bucket that exists returns409. - Object paths may contain
/to form folders. With the own-folder rule, the first folder must be the user's id:<user id>/avatar.png. - Uploading to a path that already has a file returns
409 Object already exists. Passupsert: true(or?upsert=true) to replace it. - Each bucket has a per-file size limit (default 50 MB) and an optional list of allowed content types. Your plan caps both.
- List a folder with
sovaria.storage.listObjects(bucket, { prefix: '<user id>/' }); rename or move a file withmoveObject({ from_path: 'avatars/<user id>/old.png', to_path: 'avatars/<user id>/new.png' })(paths include the bucket). Moving needs write access to both paths and never replaces an existing file.
#Public and signed URLs
- Public buckets:
sovaria.storage.publicUrl(bucket, path)returns a permanent URL anyone can open. - Private buckets:
sovaria.storage.signDownload(bucket, path, seconds)returns{url, expires_at}— a URL that works without signing in until it expires (default 1 hour, at most 24 hours).signUploaddoes the same for uploads, so a browser can upload directly without your server in the middle. - Downloads of files that browsers could render as pages (HTML, SVG, XML, scripts) are served as sandboxed attachments on every route that returns a file — object downloads, public and signed links, S3 GetObject and presigned URLs, image transforms — so an uploaded file can't run scripts on your domain.
#Limits
File size is capped by the bucket's limit and your plan. Total storage and bandwidth depend on your plan; when a limit is reached uploads return PLAN_LIMIT_REACHED and owners are emailed.
#Coming from Firebase or Supabase?
| Platform | What this is called there |
|---|---|
| Firebase | Cloud Storage for Firebase |
| Supabase | Supabase Storage |
| Sovaria | Storage |
Moving an existing app? Migrate from Supabase or Firebase imports users (with their passwords), data, files and rules.