Architecture
Before enabling or removing a module, check what it requires and which modules rely on it. The dependency graph explains both relationships.
Open Mercato is composed of independent modules that you enable per app in apps/mercato/src/modules.ts. Most modules can be disabled freely – but a small subset of foundational modules are pulled in transitively because other modules declare them via ModuleInfo.requires. This page enumerates every module that ships in the monorepo, names its declared dependencies, and explains how the platform enforces the graph.
Version. This graph follows the development branch. On v0.10.0 the Akeneo integration requires sales where the newer manifest requires progress. Consult the module declaration in your installed version before changing enabled modules.
index.ts via metadata.requires: string[].yarn generate fails with a clear message if an enabled module's requires list references a module that is not enabled.mercato init, setupInitialTenant()) runs seedDefaults and seedExamples in dependency order derived from requires – see packages/shared/src/modules/setup.ts.Each module's root index.ts may export a ModuleInfo metadata object. The requires array names the module ids (the same id you'd put in enabledModules) that must be co-enabled:
// packages/core/src/modules/sales/index.ts
import type { ModuleInfo } from '@open-mercato/shared/modules/registry'
export const metadata: ModuleInfo = {
name: 'sales',
title: 'Sales Management',
version: '0.1.0',
description: 'Quoting, ordering, fulfillment, and billing.',
requires: ['catalog', 'customers', 'dictionaries'],
ejectable: true,
}
The shape lives in packages/shared/src/modules/registry.ts (ModuleInfo). Only the requires field participates in the dependency graph; the other fields (title, description, author, license, ejectable, …) are descriptive metadata.
The generator reads requires statically: it parses the module's index.ts (or the compiled index.js of a packaged module) and never executes it, so module side effects do not run and packaged TypeScript sources are supported. Only the exported metadata object counts, and requires must be an array of string literals. A declaration built dynamically – a spread, a constant, a computed entry – cannot be read; the generator prints a [generate] ⚠ warning naming the file and skips the check for that module rather than guessing.
The check runs at code-generation time, not at HTTP request time, but the effect on the running app is the same: if a required module is missing the generator refuses to write modules.generated.ts.
Module dependency check failed:
- Module "sales" requires: catalog, customers, dictionaries
Fix: Enable module 'catalog' in src/modules.ts.
Fix: Enable module 'customers' in src/modules.ts.
Fix: Enable module 'dictionaries' in src/modules.ts.
(See extractModuleRequiresFromSource and findMissingModuleRequires in packages/cli/src/lib/generators/module-registry.ts.) Because the generator emits the registry that the Next.js dispatcher imports, a failed yarn generate means the app cannot boot until the dependency is satisfied.
In addition, seedDefaults and seedExamples hooks in each module's setup.ts are executed in topological order derived from requires so that a dependent module sees the data its dependency seeded.
The tables below list the modules that ship in the monorepo and the create-app templates, including every module that declares or is the target of a requires edge (the edge list under Reading the graph is the complete, enforced set). The Requires column reproduces the module's declared metadata.requires; an empty cell means the module has no declared hard dependencies. Foundational marks modules that another module declares as a dependency – disabling one of these is only safe if every dependent module is also disabled.
@open-mercato/core)| Module id | Title | Requires | Foundational? |
|---|---|---|---|
api_docs | API Documentation | – | |
api_keys | API Keys | auth | |
attachments | Attachments | – | (catalog, documents, forms) |
audit_logs | Audit & Action Logs | – | |
auth | Authentication & Accounts | – | (api_keys, devices, documents, push_notifications) |
business_rules | Business Rules | – | (workflows) |
cart | Cart | catalog, sales, customer_groups, promotions | |
catalog | Product Catalog | attachments, currencies, dictionaries, entities | (cart, ecommerce, eudr, sales, sync_akeneo, wms) |
communication_channels | Communication Channels | progress | (channel_resend, channel_ses, channel_smtp, push_notifications) |
configs | Configuration | – | |
currencies | Currencies | – | (catalog) |
customer_accounts | Customer Identity & Portal Authentication | – | (ecommerce, forms, portal) |
customer_groups | Customer Groups & B2B Terms | – | (cart, ecommerce) |
customers | Customer Relationship Management | progress, dictionaries, feature_toggles | (sales, sync_excel, wms) |
dashboards | Admin Dashboards | – | |
data_sync | Data Sync | – | (sync_akeneo, sync_excel) |
devices | Devices | auth | (push_notifications) |
dictionaries | Shared Dictionaries | – | (catalog, customers, sales, staff) |
directory | Directory (Tenants & Organizations) | – | (documents) |
ecommerce | Ecommerce Stores | catalog, sales, customer_accounts, customer_groups | |
entities | Custom Entities & Fields | query_index | (catalog) |
eudr | EUDR Compliance | catalog | |
feature_toggles | Feature Toggles | – | (customers, portal, wms) |
forms | Forms | attachments, customer_accounts | |
inbox_ops | InboxOps – Email-to-ERP Agent | – | |
integrations | Integrations | – | (channel_resend, channel_ses, channel_smtp, push_notifications, sync_akeneo, tillio) |
messages | Messages | – | |
notifications | Notifications | – | (push_notifications) |
payment_gateways | Payment Gateways | – | |
perspectives | Table perspectives | – | |
phone_calls | Phone Calls | – | (tillio) |
planner | Worktime / Availabilities | – | (resources, staff) |
portal | Customer Portal | customer_accounts, feature_toggles | |
progress | Progress | – | (communication_channels, customers, sync_akeneo) |
promotions | Promotions | – | (cart) |
push_notifications | Push Notifications | auth, devices, notifications, communication_channels, integrations | |
query_index | Query Indexes | – | (entities) |
resources | Resource planning | planner | (staff) |
sales | Sales Management | catalog, customers, dictionaries | (cart, ecommerce, wms) |
shipping_carriers | Shipping Carriers | – | |
staff | Employees | planner, resources, dictionaries | |
sync_excel | Excel / CSV Import | customers, data_sync | |
translations | Entity Translations | – | |
wms | Warehouse Management System | catalog, customers, sales, feature_toggles | |
workflows | Workflow Engine | business_rules |
| Module id | Package | Requires | Foundational? |
|---|---|---|---|
ai_assistant | @open-mercato/ai-assistant | – | |
channel_resend | @open-mercato/channel-resend | communication_channels, integrations | |
channel_ses | @open-mercato/channel-ses | communication_channels, integrations | |
channel_smtp | @open-mercato/channel-smtp | communication_channels, integrations | |
checkout | @open-mercato/checkout | – | |
content | @open-mercato/content | – | |
documents | @open-mercato/documents | auth, directory, attachments | |
events | @open-mercato/events | – | |
gateway_stripe | @open-mercato/gateway-stripe | – | |
onboarding | @open-mercato/onboarding | – | |
scheduler | @open-mercato/scheduler | – | |
search | @open-mercato/search | – | |
sync_akeneo | @open-mercato/sync-akeneo | integrations, data_sync, catalog, progress | |
tillio | @open-mercato/tillio | integrations, phone_calls | |
webhooks | @open-mercato/webhooks | – |
@open-mercato/enterprise)Enterprise modules are off by default. Toggle them via OM_ENABLE_ENTERPRISE_MODULES, OM_ENABLE_ENTERPRISE_MODULES_SSO, OM_ENABLE_ENTERPRISE_MODULES_SECURITY, and OM_ENABLE_ENTERPRISE_MODULES_AGENTS.
| Module id | Title | Requires |
|---|---|---|
agent_orchestrator | Agent Orchestrator | – |
record_locks | Record Locking | – |
security | Security | – |
sso | Single Sign-On | – |
system_status_overlays | System Status Overlays | – |
These are scaffolded into new apps by create-app but are not enabled in the monorepo dev app.
| Module id | Package | Requires |
|---|---|---|
example | @open-mercato/create-app template | – |
example_customers_sync | @open-mercato/create-app template | – |
The current declared edges are:
api_keys → auth
cart → catalog, sales, customer_groups, promotions
catalog → attachments, currencies, dictionaries, entities
channel_resend → communication_channels, integrations
channel_ses → communication_channels, integrations
channel_smtp → communication_channels, integrations
communication_channels → progress
customers → progress, dictionaries, feature_toggles
devices → auth
documents → auth, directory, attachments
ecommerce → catalog, sales, customer_accounts, customer_groups
entities → query_index
eudr → catalog
forms → attachments, customer_accounts
portal → customer_accounts, feature_toggles
push_notifications → auth, devices, notifications, communication_channels, integrations
resources → planner
sales → catalog, customers, dictionaries
staff → planner, resources, dictionaries
sync_akeneo → integrations, data_sync, catalog, progress
sync_excel → customers, data_sync
tillio → integrations, phone_calls
wms → catalog, customers, sales, feature_toggles
workflows → business_rules
Transitive closures worth noting:
staff implicitly requires planner, resources, and dictionaries – and resources itself requires planner, so the effective set is { dictionaries, planner, resources, staff }.sync_akeneo implicitly requires what catalog requires, plus progress: { attachments, catalog, currencies, data_sync, dictionaries, entities, integrations, progress, query_index, sync_akeneo }. sales is an optional peer: when it is disabled, the importer skips channel-bound offers and prices and logs the sync_akeneo.sales_channels_unavailable warning.sales implicitly requires progress and feature_toggles too, since sales requires customers, which now requires progress, dictionaries, and feature_toggles.entities requires query_index because hybrid querying for custom entities is delegated to the query-index layer.A module that does not appear on the right-hand side of any arrow (no module has it as requires) is safe to remove from enabledModules without breaking another enabled module. That said, individual modules may still have soft runtime expectations (for example, a module's UI might link to another module's page) that the dependency graph does not capture – treat the graph as the floor, not the ceiling.
When you build a module that depends on another:
index.ts and add the dependency id to metadata.requires.yarn generate. If the dependency is not enabled in the consuming app, the generator will fail with the message above.setup.ts under seedDefaults/seedExamples; the platform already invokes those hooks in dependency order.AGENTS.md or matching framework/modules/<module>.mdx page so other contributors can discover it.Never reach across modules with direct ORM relationships – declare the dependency in requires and load data via the dependency's public services or the query engine. See AGENTS.md → Critical Rules → Architecture for the broader rule set.
modules, modulesInfo, and the generated registry.Previous: Glossary · Next: Track catalog price history and preview a reference price