# bburda42dot/mdd-ui architecture

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

- Interactive diagram: https://gitdiagram.com/bburda42dot/mdd-ui
- Repository: https://github.com/bburda42dot/mdd-ui

## Overview

mdd-ui is a terminal browser and comparison tool for MDD diagnostic databases. Its main workflow loads an MDD file, extracts ECU data, builds a navigable diagnostic tree, and presents that tree with searchable, sortable detail tables; users can follow cell links and browse with keyboard or mouse. The CLI also supports comparing two databases and viewing or exporting the resulting diff. The graph combines documented capabilities with relationships visible in sampled source and the SOURCE INDEX; some UI wiring and unsampled feature internals are therefore represented at subsystem level.

Main entry points: [`src/main.rs`](https://github.com/bburda42dot/mdd-ui/blob/main/src/main.rs) (CLI commands), [`src/tree/mod.rs`](https://github.com/bburda42dot/mdd-ui/blob/main/src/tree/mod.rs) (Tree assembly), [`src/app/mod.rs`](https://github.com/bburda42dot/mdd-ui/blob/main/src/app/mod.rs) (App state and loop), [`src/diff/compare.rs`](https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/compare.rs) (Structural comparison)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI and loading"]
  node_cli["CLI commands<br/>[main.rs]"]
  node_loader["MDD loader<br/>[mod.rs]"]
  node_extract["Database extraction<br/>[reader.rs]"]
end

subgraph group_model["Diagnostic model"]
  node_tree["Tree assembly<br/>[mod.rs]"]
  node_treebuilder["Tree builder<br/>[builder.rs]"]
  node_elements["Diagnostic elements"]
end

subgraph group_browse["Interactive browser"]
  node_app["App state and loop<br/>[mod.rs]"]
  node_input["Keyboard and mouse<br/>[input.rs]"]
  node_navigation["Jump navigation<br/>[service.rs]"]
  node_search["Search and filters<br/>[search.rs]"]
  node_sorting["Sorting<br/>[sort.rs]"]
  node_render["Tree and detail rendering<br/>[composite.rs]"]
  node_detail["Detail tables<br/>[detail.rs]"]
end

subgraph group_compare["Database comparison"]
  node_snapshots["Database snapshots<br/>[snapshot.rs]"]
  node_comparison["Structural comparison<br/>[compare.rs]"]
  node_diffview["Diff tree view<br/>[diff_tree.rs]"]
  node_export["Diff export<br/>[export.rs]"]
end

node_user(("Terminal user"))
node_database[("MDD database")]
node_terminal["Terminal UI"]

node_user -->|"runs command"| node_cli
node_cli -->|"loads MDD"| node_loader
node_loader -->|"parses file"| node_database
node_cli -->|"builds tree"| node_tree
node_tree -->|"extracts data"| node_extract
node_tree -->|"assembles nodes"| node_treebuilder
node_tree -->|"adds elements"| node_elements
node_cli -->|"starts browser"| node_app
node_user -->|"sends input"| node_input
node_app -->|"renders interface"| node_render
node_app -->|"filters tree"| node_search
node_app -->|"sorts details"| node_sorting
node_input -.->|"navigates links"| node_navigation
node_navigation -->|"resolves targets"| node_tree
node_render -->|"renders details"| node_detail
node_user -->|"requests comparison"| node_cli
node_cli -->|"extracts snapshots"| node_snapshots
node_snapshots -->|"reads hierarchy"| node_database
node_cli -->|"compares snapshots"| node_comparison
node_comparison -->|"uses snapshots"| node_snapshots
node_cli -.->|"builds diff view"| node_diffview
node_diffview -->|"uses results"| node_comparison
node_cli -.->|"exports diff"| node_export
node_export -->|"formats results"| node_comparison
node_render -->|"draws interface"| node_terminal

click node_cli "https://github.com/bburda42dot/mdd-ui/blob/main/src/main.rs"
click node_loader "https://github.com/bburda42dot/mdd-ui/blob/main/src/database/mod.rs"
click node_extract "https://github.com/bburda42dot/mdd-ui/blob/main/src/database/reader.rs"
click node_tree "https://github.com/bburda42dot/mdd-ui/blob/main/src/tree/mod.rs"
click node_treebuilder "https://github.com/bburda42dot/mdd-ui/blob/main/src/tree/builder.rs"
click node_elements "https://github.com/bburda42dot/mdd-ui/tree/main/src/tree/elements/variants"
click node_app "https://github.com/bburda42dot/mdd-ui/blob/main/src/app/mod.rs"
click node_input "https://github.com/bburda42dot/mdd-ui/blob/main/src/app/input.rs"
click node_navigation "https://github.com/bburda42dot/mdd-ui/blob/main/src/app/navigation/service.rs"
click node_search "https://github.com/bburda42dot/mdd-ui/blob/main/src/app/search.rs"
click node_sorting "https://github.com/bburda42dot/mdd-ui/blob/main/src/app/sort.rs"
click node_render "https://github.com/bburda42dot/mdd-ui/blob/main/src/app/render/composite.rs"
click node_detail "https://github.com/bburda42dot/mdd-ui/blob/main/src/app/render/detail.rs"
click node_snapshots "https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/snapshot.rs"
click node_comparison "https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/compare.rs"
click node_diffview "https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/diff_tree.rs"
click node_export "https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/export.rs"

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_loader,node_extract,node_user,node_terminal toneBlue
class node_tree,node_treebuilder,node_elements,node_database toneAmber
class node_app,node_input,node_navigation,node_search,node_sorting,node_render,node_detail toneMint
class node_snapshots,node_comparison,node_diffview,node_export toneRose
```

## Components

### CLI and loading

- [CLI commands](https://github.com/bburda42dot/mdd-ui/blob/main/src/main.rs): `src/main.rs`
- [MDD loader](https://github.com/bburda42dot/mdd-ui/blob/main/src/database/mod.rs): `src/database/mod.rs`
- [Database extraction](https://github.com/bburda42dot/mdd-ui/blob/main/src/database/reader.rs): `src/database/reader.rs`

### Diagnostic model

- [Tree assembly](https://github.com/bburda42dot/mdd-ui/blob/main/src/tree/mod.rs): `src/tree/mod.rs`
- [Tree builder](https://github.com/bburda42dot/mdd-ui/blob/main/src/tree/builder.rs): `src/tree/builder.rs`
- [Diagnostic elements](https://github.com/bburda42dot/mdd-ui/tree/main/src/tree/elements/variants): `src/tree/elements/variants`

### Interactive browser

- [App state and loop](https://github.com/bburda42dot/mdd-ui/blob/main/src/app/mod.rs): `src/app/mod.rs`
- [Keyboard and mouse](https://github.com/bburda42dot/mdd-ui/blob/main/src/app/input.rs): `src/app/input.rs`
- [Jump navigation](https://github.com/bburda42dot/mdd-ui/blob/main/src/app/navigation/service.rs): `src/app/navigation/service.rs`
- [Search and filters](https://github.com/bburda42dot/mdd-ui/blob/main/src/app/search.rs): `src/app/search.rs`
- [Sorting](https://github.com/bburda42dot/mdd-ui/blob/main/src/app/sort.rs): `src/app/sort.rs`
- [Tree and detail rendering](https://github.com/bburda42dot/mdd-ui/blob/main/src/app/render/composite.rs): `src/app/render/composite.rs`
- [Detail tables](https://github.com/bburda42dot/mdd-ui/blob/main/src/app/render/detail.rs): `src/app/render/detail.rs`

### Database comparison

- [Database snapshots](https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/snapshot.rs): `src/diff/snapshot.rs`
- [Structural comparison](https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/compare.rs): `src/diff/compare.rs`
- [Diff tree view](https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/diff_tree.rs): `src/diff/diff_tree.rs`
- [Diff export](https://github.com/bburda42dot/mdd-ui/blob/main/src/diff/export.rs): `src/diff/export.rs`

### Other components

- **Terminal user**
- **MDD database**
- **Terminal UI**

## Connections

- Terminal user → CLI commands: runs command (evidence: `README.md`)
- CLI commands → MDD loader: loads MDD (evidence: `src/main.rs`)
- MDD loader → MDD database: parses file (evidence: `src/database/mod.rs`)
- CLI commands → Tree assembly: builds tree (evidence: `src/main.rs`)
- Tree assembly → Database extraction: extracts data (evidence: `src/tree/mod.rs`)
- Tree assembly → Tree builder: assembles nodes (evidence: `src/tree/mod.rs`)
- Tree assembly → Diagnostic elements: adds elements (evidence: `src/tree/mod.rs`)
- CLI commands → App state and loop: starts browser (evidence: `src/main.rs`)
- Terminal user → Keyboard and mouse: sends input (evidence: `README.md`)
- App state and loop → Tree and detail rendering: renders interface (evidence: `README.md`)
- App state and loop → Search and filters: filters tree (evidence: `src/app/mod.rs`)
- App state and loop → Sorting: sorts details (evidence: `src/app/mod.rs`)
- Keyboard and mouse → Jump navigation: navigates links
- Jump navigation → Tree assembly: resolves targets (evidence: `src/app/navigation/service.rs`)
- Tree and detail rendering → Detail tables: renders details (evidence: `src/app/render/mod.rs`)
- Terminal user → CLI commands: requests comparison (evidence: `README.md`)
- CLI commands → Database snapshots: extracts snapshots (evidence: `src/main.rs`)
- Database snapshots → MDD database: reads hierarchy (evidence: `src/diff/snapshot.rs`)
- CLI commands → Structural comparison: compares snapshots (evidence: `src/main.rs`)
- Structural comparison → Database snapshots: uses snapshots (evidence: `src/diff/compare.rs`)
- CLI commands → Diff tree view: builds diff view
- Diff tree view → Structural comparison: uses results (evidence: `src/diff/diff_tree.rs`)
- CLI commands → Diff export: exports diff
- Diff export → Structural comparison: formats results (evidence: `src/diff/export.rs`)
- Tree and detail rendering → Terminal UI: draws interface (evidence: `README.md`)
