medusa-storage-supabase
Handle file uploads with supabase
Features
- Upload files to Copy to clipboard
assets/
and private files to Copy to clipboardprivate/
. - Get file signed url
- Delete file
Prerequisites
- Node.js v17 or greater
- A Medusa backend
- Supabase account
- Supabase storage bucket. Set it to public as this plugin handles signed urls but some files need to be public :).
How to Install
1. Run the following command in the directory of the Medusa backend:
1npm install medusa-storage-supabase
2. Set the following environment variables in Copy to clipboard
.env
:123STORAGE_BUCKET_REF=<found in the settings>STORAGE_SERVICE_KEY=<this is the service role key, not the public>BUCKET_NAME=<bucket name>
3. In Copy to clipboard
medusa-config.js
add the following at the end of the Copy to clipboardplugins
array:1234567891011const 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:
1npm start
2. Try to change a product image.