Diagram Standards
Overview
All diagrams use Mermaid with the Catppuccin Mocha color theme. This creates a cohesive dark-mode aesthetic that renders well on GitHub and in documentation. File tree structures are the only exception and may use ASCII art (see Use ASCII for File Trees).
Rules
Choose the Right Diagram Type
Rule of thumb:
- Flowcharts show structure and routing -- "what connects to what"
- Sequence diagrams show ordered interactions -- "what happens in what order"
- ER diagrams show data shape -- "what entities exist and how they relate"
If a concept involves both structure and ordering, use a flowchart for the routing overview and a sequence diagram for the detailed request flow.
Use the Catppuccin Mocha Color Palette
Based on Catppuccin Mocha.
Base Colors:
Accent Colors:
When to Use Each Color:
Follow Flowchart Standards
Copy this template for all flowcharts:
Node Shapes:
Line Styles:
Class Definitions:
Add these class definitions and apply with the class directive:
Apply with the class directive -- never use classDef default.
Subgraph Styling:
Flowchart rules:
- Max 10-15 nodes per diagram
- Prefer LR (left-to-right) or TB for vertical flows
- Use
classDef+classfor styling -- never inlinestyleon individual nodes - Use semantic class names (
external,core,agent) -- neverclassDef default - Group related nodes with subgraphs
- Add a legend when using both solid and dashed lines
Follow Sequence Diagram Standards
Copy this template for all sequence diagrams:
Participants:
- Use short aliases with descriptive labels:
participant A as API - Order left-to-right by data flow: initiator -> intermediaries -> destination
- Max 7 participants -- break into multiple diagrams if more are needed
Messages:
Keep message labels short -- 3-5 words. Use the format Verb + object:
Grouping with rect Blocks:
Use rect blocks to visually group related phases in a flow. Use rgb(49, 50, 68) (Surface1) for the background -- not accent colors:
Guidelines:
- Max 3-4
rectblocks per diagram - Add a
Note overannotation inside each block to label the phase rectblocks cannot be nested
Control Flow Fragments:
Guidelines:
- Do not nest fragments more than 2 levels deep
Note overshould span exactly the relevant participants:Note over A,B: label- Do not use
Note left oforNote right of-- useNote overfor consistency
Sequence diagram rules:
- Max 7 participants, 15-20 messages
- Do not use
mirrorActors-- keep participants at the top only - Do not use activation boxes (
activate/deactivateor+/-) rectblocks usergb(49, 50, 68)(Surface1) -- not accent colors- All sequence diagrams require the full theme init block (11 variables)
Follow ER Diagram Standards
Copy this template for all ER diagrams:
When to Include Attributes:
Attribute Format:
When including attributes, use: type name marker "comment"
Markers:
Relationship Notation:
Use Mermaid's crow's foot notation:
Label every relationship with a verb:
ER diagram rules:
- Max 8-10 entities with attributes, 15 entities without
- For larger models, split by domain
- All ER diagrams require the theme init block (7 variables)
- Use PascalCase for entity names
Use ASCII for File Trees
File tree structures are the only exception to the Mermaid-only rule. ASCII art renders more clearly for directory hierarchies.
Use box-drawing characters for tree branches:
Characters:
Guidelines:
- Use consistent indentation (4 spaces per level)
- Keep trees focused -- show only relevant files
- Add comments sparingly if needed:
config.ts # main config
Follow General Rules
These apply to all diagram types:
- Always use the theme init block -- Never use default Mermaid colors
- Keep diagrams simple -- Stay within the complexity limits for each type
- Use clear, short labels -- 1-2 words per node, 3-5 words per message
- Break large diagrams up -- Split into multiple focused diagrams rather than cramming everything into one
- Use semantic class names --
external,core,agent, notblue,pink, ordefault - No inline
styleon individual nodes -- UseclassDef+classinstead - Consistent node shapes -- Services = rounded, databases = cylinder, events = rectangle
- Add a legend -- Explain solid vs dashed lines when both are used
- No
mirrorActors-- Keep participants at the top only - No activation boxes -- They add noise without clarity
rectblocks usergb(49, 50, 68)-- Not accent colors- PascalCase entity names -- Match model naming conventions
- Label every relationship -- Use a verb:
User ||--o{ Project : owns