# alexandergrooff/mermaid-ascii architecture

> Architecture diagram of the GitHub repository alexandergrooff/mermaid-ascii, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alexandergrooff/mermaid-ascii
- Repository: https://github.com/alexandergrooff/mermaid-ascii

## Overview

Mermaid ASCII accepts diagrams through a CLI or web form, detects the diagram type, parses it, and returns a text rendering. The main supported domains are flowcharts, sequence diagrams, and entity-relationship diagrams; graph rendering also supports width-aware compact retries. The graph distinguishes the documented entry points and domain stages. Internal layout details and some web-template interactions are not fully evidenced by the supplied excerpts, so they are not expanded into speculative connections.

Main entry points: [`pkg/render/diagram.go`](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/render/diagram.go) (Diagram dispatch), [`pkg/render/render.go`](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/render/render.go) (Render pipeline), [`cmd/root.go`](https://github.com/alexandergrooff/mermaid-ascii/blob/master/cmd/root.go) (CLI command), [`cmd/web.go`](https://github.com/alexandergrooff/mermaid-ascii/blob/master/cmd/web.go) (Web handler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_cli["CLI command<br/>[root.go]"]
  node_web["Web handler<br/>[web.go]"]
  node_web_ui["Web interface<br/>[index.tmpl]"]
end

subgraph group_render["Render orchestration"]
  node_config["Render config<br/>[config.go]"]
  node_render_flow["Render pipeline<br/>[render.go]"]
  node_type_adapter["Diagram dispatch<br/>[diagram.go]"]
end

subgraph group_graph["Flowcharts"]
  node_graph_parser["Flowchart parser<br/>[parse.go]"]
  node_graph_draw["Flowchart drawing<br/>[draw.go]"]
end

subgraph group_sequence["Sequence diagrams"]
  node_sequence_parser["Sequence parser<br/>[parser.go]"]
  node_sequence_renderer["Sequence renderer<br/>[renderer.go]"]
end

subgraph group_er["ER diagrams"]
  node_er_parser["ER parser<br/>[parser.go]"]
  node_er_renderer["ER renderer<br/>[renderer.go]"]
end

node_cli_user(("CLI user"))
node_web_user(("Web user"))

node_cli_user -->|"provides input"| node_cli
node_cli -->|"creates config"| node_config
node_cli -->|"renders diagram"| node_render_flow
node_render_flow -->|"detects and dispatches"| node_type_adapter
node_type_adapter -->|"parses flowchart"| node_graph_parser
node_type_adapter -->|"draws flowchart"| node_graph_draw
node_type_adapter -->|"parses sequence"| node_sequence_parser
node_type_adapter -->|"renders sequence"| node_sequence_renderer
node_type_adapter -->|"parses ER"| node_er_parser
node_type_adapter -->|"renders ER"| node_er_renderer
node_render_flow -->|"strips frontmatter"| node_config
node_web_user -.->|"submits diagram"| node_web_ui
node_web_ui -.->|"posts diagram"| node_web
node_web -->|"creates config"| node_config
node_web -->|"renders diagram"| node_render_flow

click node_cli "https://github.com/alexandergrooff/mermaid-ascii/blob/master/cmd/root.go"
click node_web "https://github.com/alexandergrooff/mermaid-ascii/blob/master/cmd/web.go"
click node_web_ui "https://github.com/alexandergrooff/mermaid-ascii/blob/master/templates/index.tmpl"
click node_config "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/diagram/config.go"
click node_render_flow "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/render/render.go"
click node_type_adapter "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/render/diagram.go"
click node_graph_parser "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/graph/parse.go"
click node_graph_draw "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/graph/draw.go"
click node_sequence_parser "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/sequence/parser.go"
click node_sequence_renderer "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/sequence/renderer.go"
click node_er_parser "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/er/parser.go"
click node_er_renderer "https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/er/renderer.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_web,node_web_ui,node_cli_user,node_web_user toneBlue
class node_config,node_render_flow,node_type_adapter toneAmber
class node_graph_parser,node_graph_draw toneMint
class node_sequence_parser,node_sequence_renderer toneRose
class node_er_parser,node_er_renderer toneIndigo
```

## Components

### Entry points

- [CLI command](https://github.com/alexandergrooff/mermaid-ascii/blob/master/cmd/root.go): `cmd/root.go`
- [Web handler](https://github.com/alexandergrooff/mermaid-ascii/blob/master/cmd/web.go): `cmd/web.go`
- [Web interface](https://github.com/alexandergrooff/mermaid-ascii/blob/master/templates/index.tmpl): `templates/index.tmpl`

### Render orchestration

- [Render config](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/diagram/config.go): `pkg/diagram/config.go`
- [Render pipeline](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/render/render.go): `pkg/render/render.go`
- [Diagram dispatch](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/render/diagram.go): `pkg/render/diagram.go`

### Flowcharts

- [Flowchart parser](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/graph/parse.go): `pkg/graph/parse.go`
- [Flowchart drawing](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/graph/draw.go): `pkg/graph/draw.go`

### Sequence diagrams

- [Sequence parser](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/sequence/parser.go): `pkg/sequence/parser.go`
- [Sequence renderer](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/sequence/renderer.go): `pkg/sequence/renderer.go`

### ER diagrams

- [ER parser](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/er/parser.go): `pkg/er/parser.go`
- [ER renderer](https://github.com/alexandergrooff/mermaid-ascii/blob/master/pkg/er/renderer.go): `pkg/er/renderer.go`

### Other components

- **CLI user**
- **Web user**

## Connections

- CLI user → CLI command: provides input (evidence: `README.md`)
- CLI command → Render config: creates config (evidence: `cmd/root.go`)
- CLI command → Render pipeline: renders diagram (evidence: `cmd/root.go`)
- Render pipeline → Diagram dispatch: detects and dispatches (evidence: `pkg/render/render.go`)
- Diagram dispatch → Flowchart parser: parses flowchart (evidence: `pkg/render/diagram.go`)
- Diagram dispatch → Flowchart drawing: draws flowchart (evidence: `pkg/render/diagram.go`)
- Diagram dispatch → Sequence parser: parses sequence (evidence: `pkg/render/diagram.go`)
- Diagram dispatch → Sequence renderer: renders sequence (evidence: `pkg/render/diagram.go`)
- Diagram dispatch → ER parser: parses ER (evidence: `pkg/render/diagram.go`)
- Diagram dispatch → ER renderer: renders ER (evidence: `pkg/render/diagram.go`)
- Render pipeline → Render config: strips frontmatter (evidence: `pkg/render/render.go`)
- Web user → Web interface: submits diagram (evidence: `README.md`)
- Web interface → Web handler: posts diagram (evidence: `cmd/web.go`)
- Web handler → Render config: creates config (evidence: `cmd/web.go`)
- Web handler → Render pipeline: renders diagram (evidence: `cmd/web.go`)
