Open MercatoDocsSearch docsAPI reference

Framework

Custom entities (EAV)

Use a custom entity when administrators need to define a new kind of record at runtime. Its definition describes the available fields, while each record holds values for that definition. Start with one real example before deciding which fields people may add later.

Beyond module-defined MikroORM entities, Open Mercato ships an Entities module that implements an Entity-Attribute-Value (EAV) store. It powers runtime configurable objects – think CRM-style records, dynamic forms, or metadata catalogs.

Definitions

import { defineFields, cf } from '@open-mercato/modules/dsl';

export const entities = [
  {
    id: 'example:todo',
    title: 'Example Todo',
    fields: defineFields([
      cf.enum('priority', {
        label: 'Priority',
        options: ['low', 'medium', 'high'],
      }),
      cf.boolean('blocked', { label: 'Blocked' }),
    ]),
  },
];

Values

Admin experience

Use custom entities when you need flexible data structures without shipping a new migration for every customer request.

Previous: Commands framework · Next: Dashboard widgets