Storage
Supabase Storage
Store uploads in a Supabase Storage bucket.
| Cloud | Self-Hosted | Links |
|---|---|---|
| ✅ Supported | ✅ Supported | NPM Package |
Usage
Installation
bun i @vitnode/supabase-storage -Dpnpm i @vitnode/supabase-storage -Dnpm i @vitnode/supabase-storage -DImport the adapter
import { SupabaseStorageAdapter } from "@vitnode/supabase-storage";
import { buildApiConfig } from "@vitnode/core/vitnode.config";
export const vitNodeApiConfig = buildApiConfig({
storage: {
adapter: SupabaseStorageAdapter({
url: process.env.SUPABASE_URL,
secretKey: process.env.SUPABASE_SECRET_KEY,
bucket: process.env.SUPABASE_STORAGE_BUCKET,
}),
},
});Environment variables
A secret key (sb_secret_…) is required so the server can write to the
bucket. Keep it secret - never expose it to the client. Create one under
Project Settings → API Keys.
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SECRET_KEY=sb_secret_...
SUPABASE_STORAGE_BUCKET=your-bucketPublic bucket for public URLs
getUrl returns the bucket's public URL. Make the bucket public (or serve
through a CDN) if you want the returned URLs to be directly accessible.
Options
Prop
Type