# itsjunk02/git-hud architecture

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

- Interactive diagram: https://gitdiagram.com/itsjunk02/git-hud
- Repository: https://github.com/itsjunk02/git-hud

## Overview

git-hud is a local-first desktop Git HUD: users open repositories, inspect history and working-tree state, make Git changes, resolve conflicts, and review collaboration signals. The React UI communicates with a Tauri command/event boundary; a Rust engine reads and writes repositories with libgit2, while SQLite caches derived data. Other documented capabilities include background fetch/CI polling and a PTY-backed terminal. Backend command-to-engine wiring and some background-worker details are only partially excerpted, so those links are marked unverified where needed.

Main entry points: [`src/App.tsx`](https://github.com/itsjunk02/git-hud/blob/main/src/App.tsx) (Application Shell), [`src/services/tauri-ipc.ts`](https://github.com/itsjunk02/git-hud/blob/main/src/services/tauri-ipc.ts) (Typed IPC Client), [`src-tauri/src/lib.rs`](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/lib.rs) (Tauri Command Surface), [`src-tauri/src/engine/git.rs`](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/git.rs) (Git Repository Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace UI"]
  node_app["Application Shell<br/>[App.tsx]"]
  node_sidebar["Project Sidebar<br/>[Sidebar.tsx]"]
  node_workspace_hook["Workspace State<br/>[useWorkspace.ts]"]
  node_view_router["View Selection<br/>[views.ts]"]
  node_ipc["Typed IPC Client<br/>[tauri-ipc.ts]"]
  node_bindings["IPC Bindings<br/>[bindings.ts]"]
end

subgraph group_git_views["Git Views"]
  node_timeline["Commit Timeline<br/>[CommitTimeline.tsx]"]
  node_commit_detail["Commit Inspector<br/>[CommitDetail.tsx]"]
  node_changes["Changes Panel<br/>[ChangesPanel.tsx]"]
  node_conflicts_ui["Conflict Editor"]
  node_collab_ui["Collaboration Dashboard"]
  node_settings["Repository Settings<br/>[SettingsPanel.tsx]"]
  node_terminal_ui["Terminal Session"]
end

subgraph group_backend["Rust Backend"]
  node_tauri["Tauri Command Surface<br/>[lib.rs]"]
  node_git_engine["Git Repository Engine<br/>[git.rs]"]
  node_write_engine["Stage and Commit<br/>[writes.rs]"]
  node_conflict_engine["Conflict Resolution<br/>[conflicts.rs]"]
  node_model["Git Data Models<br/>[model.rs]"]
  node_stats["Contributor and DCO Stats<br/>[stats.rs]"]
  node_remote["Remote and CI<br/>[remote.rs]"]
  node_reviews["Review Metrics<br/>[reviews.rs]"]
end

subgraph group_ambient["Ambient Services"]
  node_sync["Background Sync<br/>[sync.rs]"]
  node_watcher["Repository Watcher<br/>[watcher.rs]"]
  node_terminal_engine["PTY Shell<br/>[terminal.rs]"]
end

subgraph group_storage["Local State"]
  node_cache[("SQLite Cache<br/>[cache.rs]")]
end

node_user(("User"))
node_github{{"GitHub via gh"}}
node_shell{{"System Shell"}}

node_user -->|"selects projects"| node_sidebar
node_sidebar -->|"manages workspace"| node_workspace_hook
node_app -->|"renders"| node_sidebar
node_app -->|"selects views"| node_view_router
node_app -->|"renders"| node_timeline
node_app -->|"renders"| node_commit_detail
node_app -->|"renders"| node_changes
node_app -->|"renders"| node_conflicts_ui
node_app -->|"renders"| node_collab_ui
node_app -->|"renders"| node_settings
node_app -->|"renders"| node_terminal_ui
node_workspace_hook -->|"calls commands"| node_ipc
node_timeline -->|"loads Git data"| node_ipc
node_changes -->|"stages and commits"| node_ipc
node_conflicts_ui -->|"resolves conflicts"| node_ipc
node_collab_ui -->|"loads collaboration"| node_ipc
node_settings -->|"accesses settings"| node_ipc
node_terminal_ui -->|"controls PTY"| node_ipc
node_ipc -->|"invokes generated commands"| node_bindings
node_ipc -->|"sends typed IPC"| node_tauri
node_tauri -.->|"dispatches Git reads"| node_git_engine
node_tauri -.->|"dispatches writes"| node_write_engine
node_tauri -.->|"dispatches resolutions"| node_conflict_engine
node_tauri -.->|"serves statistics"| node_stats
node_tauri -.->|"serves remote status"| node_remote
node_tauri -.->|"serves review data"| node_reviews
node_git_engine -->|"produces Git models"| node_model
node_git_engine -.->|"caches derived data"| node_cache
node_write_engine -->|"uses repository logic"| node_git_engine
node_conflict_engine -->|"uses blame attribution"| node_stats
node_remote -.->|"queries forge APIs"| node_github
node_reviews -->|"queries review API"| node_github
node_sync -.->|"polls remote status"| node_remote
node_watcher -->|"emits change events"| node_app
node_terminal_engine -->|"spawns PTY shell"| node_shell
node_terminal_ui -->|"streams PTY data"| node_terminal_engine
node_cache -->|"stores commit records"| node_model
node_cache -->|"stores CI status"| node_remote

click node_app "https://github.com/itsjunk02/git-hud/blob/main/src/App.tsx"
click node_sidebar "https://github.com/itsjunk02/git-hud/blob/main/src/components/Sidebar.tsx"
click node_workspace_hook "https://github.com/itsjunk02/git-hud/blob/main/src/hooks/useWorkspace.ts"
click node_view_router "https://github.com/itsjunk02/git-hud/blob/main/src/lib/views.ts"
click node_timeline "https://github.com/itsjunk02/git-hud/blob/main/src/components/CommitTimeline.tsx"
click node_commit_detail "https://github.com/itsjunk02/git-hud/blob/main/src/components/CommitDetail.tsx"
click node_changes "https://github.com/itsjunk02/git-hud/blob/main/src/components/ChangesPanel.tsx"
click node_conflicts_ui "https://github.com/itsjunk02/git-hud/blob/main/src/components/MergeConflictEditor.tsx"
click node_collab_ui "https://github.com/itsjunk02/git-hud/blob/main/src/components/CollaborationDashboard.tsx"
click node_settings "https://github.com/itsjunk02/git-hud/blob/main/src/components/SettingsPanel.tsx"
click node_terminal_ui "https://github.com/itsjunk02/git-hud/blob/main/src/components/TerminalSession.tsx"
click node_ipc "https://github.com/itsjunk02/git-hud/blob/main/src/services/tauri-ipc.ts"
click node_bindings "https://github.com/itsjunk02/git-hud/blob/main/src/services/bindings.ts"
click node_tauri "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/lib.rs"
click node_git_engine "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/git.rs"
click node_write_engine "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/writes.rs"
click node_conflict_engine "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/conflicts.rs"
click node_model "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/model.rs"
click node_stats "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/stats.rs"
click node_remote "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/remote.rs"
click node_reviews "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/reviews.rs"
click node_sync "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/sync.rs"
click node_watcher "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/watcher.rs"
click node_terminal_engine "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/terminal.rs"
click node_cache "https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/db/cache.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_app,node_sidebar,node_workspace_hook,node_view_router,node_ipc,node_bindings,node_user toneBlue
class node_timeline,node_commit_detail,node_changes,node_conflicts_ui,node_collab_ui,node_settings,node_terminal_ui toneAmber
class node_tauri,node_git_engine,node_write_engine,node_conflict_engine,node_model,node_stats,node_remote,node_reviews toneMint
class node_sync,node_watcher,node_terminal_engine toneRose
class node_cache,node_github,node_shell toneIndigo
```

## Components

### Workspace UI

- [Application Shell](https://github.com/itsjunk02/git-hud/blob/main/src/App.tsx): `src/App.tsx`
- [Project Sidebar](https://github.com/itsjunk02/git-hud/blob/main/src/components/Sidebar.tsx): `src/components/Sidebar.tsx`
- [Workspace State](https://github.com/itsjunk02/git-hud/blob/main/src/hooks/useWorkspace.ts): `src/hooks/useWorkspace.ts`
- [View Selection](https://github.com/itsjunk02/git-hud/blob/main/src/lib/views.ts): `src/lib/views.ts`
- [Typed IPC Client](https://github.com/itsjunk02/git-hud/blob/main/src/services/tauri-ipc.ts): `src/services/tauri-ipc.ts`
- [IPC Bindings](https://github.com/itsjunk02/git-hud/blob/main/src/services/bindings.ts): `src/services/bindings.ts`

### Git Views

- [Commit Timeline](https://github.com/itsjunk02/git-hud/blob/main/src/components/CommitTimeline.tsx): `src/components/CommitTimeline.tsx`
- [Commit Inspector](https://github.com/itsjunk02/git-hud/blob/main/src/components/CommitDetail.tsx): `src/components/CommitDetail.tsx`
- [Changes Panel](https://github.com/itsjunk02/git-hud/blob/main/src/components/ChangesPanel.tsx): `src/components/ChangesPanel.tsx`
- [Conflict Editor](https://github.com/itsjunk02/git-hud/blob/main/src/components/MergeConflictEditor.tsx): `src/components/MergeConflictEditor.tsx`
- [Collaboration Dashboard](https://github.com/itsjunk02/git-hud/blob/main/src/components/CollaborationDashboard.tsx): `src/components/CollaborationDashboard.tsx`
- [Repository Settings](https://github.com/itsjunk02/git-hud/blob/main/src/components/SettingsPanel.tsx): `src/components/SettingsPanel.tsx`
- [Terminal Session](https://github.com/itsjunk02/git-hud/blob/main/src/components/TerminalSession.tsx): `src/components/TerminalSession.tsx`

### Rust Backend

- [Tauri Command Surface](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`
- [Git Repository Engine](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/git.rs): `src-tauri/src/engine/git.rs`
- [Stage and Commit](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/writes.rs): `src-tauri/src/engine/writes.rs`
- [Conflict Resolution](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/conflicts.rs): `src-tauri/src/engine/conflicts.rs`
- [Git Data Models](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/model.rs): `src-tauri/src/engine/model.rs`
- [Contributor and DCO Stats](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/stats.rs): `src-tauri/src/engine/stats.rs`
- [Remote and CI](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/remote.rs): `src-tauri/src/engine/remote.rs`
- [Review Metrics](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/reviews.rs): `src-tauri/src/engine/reviews.rs`

### Ambient Services

- [Background Sync](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/sync.rs): `src-tauri/src/engine/sync.rs`
- [Repository Watcher](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/watcher.rs): `src-tauri/src/engine/watcher.rs`
- [PTY Shell](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/engine/terminal.rs): `src-tauri/src/engine/terminal.rs`

### Local State

- [SQLite Cache](https://github.com/itsjunk02/git-hud/blob/main/src-tauri/src/db/cache.rs): `src-tauri/src/db/cache.rs`

### Other components

- **User**
- **GitHub via gh**
- **System Shell**

## Connections

- User → Project Sidebar: selects projects
- Project Sidebar → Workspace State: manages workspace (evidence: `src/App.tsx`)
- Application Shell → Project Sidebar: renders (evidence: `src/App.tsx`)
- Application Shell → View Selection: selects views (evidence: `src/App.tsx`)
- Application Shell → Commit Timeline: renders (evidence: `src/App.tsx`)
- Application Shell → Commit Inspector: renders (evidence: `src/App.tsx`)
- Application Shell → Changes Panel: renders (evidence: `src/App.tsx`)
- Application Shell → Conflict Editor: renders (evidence: `src/App.tsx`)
- Application Shell → Collaboration Dashboard: renders (evidence: `src/App.tsx`)
- Application Shell → Repository Settings: renders (evidence: `src/App.tsx`)
- Application Shell → Terminal Session: renders (evidence: `src/App.tsx`)
- Workspace State → Typed IPC Client: calls commands (evidence: `src/hooks/useWorkspace.ts`)
- Commit Timeline → Typed IPC Client: loads Git data (evidence: `src/components/CommitTimeline.tsx`)
- Changes Panel → Typed IPC Client: stages and commits (evidence: `src/components/ChangesPanel.tsx`)
- Conflict Editor → Typed IPC Client: resolves conflicts (evidence: `src/components/MergeConflictEditor.tsx`)
- Collaboration Dashboard → Typed IPC Client: loads collaboration (evidence: `src/components/CollaborationDashboard.tsx`)
- Repository Settings → Typed IPC Client: accesses settings (evidence: `src/components/SettingsPanel.tsx`)
- Terminal Session → Typed IPC Client: controls PTY (evidence: `src/components/TerminalSession.tsx`)
- Typed IPC Client → IPC Bindings: invokes generated commands (evidence: `src/services/tauri-ipc.ts`)
- Typed IPC Client → Tauri Command Surface: sends typed IPC (evidence: `README.md`)
- Tauri Command Surface → Git Repository Engine: dispatches Git reads
- Tauri Command Surface → Stage and Commit: dispatches writes
- Tauri Command Surface → Conflict Resolution: dispatches resolutions
- Tauri Command Surface → Contributor and DCO Stats: serves statistics
- Tauri Command Surface → Remote and CI: serves remote status
- Tauri Command Surface → Review Metrics: serves review data
- Git Repository Engine → Git Data Models: produces Git models (evidence: `src-tauri/src/engine/git.rs`)
- Git Repository Engine → SQLite Cache: caches derived data
- Stage and Commit → Git Repository Engine: uses repository logic (evidence: `src-tauri/src/engine/writes.rs`)
- Conflict Resolution → Contributor and DCO Stats: uses blame attribution (evidence: `src-tauri/src/engine/conflicts.rs`)
- Remote and CI → GitHub via gh: queries forge APIs (evidence: `README.md`)
- Review Metrics → GitHub via gh: queries review API (evidence: `src-tauri/src/engine/reviews.rs`)
- Background Sync → Remote and CI: polls remote status
- Repository Watcher → Application Shell: emits change events (evidence: `README.md`)
- PTY Shell → System Shell: spawns PTY shell (evidence: `README.md`)
- Terminal Session → PTY Shell: streams PTY data (evidence: `README.md`)
- SQLite Cache → Git Data Models: stores commit records (evidence: `src-tauri/src/db/cache.rs`)
- SQLite Cache → Remote and CI: stores CI status (evidence: `src-tauri/src/db/cache.rs`)
