Event Modeling Diagram
Last updated:
Mermaid Studio provides language support for Event Modeling diagrams inside IntelliJ IDEA and other JetBrains IDEs. Event Modeling diagrams document event-driven systems as a sequence of frames showing UI screens, commands, events, processors, and read models, which is a natural fit for CQRS and event-sourcing designs.
Syntax Highlighting
Section titled “Syntax Highlighting”Syntax highlighting integrates directly with IntelliJ’s color scheme system, so diagram colors always match your editor theme.
IDE Support
Section titled “IDE Support”This is a basic-tier implementation focused on the essentials of editing Event Modeling source. Mermaid Studio provides:
- Syntax highlighting for frame ids, entity types, names, qualified names, and data blocks
- Frontmatter theme-variable completion for the diagram’s
themeVariableskeys inside the YAML config block - Rename refactoring for data block names, updating every reference across the diagram
- Find usages to locate every reference to a data block
- Code folding for
datablocks - Code formatter with composite-body indentation; configurable under Settings > Editor > Code Style > Mermaid > Event Modeling
- Brace matching for inline
data { ... }and nameddata ... { ... }blocks
Quick Syntax Reference
Section titled “Quick Syntax Reference”Frames
Section titled “Frames”Each frame is a numbered position in the sequence.
A target frame (tf) is a frame whose contents render; a reset frame (rf) clears the prior contents at that frame id without rendering.
eventmodeling tf 01 ui UI tf 02 cmd RunAction tf 03 evt ActionExecutedEntity types
Section titled “Entity types”Each frame declares an entity of one of five types. Short and long forms are interchangeable:
| Short | Long | Meaning |
|---|---|---|
ui | ui | UI screen |
cmd | command | Command |
evt | event | Event |
pcr | processor | Processor |
rmo | readmodel | Read model |
Qualified names
Section titled “Qualified names”Names can be qualified with a dot prefix to scope them to a bounded context:
eventmodeling tf 01 ui CartUI tf 02 cmd Inventory.AddItem tf 03 evt Inventory.ItemAddedSource frames
Section titled “Source frames”A tf declaration can list the source frames that feed into it using ->> arrows after the entity name:
eventmodeling tf 01 ui CartUI tf 02 cmd AddItem tf 03 cmd RemoveItem tf 04 evt ItemChanged ->> 02 ->> 03Data blocks
Section titled “Data blocks”Attach a data shape to a frame by referencing it with [[Name]] and declaring the shape elsewhere with a data block:
eventmodeling tf 01 cmd AddItem tf 02 evt ItemAdded [[ItemAddedData]]
data ItemAddedData{ productId: 7}Inline data is also supported when the shape is one-off and not reused:
eventmodeling tf 01 cmd AddItem { productId: 7 } tf 02 evt ItemAdded { productId: 7 }Standalone entity declarations
Section titled “Standalone entity declarations”Standalone entity Name declarations register an entity that frames can reference without a tf line.
Inline data can tag its format with a backtick prefix such as `jsobj` or `json`:
eventmodeling entity Inventory.Cart tf 01 ui CartUI tf 02 cmd AddItem `jsobj`{ a: { c: d } } tf 03 evt ItemAdded `json`{ "items": [{ "id": 1, "qty": 2 }] }For full syntax details, see the Mermaid Event Modeling documentation.