/medusa-storage-supabase

Handle file uploads with sup abase

Primary LanguageTypeScriptGNU General Public License v3.0GPL-3.0

medusa-storage-supabase

Handle file uploads with supabase

Medusa Website | Medusa Repository

Features

  • Upload files to assets/ and private files to private/.
  • Get file signed url
  • Delete file

Prerequisites


How to Install

1. Run the following command in the directory of the Medusa backend:

npm install medusa-storage-supabase

2. Set the following environment variables in .env:

STORAGE_BUCKET_REF=<found in the settings>
STORAGE_SERVICE_KEY=<this is the service role key, not the public>
BUCKET_NAME=<bucket name>

3. In medusa-config.js add the following at the end of the plugins array:

const plugins = [
  // ...
  {
    resolve: `medusa-storage-supabase`,
    options: {
      referenceID: process.env.STORAGE_BUCKET_REF,
      serviceKey: process.env.STORAGE_SERVICE_KEY,
      bucketName: process.env.BUCKET_NAME,
    },
  },
];

Test the Plugin

1. Run the following command in the directory of the Medusa backend to run the backend:

npm start

2. Try to change a product image.


Additional Resources