# harshkapadia2/git-graph architecture

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

- Interactive diagram: https://gitdiagram.com/harshkapadia2/git-graph
- Repository: https://github.com/harshkapadia2/git-graph

## Overview

Git Graph is a browser-based visualizer for Commit, Tree, and Blob objects in a selected local .git directory. The main workflow reads branch information, parses objects for the chosen branch, formats them and their links, then renders an interactive graph. Users can switch branches, highlight commits and related objects, and inspect raw object contents. The graph follows documented capabilities and shown imports/calls; unsampled utility internals and any unshown wiring are not inferred.

Main entry points: [`src/components/App/App.jsx`](https://github.com/harshkapadia2/git-graph/blob/main/src/components/App/App.jsx) (App orchestration), [`src/components/GraphArea/GraphArea.jsx`](https://github.com/harshkapadia2/git-graph/blob/main/src/components/GraphArea/GraphArea.jsx) (Graph rendering), [`src/components/ObjectArea/ObjectArea.jsx`](https://github.com/harshkapadia2/git-graph/blob/main/src/components/ObjectArea/ObjectArea.jsx) (Object lanes), [`src/util/commonFns.js`](https://github.com/harshkapadia2/git-graph/blob/main/src/util/commonFns.js) (Git file access)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Repository workflow"]
  node_app["App orchestration<br/>[App.jsx]"]
end

subgraph group_parsing["Git object parsing"]
  node_branch_info["Branch discovery"]
  node_object_parser["Object traversal<br/>[generateObjects.js]"]
  node_git_file_access["Git file access<br/>[commonFns.js]"]
  node_object_formatter["Object formatting<br/>[formatObjects.js]"]
  node_connection_builder["Connection generation"]
  node_raw_reader["Raw object reader<br/>[objectRawData.js]"]
end

subgraph group_visualization["Graph visualization"]
  node_graph_area["Graph rendering<br/>[GraphArea.jsx]"]
  node_object_area["Object lanes<br/>[ObjectArea.jsx]"]
  node_git_object["Git object view<br/>[GitObject.jsx]"]
  node_id_helper["Object ID helper<br/>[generateId.js]"]
  node_coloring["Highlight propagation<br/>[coloring.js]"]
end

subgraph group_interaction["User interaction"]
  node_branch_selector["Branch selector<br/>[BranchSelector.jsx]"]
  node_commit_selector["Commit selector<br/>[CommitSelector.jsx]"]
  node_raw_display["Raw data display<br/>[RawDataDisplay.jsx]"]
end

subgraph group_presentation["Status and display"]
  node_intro["Usage introduction<br/>[IntroMsg.jsx]"]
  node_error_view["Error messages<br/>[ErrorMsg.jsx]"]
  node_loader["Loading indicator<br/>[Loader.jsx]"]
  node_back_to_top["Back to top<br/>[BackToTop.jsx]"]
end

node_user(("Repository user"))

node_user -->|"selects repository"| node_app
node_app -->|"loads branches"| node_branch_info
node_app -->|"parses branch"| node_object_parser
node_app -->|"formats objects"| node_object_formatter
node_app -->|"builds links"| node_connection_builder
node_app -->|"updates highlights"| node_coloring
node_app -->|"requests raw data"| node_raw_reader
node_object_parser -->|"reads Git objects"| node_git_file_access
node_branch_info -->|"reads branch refs"| node_git_file_access
node_raw_reader -->|"reads object data"| node_git_file_access
node_app -->|"renders graph"| node_graph_area
node_graph_area -->|"renders object lanes"| node_object_area
node_object_area -->|"renders objects"| node_git_object
node_object_area -->|"creates blob IDs"| node_id_helper
node_coloring -->|"matches blob IDs"| node_id_helper
node_graph_area -->|"sends raw selection"| node_app
node_git_object -->|"reports raw selection"| node_app
node_app -->|"renders selector"| node_branch_selector
node_branch_selector -->|"chooses branch"| node_app
node_app -->|"renders selector"| node_commit_selector
node_commit_selector -->|"submits commits"| node_app
node_app -->|"renders raw data"| node_raw_display
node_app -->|"renders introduction"| node_intro
node_app -->|"renders errors"| node_error_view
node_app -->|"renders loading state"| node_loader
node_app -->|"renders control"| node_back_to_top

click node_app "https://github.com/harshkapadia2/git-graph/blob/main/src/components/App/App.jsx"
click node_branch_info "https://github.com/harshkapadia2/git-graph/blob/main/src/util/generateBranchInfo.js"
click node_object_parser "https://github.com/harshkapadia2/git-graph/blob/main/src/util/generateObjects.js"
click node_git_file_access "https://github.com/harshkapadia2/git-graph/blob/main/src/util/commonFns.js"
click node_object_formatter "https://github.com/harshkapadia2/git-graph/blob/main/src/util/formatObjects.js"
click node_connection_builder "https://github.com/harshkapadia2/git-graph/blob/main/src/util/generateConnections.js"
click node_raw_reader "https://github.com/harshkapadia2/git-graph/blob/main/src/util/objectRawData.js"
click node_graph_area "https://github.com/harshkapadia2/git-graph/blob/main/src/components/GraphArea/GraphArea.jsx"
click node_object_area "https://github.com/harshkapadia2/git-graph/blob/main/src/components/ObjectArea/ObjectArea.jsx"
click node_git_object "https://github.com/harshkapadia2/git-graph/blob/main/src/components/GitObject/GitObject.jsx"
click node_id_helper "https://github.com/harshkapadia2/git-graph/blob/main/src/util/generateId.js"
click node_coloring "https://github.com/harshkapadia2/git-graph/blob/main/src/util/coloring.js"
click node_branch_selector "https://github.com/harshkapadia2/git-graph/blob/main/src/components/BranchSelector/BranchSelector.jsx"
click node_commit_selector "https://github.com/harshkapadia2/git-graph/blob/main/src/components/CommitSelector/CommitSelector.jsx"
click node_raw_display "https://github.com/harshkapadia2/git-graph/blob/main/src/components/RawDataDisplay/RawDataDisplay.jsx"
click node_intro "https://github.com/harshkapadia2/git-graph/blob/main/src/components/IntroMsg/IntroMsg.jsx"
click node_error_view "https://github.com/harshkapadia2/git-graph/blob/main/src/components/ErrorMsg/ErrorMsg.jsx"
click node_loader "https://github.com/harshkapadia2/git-graph/blob/main/src/components/Loader/Loader.jsx"
click node_back_to_top "https://github.com/harshkapadia2/git-graph/blob/main/src/components/BackToTop/BackToTop.jsx"

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_user toneBlue
class node_branch_info,node_object_parser,node_git_file_access,node_object_formatter,node_connection_builder,node_raw_reader toneAmber
class node_graph_area,node_object_area,node_git_object,node_id_helper,node_coloring toneMint
class node_branch_selector,node_commit_selector,node_raw_display toneRose
class node_intro,node_error_view,node_loader,node_back_to_top toneIndigo
```

## Components

### Repository workflow

- [App orchestration](https://github.com/harshkapadia2/git-graph/blob/main/src/components/App/App.jsx): `src/components/App/App.jsx`

### Git object parsing

- [Branch discovery](https://github.com/harshkapadia2/git-graph/blob/main/src/util/generateBranchInfo.js): `src/util/generateBranchInfo.js`
- [Object traversal](https://github.com/harshkapadia2/git-graph/blob/main/src/util/generateObjects.js): `src/util/generateObjects.js`
- [Git file access](https://github.com/harshkapadia2/git-graph/blob/main/src/util/commonFns.js): `src/util/commonFns.js`
- [Object formatting](https://github.com/harshkapadia2/git-graph/blob/main/src/util/formatObjects.js): `src/util/formatObjects.js`
- [Connection generation](https://github.com/harshkapadia2/git-graph/blob/main/src/util/generateConnections.js): `src/util/generateConnections.js`
- [Raw object reader](https://github.com/harshkapadia2/git-graph/blob/main/src/util/objectRawData.js): `src/util/objectRawData.js`

### Graph visualization

- [Graph rendering](https://github.com/harshkapadia2/git-graph/blob/main/src/components/GraphArea/GraphArea.jsx): `src/components/GraphArea/GraphArea.jsx`
- [Object lanes](https://github.com/harshkapadia2/git-graph/blob/main/src/components/ObjectArea/ObjectArea.jsx): `src/components/ObjectArea/ObjectArea.jsx`
- [Git object view](https://github.com/harshkapadia2/git-graph/blob/main/src/components/GitObject/GitObject.jsx): `src/components/GitObject/GitObject.jsx`
- [Object ID helper](https://github.com/harshkapadia2/git-graph/blob/main/src/util/generateId.js): `src/util/generateId.js`
- [Highlight propagation](https://github.com/harshkapadia2/git-graph/blob/main/src/util/coloring.js): `src/util/coloring.js`

### User interaction

- [Branch selector](https://github.com/harshkapadia2/git-graph/blob/main/src/components/BranchSelector/BranchSelector.jsx): `src/components/BranchSelector/BranchSelector.jsx`
- [Commit selector](https://github.com/harshkapadia2/git-graph/blob/main/src/components/CommitSelector/CommitSelector.jsx): `src/components/CommitSelector/CommitSelector.jsx`
- [Raw data display](https://github.com/harshkapadia2/git-graph/blob/main/src/components/RawDataDisplay/RawDataDisplay.jsx): `src/components/RawDataDisplay/RawDataDisplay.jsx`

### Status and display

- [Usage introduction](https://github.com/harshkapadia2/git-graph/blob/main/src/components/IntroMsg/IntroMsg.jsx): `src/components/IntroMsg/IntroMsg.jsx`
- [Error messages](https://github.com/harshkapadia2/git-graph/blob/main/src/components/ErrorMsg/ErrorMsg.jsx): `src/components/ErrorMsg/ErrorMsg.jsx`
- [Loading indicator](https://github.com/harshkapadia2/git-graph/blob/main/src/components/Loader/Loader.jsx): `src/components/Loader/Loader.jsx`
- [Back to top](https://github.com/harshkapadia2/git-graph/blob/main/src/components/BackToTop/BackToTop.jsx): `src/components/BackToTop/BackToTop.jsx`

### Other components

- **Repository user**

## Connections

- Repository user → App orchestration: selects repository (evidence: `src/components/App/App.jsx`)
- App orchestration → Branch discovery: loads branches (evidence: `src/components/App/App.jsx`)
- App orchestration → Object traversal: parses branch (evidence: `src/components/App/App.jsx`)
- App orchestration → Object formatting: formats objects (evidence: `src/components/App/App.jsx`)
- App orchestration → Connection generation: builds links (evidence: `src/components/App/App.jsx`)
- App orchestration → Highlight propagation: updates highlights (evidence: `src/components/App/App.jsx`)
- App orchestration → Raw object reader: requests raw data (evidence: `src/components/App/App.jsx`)
- Object traversal → Git file access: reads Git objects (evidence: `src/util/generateObjects.js`)
- Branch discovery → Git file access: reads branch refs (evidence: `src/util/generateBranchInfo.js`)
- Raw object reader → Git file access: reads object data (evidence: `src/util/objectRawData.js`)
- App orchestration → Graph rendering: renders graph (evidence: `src/components/App/App.jsx`)
- Graph rendering → Object lanes: renders object lanes (evidence: `src/components/GraphArea/GraphArea.jsx`)
- Object lanes → Git object view: renders objects (evidence: `src/components/ObjectArea/ObjectArea.jsx`)
- Object lanes → Object ID helper: creates blob IDs (evidence: `src/components/ObjectArea/ObjectArea.jsx`)
- Highlight propagation → Object ID helper: matches blob IDs (evidence: `src/util/coloring.js`)
- Graph rendering → App orchestration: sends raw selection (evidence: `src/components/GraphArea/GraphArea.jsx`)
- Git object view → App orchestration: reports raw selection (evidence: `src/components/GitObject/GitObject.jsx`)
- App orchestration → Branch selector: renders selector (evidence: `src/components/App/App.jsx`)
- Branch selector → App orchestration: chooses branch (evidence: `src/components/App/App.jsx`)
- App orchestration → Commit selector: renders selector (evidence: `src/components/App/App.jsx`)
- Commit selector → App orchestration: submits commits (evidence: `src/components/CommitSelector/CommitSelector.jsx`)
- App orchestration → Raw data display: renders raw data (evidence: `src/components/App/App.jsx`)
- App orchestration → Usage introduction: renders introduction (evidence: `src/components/App/App.jsx`)
- App orchestration → Error messages: renders errors (evidence: `src/components/App/App.jsx`)
- App orchestration → Loading indicator: renders loading state (evidence: `src/components/App/App.jsx`)
- App orchestration → Back to top: renders control (evidence: `src/components/App/App.jsx`)
