# trygerz/git-visualizer architecture

> Architecture diagram of the GitHub repository trygerz/git-visualizer, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/trygerz/git-visualizer
- Repository: https://github.com/trygerz/git-visualizer

## Overview

GitVisualizer accepts a GitHub repository in its React UI, fetches and folds repository history through an Express API, then lays out and renders the commit DAG for interactive exploration. Users can search and filter commits, inspect contributor and file insights, open commit diffs, and request Gemini-generated reviews. The graph also supports branch coloring, folded-path expansion, and bilingual UI. Server-side cache and GitHub/Gemini integration are included; the excerpts do not establish every internal call, so unsupported links are omitted.

Main entry points: [`src/components/CommitGraph.tsx`](https://github.com/trygerz/git-visualizer/blob/main/src/components/CommitGraph.tsx) (Interactive graph), [`server.ts`](https://github.com/trygerz/git-visualizer/blob/main/server.ts) (API routes), [`src/components/GraphPanels.tsx`](https://github.com/trygerz/git-visualizer/blob/main/src/components/GraphPanels.tsx) (Graph insights), [`src/App.tsx`](https://github.com/trygerz/git-visualizer/blob/main/src/App.tsx) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Repository UI"]
  node_app["Application shell<br/>[App.tsx]"]
  node_repo_input["Repository input<br/>[RepoInput.tsx]"]
end

subgraph group_graph["Graph exploration"]
  node_commit_graph["Interactive graph<br/>[CommitGraph.tsx]"]
  node_commit_node["Commit node<br/>[CommitNode.tsx]"]
  node_folded_node["Folded paths<br/>[FoldedNode.tsx]"]
  node_elk_edge["Graph edges<br/>[ElkCustomEdge.tsx]"]
  node_graph_panels["Graph insights<br/>[GraphPanels.tsx]"]
  node_contributors["Contributor ranking"]
  node_contributor_panel["Contributor panel"]
  node_search["Commit search<br/>[SearchBar.tsx]"]
  node_context_menu["Commit actions"]
  node_ai_panel["AI review panel<br/>[AiSummaryPanel.tsx]"]
  node_layout["ELK layout<br/>[useElkLayout.ts]"]
  node_bounds["Graph bounds<br/>[useGraphBounds.ts]"]
  node_filter["Graph filtering<br/>[useGraphFilter.ts]"]
  node_commit_parser["Commit analysis<br/>[commitParser.ts]"]
  node_branch_color["Branch colors<br/>[getBranchColor.ts]"]
end

subgraph group_backend["Repository services"]
  node_server["API routes<br/>[server.ts]"]
  node_github_fetch["History processing<br/>[github.ts]"]
  node_cache["Response cache<br/>[cache.ts]"]
  node_gemini_service["Summary generation<br/>[gemini.ts]"]
end

subgraph group_integrations["External services"]
  node_github{{"GitHub API"}}
  node_gemini{{"Gemini API"}}
end

node_user(("Repository explorer"))

node_user -->|"enters repository"| node_repo_input
node_repo_input -->|"submits search"| node_app
node_app -->|"requests repository"| node_server
node_server -->|"fetches history"| node_github_fetch
node_github_fetch -->|"reads repository"| node_github
node_server -->|"checks and stores"| node_cache
node_server -->|"returns graph data"| node_app
node_app -->|"renders repository"| node_commit_graph
node_commit_graph -->|"computes layout"| node_layout
node_commit_graph -->|"filters visible graph"| node_filter
node_commit_graph -->|"computes bounds"| node_bounds
node_commit_graph -->|"renders commits"| node_commit_node
node_commit_graph -->|"renders folded paths"| node_folded_node
node_commit_graph -->|"renders edges"| node_elk_edge
node_commit_graph -->|"renders panels"| node_graph_panels
node_graph_panels -->|"renders ranking"| node_contributors
node_graph_panels -->|"renders contributors"| node_contributor_panel
node_graph_panels -->|"renders search"| node_search
node_commit_graph -->|"parses commit data"| node_commit_parser
node_commit_graph -->|"colors branches"| node_branch_color
node_commit_graph -->|"opens actions"| node_context_menu
node_context_menu -->|"requests summary view"| node_ai_panel
node_ai_panel -.->|"requests AI summary"| node_server
node_server -->|"generates summary"| node_gemini_service
node_gemini_service -.->|"calls model"| node_gemini
node_user -.->|"explores history"| node_commit_graph
node_commit_graph -->|"requests commit diff"| node_server

click node_app "https://github.com/trygerz/git-visualizer/blob/main/src/App.tsx"
click node_repo_input "https://github.com/trygerz/git-visualizer/blob/main/src/components/RepoInput.tsx"
click node_commit_graph "https://github.com/trygerz/git-visualizer/blob/main/src/components/CommitGraph.tsx"
click node_commit_node "https://github.com/trygerz/git-visualizer/blob/main/src/components/CommitNode.tsx"
click node_folded_node "https://github.com/trygerz/git-visualizer/blob/main/src/components/FoldedNode.tsx"
click node_elk_edge "https://github.com/trygerz/git-visualizer/blob/main/src/components/ElkCustomEdge.tsx"
click node_graph_panels "https://github.com/trygerz/git-visualizer/blob/main/src/components/GraphPanels.tsx"
click node_contributors "https://github.com/trygerz/git-visualizer/blob/main/src/components/ContributorLeaderboard.tsx"
click node_contributor_panel "https://github.com/trygerz/git-visualizer/blob/main/src/components/ContributorPanel.tsx"
click node_search "https://github.com/trygerz/git-visualizer/blob/main/src/components/SearchBar.tsx"
click node_context_menu "https://github.com/trygerz/git-visualizer/blob/main/src/components/NodeContextMenu.tsx"
click node_ai_panel "https://github.com/trygerz/git-visualizer/blob/main/src/components/AiSummaryPanel.tsx"
click node_layout "https://github.com/trygerz/git-visualizer/blob/main/src/hooks/useElkLayout.ts"
click node_bounds "https://github.com/trygerz/git-visualizer/blob/main/src/hooks/useGraphBounds.ts"
click node_filter "https://github.com/trygerz/git-visualizer/blob/main/src/hooks/useGraphFilter.ts"
click node_commit_parser "https://github.com/trygerz/git-visualizer/blob/main/src/lib/commitParser.ts"
click node_branch_color "https://github.com/trygerz/git-visualizer/blob/main/src/lib/getBranchColor.ts"
click node_server "https://github.com/trygerz/git-visualizer/blob/main/server.ts"
click node_github_fetch "https://github.com/trygerz/git-visualizer/blob/main/src/server/github.ts"
click node_cache "https://github.com/trygerz/git-visualizer/blob/main/src/server/cache.ts"
click node_gemini_service "https://github.com/trygerz/git-visualizer/blob/main/src/server/gemini.ts"

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_app,node_repo_input toneBlue
class node_commit_graph,node_commit_node,node_folded_node,node_elk_edge,node_graph_panels,node_contributors,node_contributor_panel,node_search,node_context_menu,node_ai_panel,node_layout,node_bounds,node_filter,node_commit_parser,node_branch_color toneAmber
class node_server,node_github_fetch,node_cache,node_gemini_service toneMint
class node_github,node_gemini toneRose
class node_user toneIndigo
```

## Components

### Repository UI

- [Application shell](https://github.com/trygerz/git-visualizer/blob/main/src/App.tsx): `src/App.tsx`
- [Repository input](https://github.com/trygerz/git-visualizer/blob/main/src/components/RepoInput.tsx): `src/components/RepoInput.tsx`

### Graph exploration

- [Interactive graph](https://github.com/trygerz/git-visualizer/blob/main/src/components/CommitGraph.tsx): `src/components/CommitGraph.tsx`
- [Commit node](https://github.com/trygerz/git-visualizer/blob/main/src/components/CommitNode.tsx): `src/components/CommitNode.tsx`
- [Folded paths](https://github.com/trygerz/git-visualizer/blob/main/src/components/FoldedNode.tsx): `src/components/FoldedNode.tsx`
- [Graph edges](https://github.com/trygerz/git-visualizer/blob/main/src/components/ElkCustomEdge.tsx): `src/components/ElkCustomEdge.tsx`
- [Graph insights](https://github.com/trygerz/git-visualizer/blob/main/src/components/GraphPanels.tsx): `src/components/GraphPanels.tsx`
- [Contributor ranking](https://github.com/trygerz/git-visualizer/blob/main/src/components/ContributorLeaderboard.tsx): `src/components/ContributorLeaderboard.tsx`
- [Contributor panel](https://github.com/trygerz/git-visualizer/blob/main/src/components/ContributorPanel.tsx): `src/components/ContributorPanel.tsx`
- [Commit search](https://github.com/trygerz/git-visualizer/blob/main/src/components/SearchBar.tsx): `src/components/SearchBar.tsx`
- [Commit actions](https://github.com/trygerz/git-visualizer/blob/main/src/components/NodeContextMenu.tsx): `src/components/NodeContextMenu.tsx`
- [AI review panel](https://github.com/trygerz/git-visualizer/blob/main/src/components/AiSummaryPanel.tsx): `src/components/AiSummaryPanel.tsx`
- [ELK layout](https://github.com/trygerz/git-visualizer/blob/main/src/hooks/useElkLayout.ts): `src/hooks/useElkLayout.ts`
- [Graph bounds](https://github.com/trygerz/git-visualizer/blob/main/src/hooks/useGraphBounds.ts): `src/hooks/useGraphBounds.ts`
- [Graph filtering](https://github.com/trygerz/git-visualizer/blob/main/src/hooks/useGraphFilter.ts): `src/hooks/useGraphFilter.ts`
- [Commit analysis](https://github.com/trygerz/git-visualizer/blob/main/src/lib/commitParser.ts): `src/lib/commitParser.ts`
- [Branch colors](https://github.com/trygerz/git-visualizer/blob/main/src/lib/getBranchColor.ts): `src/lib/getBranchColor.ts`

### Repository services

- [API routes](https://github.com/trygerz/git-visualizer/blob/main/server.ts): `server.ts`
- [History processing](https://github.com/trygerz/git-visualizer/blob/main/src/server/github.ts): `src/server/github.ts`
- [Response cache](https://github.com/trygerz/git-visualizer/blob/main/src/server/cache.ts): `src/server/cache.ts`
- [Summary generation](https://github.com/trygerz/git-visualizer/blob/main/src/server/gemini.ts): `src/server/gemini.ts`

### External services

- **GitHub API**
- **Gemini API**

### Other components

- **Repository explorer**

## Connections

- Repository explorer → Repository input: enters repository
- Repository input → Application shell: submits search (evidence: `src/App.tsx`)
- Application shell → API routes: requests repository (evidence: `src/App.tsx`)
- API routes → History processing: fetches history (evidence: `server.ts`)
- History processing → GitHub API: reads repository (evidence: `src/server/github.ts`)
- API routes → Response cache: checks and stores (evidence: `server.ts`)
- API routes → Application shell: returns graph data (evidence: `server.ts`)
- Application shell → Interactive graph: renders repository (evidence: `src/App.tsx`)
- Interactive graph → ELK layout: computes layout (evidence: `src/components/CommitGraph.tsx`)
- Interactive graph → Graph filtering: filters visible graph (evidence: `src/components/CommitGraph.tsx`)
- Interactive graph → Graph bounds: computes bounds (evidence: `src/components/CommitGraph.tsx`)
- Interactive graph → Commit node: renders commits (evidence: `src/components/CommitGraph.tsx`)
- Interactive graph → Folded paths: renders folded paths (evidence: `src/components/CommitGraph.tsx`)
- Interactive graph → Graph edges: renders edges (evidence: `src/components/CommitGraph.tsx`)
- Interactive graph → Graph insights: renders panels (evidence: `src/components/CommitGraph.tsx`)
- Graph insights → Contributor ranking: renders ranking (evidence: `src/components/GraphPanels.tsx`)
- Graph insights → Contributor panel: renders contributors (evidence: `src/components/GraphPanels.tsx`)
- Graph insights → Commit search: renders search (evidence: `src/components/GraphPanels.tsx`)
- Interactive graph → Commit analysis: parses commit data (evidence: `src/components/CommitGraph.tsx`)
- Interactive graph → Branch colors: colors branches (evidence: `src/components/CommitGraph.tsx`)
- Interactive graph → Commit actions: opens actions (evidence: `src/components/CommitGraph.tsx`)
- Commit actions → AI review panel: requests summary view (evidence: `src/components/NodeContextMenu.tsx`)
- AI review panel → API routes: requests AI summary
- API routes → Summary generation: generates summary (evidence: `server.ts`)
- Summary generation → Gemini API: calls model
- Repository explorer → Interactive graph: explores history
- Interactive graph → API routes: requests commit diff (evidence: `server.ts`)
