const{ defineConfig }=require("@medusajs/medusa");// or "@medusajs/framework/utils"
module.exports=defineConfig({
// ... other config
plugins:[
// ... other plugins,
{
resolve:"@devx-commerce/strapi",
options:{
base_url: process.env.STRAPI_URL,
api_key: process.env.STRAPI_API_KEY,
},
},
],
});
Step 3: Set Up Strapi
3.1 Create or Configure Your Strapi Project
Install Strapi if you haven't already:
npx create-strapi-app@latest my-strapi-cms
Start your Strapi server:
cd my-strapi-cms
npm run develop
3.2 Create an API Token
Go to Settings > API Tokens
Create a new full access token
Copy the token to use in your Medusa configuration
3.3 Create Content Types
You have two options to create the content types:
Option A: Using Schema Files (Recommended)
This method is less error-prone and ensures exact field matching:
Copy the schema files from the directory in this plugin to your Strapi project
Place them in
Required content types and their locations:
Product:
Product Variant:
Category:
Collection:
After adding the schema files, restart your Strapi server to apply the changes.
Option B: Using Strapi Admin Panel (Manual)
If you prefer to create content types manually through the Strapi admin interface:
Start your Strapi server: or
Access Strapi Admin: Go to
Navigate to Content-Type Builder in the sidebar
Create Product Content Type:
Click "Create new collection type"
Display name: "Product"
API ID (singular): "product"
Add these fields:
(Text, Required)
(Text, Required, Unique)
(Text)
(Text)
Save the content type
Create Product Variant Content Type:
Click "Create new collection type"
Display name: "Product Variant"
API ID (singular): "product-variant" ⚠️ Important: Use hyphen, not underscore
Add these fields:
(Text, Required)
(Text, Required, Unique)
(Text)
Add relation field:
Field name: "product"
Relation type: Many-to-One
Target: Product
Save the content type
Create Category Content Type:
Click "Create new collection type"
Display name: "Category"
API ID (singular): "category"
Add these fields:
(Text, Required)
(Text, Required, Unique)
(Text)
Save the content type
Create Collection Content Type:
Click "Create new collection type"
Display name: "Collection"
API ID (singular): "collection"
Add these fields:
(Text, Required)
(Text, Required, Unique)
(Text)
Save the content type
Complete Product Relations:
After creating Product Variant, go back to the Product content type and add:
Field name: "variants"
Relation type: One-to-Many
Target: Product Variant
⚠️ Critical Notes for Manual Creation:
Content type names must be exact: , , ,
Field names must match exactly: , , , ,
field must be set as Required and Unique
Relations must be properly configured between Product and Product Variant
Required fields summary:
Product: , (unique), , , (relation)
Product Variant: , (unique), , (relation)
Category: , (unique),
Collection: , (unique),
Step 4: Configure Environment Variables
Add these variables to your Medusa file:
Step 5: Start Your Applications
Start Strapi: (in your Strapi directory)
Start Medusa: (in your Medusa directory)
Check the logs for "Connected to Strapi" message
Step 6: Test the Integration
Create a test product in Medusa Admin ()
Check Strapi Admin () to see if the product appears
Add rich content to the product in Strapi
Query the product from your storefront to see the combined data
How It Works
After installation and setup, the plugin will automatically:
Create and update products, collections & categories in Strapi when they are modified in Medusa
Sync product, collection & category metadata between Medusa and Strapi
Allow extending product data with Strapi's content types
Usage
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):