Built by

abmenzel

Category

Other

Version

1.0.4

Last updated

Jul 14, 2023, 09:45:16 AM5 months ago

medusa-file-sanity

Store uploaded files to your Medusa backend on Sanity.

Features

  • Store product images on Sanity CMS

Prerequisites


How to Install

1. Run the following command in the directory of the Medusa backend:
yarn add medusa-file-sanity
2. Set the following environment variables in
Copy to clipboard
.env
:
SANITY_PROJECT_ID=some-project-id
SANITY_DATASET=production
SANITY_TOKEN=some-token
3. In
Copy to clipboard
medusa-config.js
add the following at the end of the
Copy to clipboard
plugins
array:
const plugins = [
// ...
{
resolve: `medusa-file-sanity`,
options: {
projectId: process.env.SANITY_PROJECT_ID,
dataset: process.env.SANITY_DATASET,
token: process.env.SANITY_TOKEN,
apiVersion: '2021-10-21',
useCdn: false, // `false` if you want to ensure fresh data
},
},
]

Test the Plugin

1. Run the following command in the directory of the Medusa backend to run the backend:
yarn start
2. Upload an image for a product using the admin dashboard or using the Admin APIs.

Build your own plugins

Develop your own plugins with our API to speed up your processes.

Make your plugin available via npm for it to be shared in our Plugin Library with the broader Medusa community.