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,
serviceRoleKey: process.env.SUPABASE_SERVICE_ROLE_KEY,
bucket: process.env.SUPABASE_STORAGE_BUCKET,
}),
},
});Environment variables
The service role key is required so the server can write to the bucket. Keep it secret — never expose it to the client.
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
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