Storage

Supabase Storage

Store uploads in a Supabase Storage bucket.

CloudSelf-HostedLinks
✅ Supported✅ SupportedNPM Package

Usage

Installation

bun i @vitnode/supabase-storage -D
pnpm i @vitnode/supabase-storage -D
npm i @vitnode/supabase-storage -D

Import the adapter

vitnode.api.config.ts
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.

.env
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_ROLE_KEY=your_service_role_key
SUPABASE_STORAGE_BUCKET=your-bucket

Public 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

On this page