~/docs/backends/storage

Dashboard

Backends

Storage

Buckets for files, resumable uploads, and resized images.

Updated

2026-12-02

Source

apps/web/docs/backends/storage.mdx

ts

const avatars = phz.storage.from('avatars');

await avatars.upload(`${userId}/avatar.png`, file, { upsert: true });
const { data: link } = await avatars.createSignedUrl(`${userId}/avatar.png`, 60);

Large files

uploadResumable sends a file in 6 MB pieces and continues after a dropped connection. It speaks tus, so any tus client works too.

ts

await phz.storage.from('videos').uploadResumable('talks/keynote.mp4', file, {
  onUploadProgress: ({ loaded, total }) => setProgress(loaded / total),
});

Resized images

Turn on image transformations under Storage → Settings, then ask for the size you need. Each size is made once, then served from a cache.

ts

const { data } = phz.storage.from('avatars').getPublicUrl('ada.jpg', {
  transform: { width: 200, height: 200, resize: 'cover', format: 'webp' },
});