Skip to content
Lower pricing Individual licenses are now $49/year for Studio, $25 for Core — See pricing →

Entity Relationship Diagram

Last updated:

Mermaid Studio provides full language support for Entity Relationship (ER) diagrams inside IntelliJ IDEA and other JetBrains IDEs, for designing and maintaining your data models alongside the code that uses them. ER diagrams document database structures and the relationships between tables.

Syntax highlighting integrates directly with IntelliJ’s color scheme system, so diagram colors always match your editor theme.

ER diagram syntax highlighting in Armada Dark theme

The summary below shows the IDE support Mermaid Studio ships for ER diagrams, grouped by capability.

IDE feature supportSelect a feature for its description.
Editing
Code Intelligence
Validation
Refactoring
Navigation & Docs
Preview
Visual Editing

A set of context-aware live templates scaffolds the entity blocks and relationship statements that ER diagrams use day-to-day. Type a short abbreviation, accept it from the completion popup, and tab through the template variables.

Individual abbreviations can be toggled under Settings > Tools > Mermaid Studio > Live Templates in the ER Diagram group. See Live Templates for the cross-cutting mechanics (triggering, contextual visibility, configuration).

The ent template scaffolds an entity with an attribute block; enta adds a display-name alias in brackets.

AbbreviationExpansion
entEntity with an attribute block
entaEntity with a display-name alias (NAME["Label"] { ... })

The rel template expands the cardinality as a picker variable, so you choose the shape on insert. The remaining templates each hard-code one cardinality for when you already know the relationship you want.

AbbreviationExpansion
relRelationship with a cardinality picker
rel1mOne-to-many, identifying (||--o{)
rel1mnOne-to-many, non-identifying (||..o{)
rel11One-to-one (||--||)
relmmMany-to-many (}o--o{)
rel01mZero-or-one to many (|o--o{)
rel1pmOne to one-or-more (||--|{)

Relationship cardinality:

  • || - Exactly one
  • o| - Zero or one
  • }| - One or more
  • o{ - Zero or more

Common patterns:

  • ||--o{ - One to many (optional)
  • ||--|{ - One to many (required)
  • }o--o{ - Many to many

Entity attributes:

erDiagram
USER {
int id PK
string email UK
int role_id FK
string name
}

Attribute modifiers: PK (primary key), FK (foreign key), UK (unique key)

For the complete syntax reference, see the Mermaid.js ER Diagram documentation.