Skip to content

leobenzol/medusa-plugin-sanity

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Medusa logo

Medusa Plugin Sanity

Adds Sanity CMS integration to a Medusa V2 backend, closely following the Medusa implementation guide. The following features are available:

  • Embedded Sanity Studio
  • Sync-all admin page
  • Support for redefining/adding schemas for any model
  • Built-in support for the following Medusa models, including admin widgets and subscribers for manual and automatic sync:
    • Product: Title, Description
    • Category: Name
    • Collection: Title
    • Shipping Option: Name

Required configs

Plugin options

import { SanityPluginOptions } from "medusa-plugin-sanity/modules/sanity"

module.exports = defineConfig({
  ...

  plugins: [
    {
      resolve: "@steelrazor47/medusa-plugin-sanity",
      options: {
        api_token: process.env.SANITY_API_TOKEN,
        project_id: process.env.SANITY_PROJECT_ID,
        dataset: "development",
        backend_url: process.env.MEDUSA_BACKEND_URL,
        api_version: ...,
        extra_schemas: {
          "custom-model": {
            schema: ...,
            step: ...,
            transformForCreate: ...,
            transformForUpdate: ...,
          }
        }
      } satisfies SanityPluginOptions
    },
  ]

Extra schemas

To implement additional schemas, you MUST define a link from your model to the Sanity module(example). Optionally you can define subscribers(example) and admin widgets(example).

The following is an example of the properties that need to be added to the plugin options for a custom schema:

template

Known issues

  • Studio links and refreshes do not work, Medusa at the moment doesn't support catch-all routes in admin pages

About

Plugin for Medusa V2 to integrate Sanity CMS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors