Last Updated: November 15, 2025
Mermaid Version: 11.4.1+
Total Diagrams: 82+ across 67+ files
Compliance: 100% production diagrams
MANDATORY REQUIREMENTS
Current State
Quality Metrics
| Metric | Status |
|---|---|
| Total diagrams | 82+ across 67+ files |
| ColorBrewer2 Set3 styled | 100% (all production files) |
| Modern syntax usage | 100% (all flowcharts) |
| Sequence diagrams themed | 100% |
| Average complexity | 34.0/100 (healthy, target < 50) |
Validation Status
- ✅ All diagrams pass
mmdcCLI validation - ✅ All sequence diagrams have ColorBrewer2 themes
- ✅ All user-facing flowcharts have ColorBrewer2 Set3 palette styling
- ✅ No syntax errors
ColorBrewer2 Set3 Palette (MANDATORY)
Complete Palette with Semantic Assignments
| Color | Hex Code | Stroke Color | Semantic Usage |
|---|---|---|---|
| Cyan | #8dd3c7 | #2a9d8f | External/clients/start nodes |
| Orange | #fdb462 | #e67e22 | Ingress/processing/middleware |
| Green | #b3de69 | #7cb342 | Application/execution/success |
| Red | #fb8072 | #e74c3c | LLM/critical paths/errors |
| Blue | #80b1d3 | #3498db | Data/storage/services |
| Yellow | #ffffb3 | #f1c40f | Decisions/observability |
| Purple | #bc80bd | #8e44ad | Secrets/special features |
| Lavender | #bebada | #7e5eb0 | Auth/security/clusters |
| Pink | #fccde5 | #ec7ab8 | External services/monitoring |
| Light Green | #ccebc5 | #82c99a | Results/dashboards |
| Gray | #d9d9d9 | #95a5a6 | Neutral/generic |
For Flowcharts/Graphs
Mandatory Pattern:For Sequence Diagrams
Mandatory Pattern:Modern Mermaid Syntax (MANDATORY)
Flowchart Syntax
- ✅ ALWAYS USE modern flowchart syntax:
Syntax Version Requirements
- Mermaid Version: 11.4.1+ (modern syntax required)
- Mintlify Support: Latest version supports all modern syntax
- Browser Compatibility: All modern browsers supported
Best Practices
Theme Initialization (Sequence Diagrams)
- ✅ ALWAYS start sequence diagrams with theme:
- ❌ DON’T use classDef in sequence diagrams (not supported)
Styling (Flowcharts/Graphs)
- ✅ USE classDef for reusable styles:
- ❌ AVOID inline styles (hard to maintain):
Complexity Management
Guidelines:- Nodes: Keep under 25 nodes per diagram
- Edges: Keep under 40 connections
- Nesting: Maximum 3 levels of subgraphs
- Complexity score: Target < 50
- Complexity score > 70: Must split
- Complexity score 50-70: Consider splitting
- Multiple concepts: Split by concern
Color Contrast (Accessibility)
WCAG 2.1 AA Compliance:- Text on light backgrounds:
color:#333(dark gray) - Text on dark backgrounds:
color:#fff(white) - Minimum contrast ratio: 4.5:1 for normal text
Our ColorBrewer2 palette is WCAG AA compliant
Diagram Templates
Template 1: Basic Flowchart with Styling
Template 2: Themed Sequence Diagram
Template 3: Deployment Architecture
Validation Tools
Validate All Diagrams
- Mermaid syntax correctness via
mmdcCLI - Renders each diagram to ensure no runtime errors
- Reports specific line numbers for errors
Fix Sequence Diagram classDef Issues
classDef statements from sequence diagrams.
Add Theme to Sequence Diagrams
Common Issues & Solutions
Issue 1: Diagram Not Rendering
Issue 1: Diagram Not Rendering
Symptoms: Blank space where diagram should beCommon Causes:
- Syntax error (run
mmdcto validate) - Invalid icon/character in labels
- Unclosed quotes
- Invalid HTML in labels (use
<not<)
Issue 2: classDef in Sequence Diagram
Issue 2: classDef in Sequence Diagram
Error:
Parse error... Expecting 'SEMI', 'NEWLINE'... got 'TXT'Cause: classDef/class statements don’t work in sequence diagramsSolution: Remove all classDef and class lines, use theme insteadIssue 3: Unescaped HTML Characters
Issue 3: Unescaped HTML Characters
Error:
Unexpected character '<' before nameCause: < must be escaped in MDX as <Solution: Replace < with < and > with >Quick Reference: Diagram Types
When to Use Each Type
Flowchart/Graph (flowchart TD/LR):
- System architecture
- Component relationships
- Infrastructure topology
- Data flow
- Deployment layouts
sequenceDiagram):
- API interactions
- Authentication flows
- Request/response cycles
- Multi-step processes
- Time-based interactions
stateDiagram-v2):
- Workflow states
- Lifecycle management
- State transitions
- Process status
Maintenance Schedule
Weekly
- Run
validate_all_mermaid.pyon changed files - Check for new unstyled diagrams
Monthly
- Review diagram complexity metrics
- Update themes if ColorBrewer2 palette changes
- Refactor overly complex diagrams
Quarterly
- Full validation of all diagrams
- Performance audit (rendering times)
- Accessibility review (contrast ratios)
Resources
Mermaid Documentation
Official Mermaid documentation and syntax reference
ColorBrewer2 Palettes
Explore ColorBrewer2 color palettes
Mermaid Live Editor
Test and preview Mermaid diagrams
WCAG Contrast Checker
Verify color contrast accessibility
Related Documentation
ADR-0055: Diagram Visualization Standards
Architectural decision record with rationale, compliance metrics, and academic references
Internal Validation Infrastructure
For maintainers: See
docs/.mintlify/MERMAID_OPTIMIZATION_GUIDE.md for validation scripts, pre-commit hook configuration, and migration historyQuality Status: 100% of production diagrams follow these standards (achieved 2025-11-15)