AI‑supportive CRM / ERP foundation framework

Open Mercato is a foundation framework designed to eliminate the "commodity" 80% of enterprise development, allowing your team to focus on the 20% of unique business logic that actually drives value.

The Architecture

Modular Monolith with the Open Closed-Principle

At the heart of Open Mercato is an architecture that solves the conflict between framework updates and custom development.

01

Modular at the Core

Open Mercato is modular and extensible, allowing teams to compose their own modules, entities, and workflows while keeping the guardrails of a production-ready stack.

02

The Open-Closed Principle (OCP)

Your custom business logic lives in the "Overlay" layer. When we release security patches or core features, you update the framework without breaking your custom "penthouses."

Zero technical debt on updates.

03

Dependency Injection (Awilix)

Every service, repository, and controller is managed via an IoC container, ensuring high testability and clean architectural boundaries.

start with 80%
AI-Native

Context-Rich for LLM Agents

Most systems are "black boxes" to AI. Open Mercato is built specifically to be understood and extended by AI agents (Claude, Cursor, GitHub Copilot).

AGENTS.MD as a North Star

Each module contains a machine-readable manual defining extensibility contracts and coding standards.

"Open Mercato isn’t just another boilerplate; it is a foundation designed to be 'read' and 'extended' by AI agents without creating technical debt."
Source: How to Master AI-Assisted Coding with Open Mercato

Deterministic Mono-repo

By maintaining a consistent structure between API and UI, we provide agents with the full context they need to generate production-grade code instead of hallucinations.

Enterprise Security

Field-Level Protection

Build for FinTech or HealthTech with confidence. Security is not an afterthought; it is baked into the schema.

Tenant-Scoped Field-Level Encryption

Secure sensitive data at rest using AES-GCM encryption with unique keys per tenant.

"The core idea is to be open for extensions but closed for core modifications, achieved through build-time generators that scan enabled modules and allow overrides."
Source: OM - Architecture Webinar

Audit-Ready Command Pattern

Every write operation is a "Command." This provides native Audit Logs (Who/What/When) and enables complex features like Undo/Redo at the framework level.

DATA LAYER

Data Mastery & Multi-Tenancy

Hierarchical Multi-tenancy

Native support for complex organization trees. Every query and API call is automatically scoped by tenantId and organizationId.

The Custom Fields Layer

Empower power users or analysts to extend data models in real-time. Add fields, validators, and UI widgets through the admin panel without a single line of code or a database migration.

MikroORM & PostgreSQL

We utilize the industry-standard stack for performance, reliability, and ACID compliance.

DX

Developer Experience

Command Line Efficiency

Open Mercato init bootstraps a full environment including RBAC, sample data, and local databases in minutes.

Headless-First

While we provide a powerful Next.js UI, the core is a headless API platform. Your data is accessible via well-typed APIs for mobile apps or external frontends.

Built-in Reliability

Integrated Playwright testing suite designed to verify AI-generated features before they hit production.

start with 80%
MODULE STRUCTURE

The Anatomy of an Open Mercato Module

Unlike traditional ERPs where custom code is "hacked" into the core, an Open Mercato module is built for isolation and extensibility.

Full-Stack Scope

Each module delivers UI pages, validation logic, and database schemas (MikroORM) out of the box.

The Event Backbone

Modules communicate via an event-driven system. Want to trigger a Slack notification when a CRM Lead is created? Simply subscribe to the deal.created event in your custom module.

"The core idea is to be open for extensions but closed for core modifications, achieved through build-time generators that scan enabled modules and allow overrides.”

MODULE STRUCTURE

Open Mercato modules are not static plugins.

They are self-contained slices of the stack—including database entities, backend logic, API endpoints, and Next.js frontend components.

01

Infrastructure & Core Modules

These provide the "plumbing" and foundational services that every enterprise application requires.

  • Directory: Manages the multi-tenant core, including tenants, organization hierarchies (trees), and organization-level data filtering.
  • Auth: Handles authorization, session management, roles, and a powerful Feature-based RBAC (Role-Based Access Control) system.
  • Entities: The data management hub that provides the Custom Fields Layer, allowing runtime-defined fields and models without database migrations.
  • Encrypted Vault: Manages Tenant-Scoped Field-Level Encryption (AES-GCM) with unique keys per tenant for high-stakes security compliance.
  • Configuration: A centralized module for system-wide settings, overrides, and Feature Flags for managed feature rollouts.
  • Attachments: Handles file uploads and storage, including automatic OCR (Optical Character Recognition) for making images and PDFs searchable.
02

Performance & Data Processing

  • Query Index: A specialized engine that indexes both base and custom fields into flat tables to ensure high-performance reads even at enterprise scale.
  • Caching Mechanism: A tagging-based cache layer (primarily using Redis) that ensures high speed while providing safe, tag-based cache invalidation when data changes.
  • Auto Deluxe: Provides GDPR-compliant audit logging and the Undo/Redo functionality by tracking all operations through the Command Pattern.
  • Search Engine: Supports multiple search strategies, including full-text search and Vector Search (PGVector/ChromaDB) for AI-powered semantic discovery.
03

Business Domain Modules

These are the vertical-specific modules that provide ready-to-use business functionality.

  • CRM Foundation: Manages leads, customers (accounts), sales opportunities, and interaction timelines.
  • Catalog: A robust module for managing product catalogs, categories, and sales channel offers.
  • Sales Operations: Orchestrates orders, quotes, and negotiation flows, including shipping and payment provider integrations.
  • Workflows: Manages custom data lifecycles and document-driven processes tailored per tenant.
04

UX & Frontend

  • Design System: A dedicated UX module that keeps the design system separate, ensuring AI agents always generate UI that is consistent with the framework's look and feel.
MODULE STRUCTURE

I-Assisted Module Development

Open Mercato turns your AI (Claude, Cursor, Copilot) into a Senior Architect who knows the codebase perfectly.

AGENTS.MD integration

Every module contains its own documentation designed specifically for LLMs.

Blueprint Generation

Use our CLI to generate a new module structure that is already compliant with our OCP (Open-Closed Principle) standards.

Context-Aware Coding

Because modules follow a strict pattern, AI agents can reliably generate new entities or API endpoints without "hallucinating" the folder structure.

Software is about to be built
completely differently.

Start with 80% done.
$ git clone https://github.com/open-mercato/open-mercato.git
Clone the Repo