An AI-ready modular CRM/ERP foundation framework built on TypeScript and Next.js. It offers out-of-the-box multi-tenancy, permissions, workflows, and Headless API capabilities, supports deep customization via overlay overrides, and includes built-in AI Agent (MCP) integration tools.
Project Overview#
Open Mercato is an enterprise-grade CRM and ERP foundation framework with the core philosophy of "Start with 80% done" β freeing development teams from repetitive infrastructure work to focus on the remaining 20% of differentiated innovation.
Core Value Proposition#
- Buy vs. Build Balance: Achieving the optimal balance between out-of-the-box functionality and high customizability
- Modular & Upgrade-Compatible: Rapid customization through Overlay mechanism without breaking upgrade paths
- AI-Ready Design: Structured design for assisted workflows, automation, and conversational interfaces
Business Domain Capabilities#
| Module | Key Capabilities |
|---|---|
| CRM | Infinitely flexible customer, opportunity, and workflow modeling with custom data definitions |
| ERP | Order/production/service delivery management with modular trimming |
| Commerce | CPQ process, B2B procurement portal, complete e-commerce backend |
| Self-service | Configurable forms and guided flows, fine-grained permission customer/partner portals |
| Production | Coordinated production management with modular entities and automation hooks |
| Workflows | Custom data lifecycle and document workflows (per tenant/team) |
Platform & Architecture Capabilities#
- π§© Modular Architecture: Auto-discovery of modules, pages, APIs, entities; Overlay override mechanism
- 𧬠Custom Entities & Dynamic Forms: Runtime declaration of fields, validators, and UI controls
- π’ Multi-tenant by Default: Default multi-tenancy with strict organization/tenant isolation
- ποΈ Multi-hierarchical Organizations: Built-in organization trees, roles, and user visibility controls
- π‘οΈ Feature-based RBAC: Role/user-level feature flags combined with organization scope for page/API gating
- β‘ Data Indexing & Caching: Hybrid JSONB indexing + intelligent caching
- π Event Subscribers: Domain event publishing and persistent subscription handling (local/Redis)
- π Headless/API Platform: Unified extensible data model with richly-typed APIs (mobile/Web)
AI Integration Capabilities#
MCP (Model Context Protocol) Tools#
discover_schema- Discover data structuresfind_api- Search available APIscall_api- Invoke backend interfacescontext_whoami- Get current context
Supports development/production integration patterns, enabling AI Agents to understand business logic and execute operations.
Data Encryption#
- Tenant-level DEK (Data Encryption Key)
- AES-GCM encryption
- Automatic encryption/decryption in ORM lifecycle
Technical Architecture#
- Frontend: Next.js App Router + React + TypeScript (92.7%)
- Backend ORM: MikroORM + PostgreSQL
- Dependency Injection: Awilix (request-level DI container)
- Caching & Events: Redis
- Search Engine: Meilisearch (full-text/vector search)
- Authentication: bcryptjs + JWT Session
Project Structure#
apps/
βββ mercato/ # Main Next.js application
βββ docs/ # Documentation site
packages/ # @open-mercato/<pkg> naming
βββ core/ # Core packages
βββ shared/ # Shared utilities
βββ ui/ # UI components
βββ cli/ # CLI tools
βββ ai-assistant/# AI assistant
βββ enterprise/ # Enterprise edition
Requirements#
- Node.js: 24.x
- Yarn: 4+
- PostgreSQL: Database
- Redis: Events & caching
- Meilisearch: Search engine (optional)
Quick Start#
git clone https://github.com/open-mercato/open-mercato.git
cd open-mercato
git checkout develop
yarn install
cp apps/mercato/.env.example apps/mercato/.env
yarn generate
yarn initialize
yarn dev
# Visit http://localhost:3000/backend
Docker Deployment#
# Development mode (hot reload)
docker compose -f docker-compose.fullapp.dev.yml up --build
# Production mode
docker compose -f docker-compose.fullapp.yml up --build -d
API Development Style#
- Route Convention:
api/<method>/<path>.ts - Quick CRUD: Use
makeCrudRouteto build CRUD APIs - Auto Documentation: Export OpenAPI specifications
- Input Validation: Zod Schema