Manage product content and assets with auto sync
A plugin for implementing Strapi as CMS for Medusa
This plugin requires:
1npm install @devx-commerce/strapi @strapi/client2# or3yarn add @devx-commerce/strapi @strapi/client1const { defineConfig } = require("@medusajs/medusa"); // or "@medusajs/framework/utils"2
3module.exports = defineConfig({4 // ... other config5 plugins: [6 // ... other plugins,7 {8 resolve: "@devx-commerce/strapi",9 options: {10 base_url: process.env.STRAPI_URL,11 api_key: process.env.STRAPI_API_KEY,12 },13 },14 ],15});npx create-strapi-app@latest my-strapi-cms1cd my-strapi-cms2npm run developCreate an API token in Strapi:
Create Product and Variant collections in Strapi:
Configure environment variables for your Medusa backend:
1STRAPI_URL=http://localhost:13372STRAPI_API_KEY=your-api-token-hereAfter installation and setup, the plugin will automatically:
Once the plugin is set up, you can use Strapi's admin panel to add rich content to your products and use the Strapi API to fetch this content for your storefront.
Example of fetching product content from Medusa (with Strapi fields):
1// In your storefront2async function getProductContent(productId) {3 const response = await fetch(4 `${MEDUSA_BASE_URL}/store/products/${productId}?fields=cms_product.*`,5 {6 headers: {7 "x-publishable-api-key": STOREFRONT_PUBLISHABLE_API_KEY,8 },9 },10 );11 const data = await response.json();12 return data.data[0];13}