@sensinum/strapi-plugin-open-mercato
v1.0.0
Published
Strapi - Open Mercato seamless integration
Maintainers
Readme
A Strapi plugin that connects your Strapi application with Open Mercato through a user-friendly interface. It features a custom product field and efficient product synchronization via the Open Mercato REST API (/catalog/products). The plugin comes with configurable caching mechanisms to optimize performance.
📋 Table of Contents
- ✨ Features
- 📋 Requirements
- 📦 Installation
- 🔧 Plugin Configuration
- 👨💻 Development & Testing
- 🔗 Links
- 💬 Community Support
- 📄 License
✨ Features
- Attach Open Mercato products to Strapi Content Types using a dedicated custom field
- Automatic product data synchronization via REST API
- Built-in caching (in-memory or Redis)
📋 Requirements
- Strapi v5.7.0 or later
- Node.js 18+
- An Open Mercato instance with REST API access
- For Redis cache: a running Redis instance
📦 Installation
npm install @sensinum/strapi-plugin-open-mercato@latest
# or
yarn add @sensinum/strapi-plugin-open-mercato@latestThen, rebuild your Strapi admin panel:
npm run build
# or
yarn build🔧 Plugin Configuration
Required Configuration
Configure the plugin in your Strapi project's ./config/plugins.js (or .ts):
encryptionKey(string, required): A 32-character string used for encrypting sensitive data stored in StrapiapiUrl(string, optional): Your Open Mercato instance URL (e.g.https://my-instance.openmercato.com)accessToken(string, optional): Your Open Mercato API access tokenengine(string, optional, default not set): Cache engine —'memory'or'redis'connection(object, required ifengineis'redis'): Redis connection details:host(string)port(number)db(number)password(string, optional)username(string, optional)
Example Configurations
Using Memory Engine:
// ./config/plugins.js
module.exports = ({ env }) => ({
'open-mercato': {
enabled: true,
config: {
encryptionKey: env('OPEN_MERCATO_ENCRYPTION_KEY'),
apiUrl: env('OPEN_MERCATO_API_URL'),
accessToken: env('OPEN_MERCATO_ACCESS_TOKEN'),
engine: 'memory',
},
},
});Using Redis Engine:
// ./config/plugins.js
module.exports = ({ env }) => ({
'open-mercato': {
enabled: true,
config: {
encryptionKey: env('OPEN_MERCATO_ENCRYPTION_KEY'),
apiUrl: env('OPEN_MERCATO_API_URL'),
accessToken: env('OPEN_MERCATO_ACCESS_TOKEN'),
engine: 'redis',
connection: {
host: env('REDIS_HOST', '127.0.0.1'),
port: env.int('REDIS_PORT', 6379),
db: env.int('REDIS_DB', 0),
password: env('REDIS_PASSWORD', undefined),
username: env('REDIS_USERNAME', undefined),
},
},
},
});Remember to add the corresponding environment variables to your .env file.
👨💻 Development & Testing
- Build:
yarn build - Test backend:
yarn test:server - Test frontend:
yarn test:ts:front
🔗 Links
💬 Community Support
- GitHub (Bug reports, contributions)
- Discord (For live discussion with the Community and Strapi team)
- Community Forum (Questions and Discussions)
📄 License
See the MIT License file for licensing information.
