The model
An application is described by one YAML document. Every tool reads the same document: both
generators, the eml command line, the modelling tool and the in-browser bundle.
Two forms, one meaning
| Form | File | Use it when |
|---|---|---|
| CEDM model | *.cedm.yaml, opens with cedm: | You want to import entities from the CEDM library and add your own. |
| Model document | *.eml.yaml, opens with eml: | You want to write every entity yourself. |
A CEDM model is lowered into a model document before it is compiled, so both forms generate the
same application. appwithai convert turns one into the other.
cedm: "1.0"
application:
name: Sales and Order Management
domain: sales
imports:
- module: common # the shared foundation: parties, places, currencies…
- entity: Customer
- entity: SalesOrder
ui:
categories:
- name: Sales
icon: badge-dollar-sign
entities: [Customer, SalesOrder]
What a model can declare
| Section (model document) | Declares |
|---|---|
entities | Records, their attributes, help text, form sections, icons and parent entities |
enums | Value lists, with labels and descriptions for each value |
relationships | How entities relate; the key goes on the right side automatically |
categories | How entities are grouped on the dashboard |
stateMachines | Which moves a record may make between states |
rules | Business rules on lifecycle events, compiled to GoRules decision graphs |
sagas | Multi-step processes, compiled to BPMN |
automations | A trigger, conditions that must all hold, and ordered steps |
rbac | Restrictions on operations and moves, by role |
hooks | Points where your own Rust code runs around reads and writes |
reports and dashboards | Read-only queries shipped with the application |
triggers | External events and schedules that call a handler |
A CEDM model expresses the same things in the library's terms: imports, entities, enums,
ui, authorization, rules, processes, automations, hooks, triggers, reports and
dashboards.
Checked before anything is generated
Reading a model runs three layers, in order:
- YAML. Version 1.2, and a duplicate key is an error, not a silent overwrite.
- The schema. What a document may contain, with types and allowed values.
- The checker. Cross-references the schema cannot express: an edge between two states that exist, a rule that reads only real columns, a report that is a single read.
Every finding names its document path, line and column. Many have an automatic repair that keeps the author's comments.
Help is part of the model
The help written on an entity, attribute, value or relationship becomes the application's
built-in help: on its window, its tab and every field. Write it for the person using the screen.