# kartikekhurana/git-history-intelligence architecture

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

- Interactive diagram: https://gitdiagram.com/kartikekhurana/git-history-intelligence
- Repository: https://github.com/kartikekhurana/git-history-intelligence

## Overview

Git History Intelligence accepts a public GitHub repository and reports history-based hotspots, file coupling, ownership concentration, and pull-request risk. The main flow is dashboard request → API validation, limiting, and cache lookup → repository sync and commit-history parsing → analysis → displayed results. The dashboard also offers an interactive coupling map and a PR-risk form. README architecture and sampled imports support the main backend links; some dashboard wiring and analyzer implementations were not sampled, so uncertain links are omitted.

Main entry points: [`engine/api.py`](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/api.py) (API routes), [`dashboard/app/page.tsx`](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/app/page.tsx) (Dashboard), [`dashboard/components/Card.tsx`](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/Card.tsx) (Shared card), [`engine/repo.py`](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/repo.py) (Repository sync)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Dashboard"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_api_client["API client<br/>[api.ts]"]
  node_hotspots_ui["Hotspots view<br/>[HotspotsCard.tsx]"]
  node_coupling_ui["Coupling view<br/>[CouplingCard.tsx]"]
  node_coupling_map["Coupling map<br/>[CouplingGraph.tsx]"]
  node_graph_layout["Graph layout<br/>[GraphLayout.ts]"]
  node_bus_ui["Ownership view<br/>[BusFactorCard.tsx]"]
  node_risk_ui["PR risk form<br/>[PrRiskCard.tsx]"]
  node_card["Shared card<br/>[Card.tsx]"]
end

subgraph group_api["API and protection"]
  node_api_routes["API routes<br/>[api.py]"]
  node_rate_limiter["Rate limiter<br/>[tmp_ratelimit.py]"]
  node_result_cache[("Result cache<br/>[cache.py]")]
end

subgraph group_history["History ingestion"]
  node_repo_sync["Repository sync<br/>[repo.py]"]
  node_parser["Commit parser<br/>[parser.py]"]
  node_noise_filter["Noise filter<br/>[filter.py]"]
  node_commit_model["Commit model<br/>[models.py]"]
end

subgraph group_analysis["Analysis"]
  node_hotspots["Hotspot analysis<br/>[hotspots.py]"]
  node_coupling["File coupling<br/>[coupling.py]"]
  node_graph_builder["Graph builder<br/>[graph.py]"]
  node_bus_factor["Ownership analysis<br/>[bus_factor.py]"]
  node_pr_risk["PR risk analysis<br/>[pr_risk.py]"]
end

node_engineer(("Engineer"))
node_github[("GitHub")]

node_engineer -->|"submits repository"| node_dashboard
node_dashboard -.->|"requests data"| node_api_client
node_api_client -->|"calls API"| node_api_routes
node_api_routes -->|"enforces limits"| node_rate_limiter
node_api_routes -->|"checks and stores"| node_result_cache
node_api_routes -->|"loads history"| node_repo_sync
node_repo_sync -->|"clones or fetches"| node_github
node_repo_sync -->|"parses log"| node_parser
node_repo_sync -->|"filters files"| node_noise_filter
node_parser -->|"creates commits"| node_commit_model
node_api_routes -->|"computes hotspots"| node_hotspots
node_api_routes -->|"computes coupling"| node_coupling
node_api_routes -->|"builds graph"| node_graph_builder
node_api_routes -->|"computes ownership"| node_bus_factor
node_api_routes -->|"assesses changes"| node_pr_risk
node_pr_risk -->|"uses hotspot scores"| node_hotspots
node_pr_risk -->|"uses coupling data"| node_coupling
node_pr_risk -->|"uses area mapping"| node_bus_factor
node_dashboard -.->|"shows results"| node_hotspots_ui
node_dashboard -.->|"shows results"| node_coupling_ui
node_dashboard -.->|"renders graph"| node_coupling_map
node_coupling_map -->|"positions nodes"| node_graph_layout
node_dashboard -.->|"shows results"| node_bus_ui
node_dashboard -.->|"offers risk check"| node_risk_ui
node_risk_ui -->|"submits changed files"| node_api_client
node_hotspots_ui -->|"renders in"| node_card
node_coupling_ui -->|"renders in"| node_card
node_coupling_map -->|"renders in"| node_card
node_bus_ui -->|"renders in"| node_card
node_risk_ui -->|"renders in"| node_card

