Strapi plugin logo for Supabase Upload Provider

Supabase Upload Provider

Unofficial provider for supabase storage

strapi-upload-supabase-provider

Supabase logo Strapi logo

Resources

Links

Installation

# using yarn
yarn add strapi-upload-supabase-provider

# using npm
npm install strapi-upload-supabase-provider --save

Configuration

  • provider defines the name of the provider, in this case we must put "strapi-upload-supabase-provider".
  • providerOptions is passed down during the construction of the provider. (ex: new StorageClient(config)).
  • providerOptions.apiUrl RESTful endpoint to manage your Supabase project.
  • providerOptions.apiKey API key of your Supabase project(service_role not anon).
  • providerOptions.bucket name of your Supabase bucket.
  • providerOptions.directory directory inside the bucket where you want to store your files.
  • sizeLimit maximum 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

STATS

No GitHub star yet7 weekly downloads

Last updated

730 days ago

Strapi Version

Unavailable

Author

github profile image for Jorge Agoiz Pedraja
Jorge Agoiz Pedraja

Related plugin

Sentry

Useful links

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.