Strapi CMS Integration
Integrate Strapi headless CMS with your Medusa store for powerful content management capabilities.
Overview
This plugin connects Medusa with Strapi, enabling you to manage your e-commerce content through Strapi’s intuitive interface. Strapi is a leading open-source headless CMS that provides flexible content modeling and a user-friendly admin panel.
Features
- Strapi Integration - Connect Medusa with Strapi CMS
- Content Management - Manage product descriptions, blog posts, and pages
- Headless CMS - Decouple content from presentation
- Flexible Content Models - Create custom content types
- Media Library - Manage images and media assets
- Multi-Language Support - Content localization
- API-First - RESTful and GraphQL APIs
- Admin Panel - User-friendly content editing interface
- Role-Based Access - Control content permissions
- MedusaJS v2 Compatible - Built for Medusa v2 architecture
Requirements
- MedusaJS v2
- Strapi 4.x or later
- Node.js (latest LTS recommended)
- Database (PostgreSQL, MySQL, SQLite, or MongoDB)
Installation
Install the plugin using npm:
npm install @devx-commerce/strapi
Configuration
Step 1: Set Up Strapi
If you don’t have Strapi installed:
npx create-strapi-app@latest my-strapi-cms
cd my-strapi-cms
npm run develop
Step 2: Configure Plugin
Add the plugin to your medusa-config.js:
const plugins = [
// ... other plugins
{
resolve: "@devx-commerce/strapi",
options: {
strapi_url: process.env.STRAPI_URL || "http://localhost:1337",
strapi_api_token: process.env.STRAPI_API_TOKEN,
// Additional configuration
},
},
]
Step 3: Environment Variables
Add Strapi credentials to your .env:
STRAPI_URL=http://localhost:1337
STRAPI_API_TOKEN=your_strapi_api_token
Usage
Content Types
Create content types in Strapi for:
Product Content
- Extended product descriptions
- Product specifications
- Usage instructions
- Product stories
Blog Posts
- Articles and tutorials
- Product guides
- Company news
- SEO content
Pages
- About us
- Contact pages
- Landing pages
- Policy pages
Collections
- Category descriptions
- Collection stories
- Seasonal campaigns
Creating Content Models
In Strapi admin panel:
- Navigate to Content-Type Builder
- Create a new collection type (e.g., “Product Description”)
- Add fields:
- Text fields for content
- Rich text for formatted content
- Media fields for images
- Relation fields to link with Medusa products
- Save and enable the content type
Syncing Content
The plugin automatically syncs content between Medusa and Strapi:
// Content is accessible through Medusa API
// with Strapi-managed content attached
API Integration
Access Strapi content through Medusa:
// Fetch product with Strapi content
const product = await productService.retrieve(productId, {
relations: ["strapi_content"],
})
// Access extended description from Strapi
const extendedDescription = product.strapi_content.description
Content Management Workflow
1. Product Descriptions
Manage rich product descriptions in Strapi:
- Create detailed descriptions with formatting
- Add product images and galleries
- Include specifications and features
- Localize content for different markets
2. Blog & SEO Content
Build content marketing with Strapi:
- Write blog posts and articles
- Create SEO-optimized content
- Schedule content publication
- Manage content versions
3. Marketing Pages
Design marketing pages:
- Landing pages for campaigns
- Category pages with rich content
- Brand story pages
- Promotional content
Strapi Features
Rich Text Editor
- WYSIWYG editing
- Markdown support
- Custom formatting
- Embedded media
Media Library
- Upload and organize images
- Video management
- File storage
- Image optimization
Internationalization (i18n)
- Multi-language content
- Locale management
- Translation workflows
- Language-specific content
Roles & Permissions
- User role management
- Content access control
- Publishing workflows
- Approval processes
Advanced Features
Custom Fields
Create custom fields for specific needs:
- Product specifications
- Size guides
- Care instructions
- Warranty information
Content Relations
Link content across types:
- Products to blog posts
- Categories to landing pages
- Collections to promotional content
- Related products
Webhooks
Set up webhooks for real-time sync:
- Trigger updates on content changes
- Sync content to Medusa
- Cache invalidation
- Search index updates
Best Practices
- Content Structure - Plan content models before implementation
- SEO Optimization - Use Strapi’s SEO plugin for metadata
- Media Optimization - Optimize images before upload
- Version Control - Use content versioning for important changes
- Backup Content - Regular backups of Strapi database
- Access Control - Implement proper role-based permissions
- Performance - Use caching for frequently accessed content
Use Cases
E-commerce Content
- Product catalogs with rich descriptions
- Category pages with marketing content
- Brand storytelling
- Product comparison guides
Content Marketing
- Blog for SEO and engagement
- How-to guides and tutorials
- Case studies
- Customer stories
Multi-Channel Content
- Content for web, mobile, and apps
- Social media content
- Email marketing content
- Print catalog content