click node_dashboard "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/app/page.tsx"
click node_api_client "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/lib/api.ts"
click node_hotspots_ui "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/HotspotsCard.tsx"
click node_coupling_ui "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/CouplingCard.tsx"
click node_coupling_map "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/CouplingGraph.tsx"
click node_graph_layout "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/lib/GraphLayout.ts"
click node_bus_ui "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/BusFactorCard.tsx"
click node_risk_ui "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/PrRiskCard.tsx"
click node_card "https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/Card.tsx"
click node_api_routes "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/api.py"
click node_rate_limiter "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/tmp_ratelimit.py"
click node_result_cache "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/cache.py"
click node_repo_sync "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/repo.py"
click node_parser "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/parser.py"
click node_noise_filter "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/filter.py"
click node_commit_model "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/models.py"
click node_hotspots "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/hotspots.py"
click node_coupling "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/coupling.py"
click node_graph_builder "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/graph.py"
click node_bus_factor "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/bus_factor.py"
click node_pr_risk "https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/pr_risk.py"

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_dashboard,node_api_client,node_hotspots_ui,node_coupling_ui,node_coupling_map,node_graph_layout,node_bus_ui,node_risk_ui,node_card toneBlue
class node_api_routes,node_rate_limiter,node_result_cache,node_github toneAmber
class node_repo_sync,node_parser,node_noise_filter,node_commit_model toneMint
class node_hotspots,node_coupling,node_graph_builder,node_bus_factor,node_pr_risk toneRose
class node_engineer toneIndigo
```

## Components

### Dashboard

- [Dashboard](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/app/page.tsx): `dashboard/app/page.tsx`
- [API client](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/lib/api.ts): `dashboard/lib/api.ts`
- [Hotspots view](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/HotspotsCard.tsx): `dashboard/components/HotspotsCard.tsx`
- [Coupling view](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/CouplingCard.tsx): `dashboard/components/CouplingCard.tsx`
- [Coupling map](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/CouplingGraph.tsx): `dashboard/components/CouplingGraph.tsx`
- [Graph layout](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/lib/GraphLayout.ts): `dashboard/lib/GraphLayout.ts`
- [Ownership view](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/BusFactorCard.tsx): `dashboard/components/BusFactorCard.tsx`
- [PR risk form](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/PrRiskCard.tsx): `dashboard/components/PrRiskCard.tsx`
- [Shared card](https://github.com/kartikekhurana/git-history-intelligence/blob/main/dashboard/components/Card.tsx): `dashboard/components/Card.tsx`

### API and protection

- [API routes](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/api.py): `engine/api.py`
- [Rate limiter](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/tmp_ratelimit.py): `engine/tmp_ratelimit.py`
- [Result cache](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/cache.py): `engine/cache.py`

### History ingestion

- [Repository sync](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/repo.py): `engine/repo.py`
- [Commit parser](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/parser.py): `engine/parser.py`
- [Noise filter](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/filter.py): `engine/filter.py`
- [Commit model](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/models.py): `engine/models.py`

### Analysis

- [Hotspot analysis](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/hotspots.py): `engine/analyzers/hotspots.py`
- [File coupling](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/coupling.py): `engine/analyzers/coupling.py`
- [Graph builder](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/graph.py): `engine/analyzers/graph.py`
- [Ownership analysis](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/bus_factor.py): `engine/analyzers/bus_factor.py`
- [PR risk analysis](https://github.com/kartikekhurana/git-history-intelligence/blob/main/engine/analyzers/pr_risk.py): `engine/analyzers/pr_risk.py`

### Other components

- **Engineer**
- **GitHub**

## Connections

- Engineer → Dashboard: submits repository (evidence: `README.md`)
- Dashboard → API client: requests data
- API client → API routes: calls API (evidence: `README.md`)
- API routes → Rate limiter: enforces limits (evidence: `engine/api.py`)
- API routes → Result cache: checks and stores (evidence: `engine/api.py`)
- API routes → Repository sync: loads history (evidence: `engine/api.py`)
- Repository sync → GitHub: clones or fetches (evidence: `engine/repo.py`)
- Repository sync → Commit parser: parses log (evidence: `engine/repo.py`)
- Repository sync → Noise filter: filters files (evidence: `engine/repo.py`)
- Commit parser → Commit model: creates commits (evidence: `engine/parser.py`)
- API routes → Hotspot analysis: computes hotspots (evidence: `engine/api.py`)
- API routes → File coupling: computes coupling (evidence: `engine/api.py`)
- API routes → Graph builder: builds graph (evidence: `engine/api.py`)
- API routes → Ownership analysis: computes ownership (evidence: `engine/api.py`)
- API routes → PR risk analysis: assesses changes (evidence: `engine/api.py`)
- PR risk analysis → Hotspot analysis: uses hotspot scores (evidence: `engine/analyzers/pr_risk.py`)
- PR risk analysis → File coupling: uses coupling data (evidence: `engine/analyzers/pr_risk.py`)
- PR risk analysis → Ownership analysis: uses area mapping (evidence: `engine/analyzers/pr_risk.py`)
- Dashboard → Hotspots view: shows results
- Dashboard → Coupling view: shows results
- Dashboard → Coupling map: renders graph
- Coupling map → Graph layout: positions nodes (evidence: `dashboard/components/CouplingGraph.tsx`)
- Dashboard → Ownership view: shows results
- Dashboard → PR risk form: offers risk check
- PR risk form → API client: submits changed files (evidence: `dashboard/components/PrRiskCard.tsx`)
- Hotspots view → Shared card: renders in (evidence: `dashboard/components/HotspotsCard.tsx`)
- Coupling view → Shared card: renders in (evidence: `dashboard/components/CouplingCard.tsx`)
- Coupling map → Shared card: renders in (evidence: `dashboard/components/CouplingGraph.tsx`)
- Ownership view → Shared card: renders in (evidence: `dashboard/components/BusFactorCard.tsx`)
- PR risk form → Shared card: renders in (evidence: `dashboard/components/PrRiskCard.tsx`)
