Skip to content
Limited Time 30% off Mermaid Studio — Get discount →

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 integrates directly with IntelliJ’s color scheme system, so diagram colors always match your editor theme.

Event modeling diagram syntax highlighting in Armada Dark theme

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 themeVariables keys 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 data blocks
  • Code formatter with composite-body indentation; configurable under Settings > Editor > Code Style > Mermaid > Event Modeling
  • Brace matching for inline data { ... } and named data ... { ... } blocks

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 ActionExecuted

Each frame declares an entity of one of five types. Short and long forms are interchangeable:

ShortLongMeaning
uiuiUI screen
cmdcommandCommand
evteventEvent
pcrprocessorProcessor
rmoreadmodelRead model

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.ItemAdded

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 ->> 03

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 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.