# chsnor/git_flowchart architecture

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

- Interactive diagram: https://gitdiagram.com/chsnor/git_flowchart
- Repository: https://github.com/chsnor/git_flowchart

## Overview

Git Flowchart turns a GitHub repository URL into an interactive source-relationship diagram: the user submits a repository, the server retrieves and analyzes its files, then the explorer presents the graph and lets the user inspect source. The README also documents node-link exploration and opening code. The sampled pipeline imports GitHub, parser, and generator modules, though several internal stages are only partially excerpted; those edges are grounded in the pipeline’s imports and calls. The request from the explorer to the API is shown as unverified because its request code was not excerpted.

Main entry points: [`src/components/FlowExplorer.tsx`](https://github.com/chsnor/git_flowchart/blob/main/src/components/FlowExplorer.tsx) (Flow explorer), [`src/lib/pipeline.ts`](https://github.com/chsnor/git_flowchart/blob/main/src/lib/pipeline.ts) (Analysis pipeline), [`src/app/page.tsx`](https://github.com/chsnor/git_flowchart/blob/main/src/app/page.tsx) (Home page), [`src/app/api/analyze/route.ts`](https://github.com/chsnor/git_flowchart/blob/main/src/app/api/analyze/route.ts) (Analysis endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Explorer UI"]
  node_home["Home page<br/>[page.tsx]"]
  node_explorer["Flow explorer<br/>[FlowExplorer.tsx]"]
end

subgraph group_analysis["Repository Analysis"]
  node_analyze_api["Analysis endpoint<br/>[route.ts]"]
  node_pipeline["Analysis pipeline<br/>[pipeline.ts]"]
  node_github["GitHub URL and API helpers<br/>[github.ts]"]
  node_parser["File and relation parser<br/>[parser.ts]"]
  node_generator["Flow element generator<br/>[generator.ts]"]
end

subgraph group_presentation["Graph and Code"]
  node_canvas["Interactive flow canvas<br/>[FlowCanvas.tsx]"]
  node_drawer["Source code drawer<br/>[SideDrawer.tsx]"]
  node_codeviewer["Code formatting and highlighting<br/>[code-viewer.ts]"]
end

subgraph group_support["Shared Utilities"]
  node_ui_helpers["URL and sharing helpers<br/>[ui-helper.ts]"]
  node_types["Analysis data types<br/>[index.ts]"]
end

node_user(("Repository visitor"))
node_github_service["GitHub API and raw content"]

node_user -->|"opens"| node_home
node_home -->|"renders"| node_explorer
node_user -->|"submits repository"| node_explorer
node_explorer -.->|"requests analysis"| node_analyze_api
node_analyze_api -->|"dispatches analysis"| node_pipeline
node_pipeline -->|"parses URL and builds API request"| node_github
node_pipeline -->|"fetches repository tree"| node_github_service
node_pipeline -->|"filters and analyzes files"| node_parser
node_pipeline -->|"builds graph elements"| node_generator
node_pipeline -->|"uses analysis models"| node_types
node_explorer -->|"renders graph"| node_canvas
node_explorer -->|"opens source view"| node_drawer
node_explorer -->|"decodes shared state"| node_ui_helpers
node_explorer -->|"builds source links"| node_github
node_explorer -->|"fetches selected file"| node_github_service
node_drawer -->|"formats and highlights"| node_codeviewer

click node_home "https://github.com/chsnor/git_flowchart/blob/main/src/app/page.tsx"
click node_explorer "https://github.com/chsnor/git_flowchart/blob/main/src/components/FlowExplorer.tsx"
click node_analyze_api "https://github.com/chsnor/git_flowchart/blob/main/src/app/api/analyze/route.ts"
click node_pipeline "https://github.com/chsnor/git_flowchart/blob/main/src/lib/pipeline.ts"
click node_github "https://github.com/chsnor/git_flowchart/blob/main/src/lib/github.ts"
click node_parser "https://github.com/chsnor/git_flowchart/blob/main/src/lib/parser.ts"
click node_generator "https://github.com/chsnor/git_flowchart/blob/main/src/lib/generator.ts"
click node_canvas "https://github.com/chsnor/git_flowchart/blob/main/src/components/FlowCanvas.tsx"
click node_drawer "https://github.com/chsnor/git_flowchart/blob/main/src/components/SideDrawer.tsx"
click node_codeviewer "https://github.com/chsnor/git_flowchart/blob/main/src/lib/code-viewer.ts"
click node_ui_helpers "https://github.com/chsnor/git_flowchart/blob/main/src/lib/ui-helper.ts"
click node_types "https://github.com/chsnor/git_flowchart/blob/main/src/types/index.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_home,node_explorer toneBlue
class node_analyze_api,node_pipeline,node_github,node_parser,node_generator toneAmber
class node_canvas,node_drawer,node_codeviewer,node_github_service toneMint
class node_ui_helpers,node_types toneRose
class node_user toneIndigo
```

## Components

### Explorer UI

- [Home page](https://github.com/chsnor/git_flowchart/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Flow explorer](https://github.com/chsnor/git_flowchart/blob/main/src/components/FlowExplorer.tsx): `src/components/FlowExplorer.tsx`

### Repository Analysis

- [Analysis endpoint](https://github.com/chsnor/git_flowchart/blob/main/src/app/api/analyze/route.ts): `src/app/api/analyze/route.ts`
- [Analysis pipeline](https://github.com/chsnor/git_flowchart/blob/main/src/lib/pipeline.ts): `src/lib/pipeline.ts`
- [GitHub URL and API helpers](https://github.com/chsnor/git_flowchart/blob/main/src/lib/github.ts): `src/lib/github.ts`
- [File and relation parser](https://github.com/chsnor/git_flowchart/blob/main/src/lib/parser.ts): `src/lib/parser.ts`
- [Flow element generator](https://github.com/chsnor/git_flowchart/blob/main/src/lib/generator.ts): `src/lib/generator.ts`

### Graph and Code

- [Interactive flow canvas](https://github.com/chsnor/git_flowchart/blob/main/src/components/FlowCanvas.tsx): `src/components/FlowCanvas.tsx`
- [Source code drawer](https://github.com/chsnor/git_flowchart/blob/main/src/components/SideDrawer.tsx): `src/components/SideDrawer.tsx`
- [Code formatting and highlighting](https://github.com/chsnor/git_flowchart/blob/main/src/lib/code-viewer.ts): `src/lib/code-viewer.ts`

### Shared Utilities

- [URL and sharing helpers](https://github.com/chsnor/git_flowchart/blob/main/src/lib/ui-helper.ts): `src/lib/ui-helper.ts`
- [Analysis data types](https://github.com/chsnor/git_flowchart/blob/main/src/types/index.ts): `src/types/index.ts`

### Other components

- **Repository visitor**
- **GitHub API and raw content**

## Connections

- Repository visitor → Home page: opens (evidence: `README.md`)
- Home page → Flow explorer: renders (evidence: `src/app/page.tsx`)
- Repository visitor → Flow explorer: submits repository (evidence: `README.md`)
- Flow explorer → Analysis endpoint: requests analysis
- Analysis endpoint → Analysis pipeline: dispatches analysis (evidence: `src/app/api/analyze/route.ts`)
- Analysis pipeline → GitHub URL and API helpers: parses URL and builds API request (evidence: `src/lib/pipeline.ts`)
- Analysis pipeline → GitHub API and raw content: fetches repository tree (evidence: `src/lib/pipeline.ts`)
- Analysis pipeline → File and relation parser: filters and analyzes files (evidence: `src/lib/pipeline.ts`)
- Analysis pipeline → Flow element generator: builds graph elements (evidence: `src/lib/pipeline.ts`)
- Analysis pipeline → Analysis data types: uses analysis models (evidence: `src/lib/pipeline.ts`)
- Flow explorer → Interactive flow canvas: renders graph (evidence: `src/components/FlowExplorer.tsx`)
- Flow explorer → Source code drawer: opens source view (evidence: `src/components/FlowExplorer.tsx`)
- Flow explorer → URL and sharing helpers: decodes shared state (evidence: `src/components/FlowExplorer.tsx`)
- Flow explorer → GitHub URL and API helpers: builds source links (evidence: `src/components/FlowExplorer.tsx`)
- Flow explorer → GitHub API and raw content: fetches selected file (evidence: `src/components/FlowExplorer.tsx`)
- Source code drawer → Code formatting and highlighting: formats and highlights (evidence: `src/components/SideDrawer.tsx`)
