Supabase Upload Provider
Unofficial provider for supabase storage
strapi-upload-supabase-provider
Resources
Links
Installation
# using yarn
yarn add strapi-upload-supabase-provider
# using npm
npm install strapi-upload-supabase-provider --saveConfiguration
providerdefines the name of the provider, in this case we must put "strapi-upload-supabase-provider".providerOptionsis passed down during the construction of the provider. (ex:new StorageClient(config)).providerOptions.apiUrlRESTful endpoint to manage your Supabase project.providerOptions.apiKeyAPI key of your Supabase project(service_role not anon).providerOptions.bucketname of your Supabase bucket.providerOptions.directorydirectory inside the bucket where you want to store your files.sizeLimitmaximum size limit for your files on bytes.
See the documentation about using a provider for information on installing and using a provider. To understand how environment variables are used in Strapi, please refer to the documentation about environment variables.
Provider Configuration
./config/plugins.js or ./config/plugins.ts for TypeScript projects:
1module.exports = ({ env }) => ({
2 // ...
3 upload: {
4 config: {
5 provider: "strapi-upload-supabase-provider",
6 providerOptions: {
7 apiUrl: env("SUPABASE_API_URL"),
8 apiKey: env("SUPABASE_API_KEY"),
9 bucket: env("SUPABASE_BUCKET_NAME"),
10 directory: env("SUPABASE_BUCKET_DIRECTORY"),
11 },
12 sizeLimit: 1000000000,
13 actionOptions: {
14 upload: {},
15 uploadStream: {},
16 delete: {},
17 checkFileSize: {},
18 },
19 },
20 },
21 // ...
22});Security Middleware Configuration
Due to the default settings in the Strapi Security Middleware you will need to modify the contentSecurityPolicy settings to properly see thumbnail previews in the Media Library. You should replace strapi::security string with the object bellow instead as explained in the middleware configuration documentation.
./config/middlewares.js
1module.exports = [
2 // ...
3 {
4 name: "strapi::security",
5 config: {
6 contentSecurityPolicy: {
7 directives: {
8 "default-src": ["'self'"],
9 "img-src": [
10 "'self'",
11 "data:",
12 "blob:",
13 env("SUPABASE_API_URL"),
14 ],
15 },
16 },
17 },
18 },
19 // ...
20];Install now
npm install strapi-upload-supabase-provider
Create your own plugin
Check out the available plugin resources that will help you to develop your plugin or provider and get it listed on the marketplace.