An unofficial implementation for payloadcms supabase storage adapter
npm install unoff-payloadcms-supabase-storage-adapternpm install unoff-payloadcms-supabase-storage-adapter
npm run payload generate:importmap
ts
buildConfig({
...your payload config
plugins: [
supabaseStorage({
bucket: process.env.SUPABASE_BUCKET!,
collections: {
files: { // <-- "files" is your upload collection name
disableLocalStorage: true,
disablePayloadAccessControl: true,
prefix: "files",
signedDownloads: true,
},
},
upsert: true,
signedDownloads: true,
config: {
baseUrl: process.env.SUPABASE_BASE_URL!,
secret: process.env.SUPABASE_SECRET!,
},
isPublic: true // set this to true on public bucket
}),
]})
`
Config Options
`ts
export type SupabaseStorageOptions = {
* Bucket name to upload files to.
* Must follow AWS S3 bucket naming conventions.
*/
bucket: string;
/**
* When true will override existing file, else throw an error
* @default true
*/
upsert?: boolean;
/**
* Check to true if the bucket is public
* @default false
*/
isPublic: boolean;
/**
* Collection options to apply the Supabase adapter to.
*/
collections: Partial } & Omit) | true>>;
/**
* When enabled, fields (like the prefix field) will always be inserted into
* the collection schema regardless of whether the plugin is enabled. This
* ensures a consistent schema across all environments.
*
* This will be enabled by default in Payload v4.
*
* @default false
*/
alwaysInsertFields?: boolean;
/**
* Optional cache key to identify the Supabase storage client instance.
* If not provided, a default key will be used.
*
* @default supabase:containerName
*/
clientCacheKey?: string;
/**
* Do uploads directly on the client to bypass 4.5 mb limits on Vercel. You must allow CORS PUT method for the bucket to your website.
* As for now, this still couldn't be used
*/
clientUploads?: ClientUploadsConfig;
/**
* Supabase client configuration.
*/
config: SupabaseStorageConfig;
/**
* Whether or not to enable the plugin
*
* Default: true
*/
enabled?: boolean;
/**
* Use pre-signed URLs for files downloading. Can be overriden per-collection.
*/
signedDownloads?: SignedDownloadsConfig;
/**
* If true, on supabase it will be base64url encoded but on Payload you could upload any filename you like
* If false, you are responsible for your own file name / prefix name
* @default true
*/
encodeName?: boolean;
};
``