File storage

Store user files behind access rules

Upload straight from your app, keep files private by default, and share single files by public URL.

volcano.dev/dashboard/file-storage
The Volcano dashboard listing storage buckets with their file counts, sizes and policies

What it does

Handle uploads without a signing service

The browser uploads with the user's session, and bucket policies decide access.

  • Private

    New files need an authorized request to read.

  • Per-user

    Policies match auth.uid(), like your table policies.

  • Shareable

    Publish one file without opening the bucket.

volcano.dev/dashboard/file-storage
The Volcano dashboard listing storage buckets with their file counts, sizes and policies

What you need

  • A Volcano account

    Sign up from the CLI.

  • Volcano CLI

    Install with npm.

  • The JavaScript SDK

    For browser uploads.

Try it

Three steps from zero.

  1. Create a private bucket

    Set a size limit. New files start private.

    bash

    Shell
    volcano cloud storage bucket create user-files --file-size-limit 26214400
  2. Add owner-only policies

    Users read their own files and upload only to their own folder.

    bash

    Shell
    volcano cloud storage policy create user-files --name own-read \ --operation SELECT --definition "auth.uid() = owner_id" volcano cloud storage policy create user-files --name own-write \ --operation INSERT --definition "(storage.foldername(name))[1] = auth.uid()::text"
  3. Upload from the browser

    Send a File, Blob or ArrayBuffer with the user's session.

    javascript

    JavaScript
    const bucket = volcano.storage.from("user-files"); await bucket.upload(userId + "/" + file.name, file, { contentType: file.type, });

Check it works

  • Upload as one user, then read the file back with the same session.
  • Try to read it as a different user. The request is denied.
  • Publish one file. Only that file opens without a token.

Works with

Questions

How do I keep uploaded files private?

Files are private by default. Add a SELECT policy for the users who should read them. Service keys bypass policies; keep them on the server.

What is the maximum file upload size?

100 MB per file on Hobby and 10 GB on Superagent. A lower bucket limit can restrict it further.

How do I resume an interrupted file upload?

Keep the upload session ID, call getUploadSession to see which parts arrived, then send only the missing parts.

More answers in the docs

It will blow your mind!

Pun intended. Build, deploy & scale on the Volcano platform for free.

Start building