# furqanalishah/differ architecture

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

- Interactive diagram: https://gitdiagram.com/furqanalishah/differ
- Repository: https://github.com/furqanalishah/differ

## Overview

Differ is a terminal Git diff viewer. The main workflow loads Git changes, parses unified diff text into display rows, and presents them in an interactive terminal view with navigation, search, review marks, and optional sidebar. The README documents additional viewing modes and controls; sampled source confirms the main loading, parsing, and app structure, while some UI behavior is only partially excerpted.

Main entry points: [`app.go`](https://github.com/furqanalishah/differ/blob/main/app.go) (Viewer state), [`main.go`](https://github.com/furqanalishah/differ/blob/main/main.go) (CLI and setup), [`git.go`](https://github.com/furqanalishah/differ/blob/main/git.go) (Git diff loader), [`diff.go`](https://github.com/furqanalishah/differ/blob/main/diff.go) (Diff parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_loading["Diff loading"]
  node_entry["CLI and setup<br/>[main.go]"]
  node_reload["Reload callback<br/>[main.go]"]
  node_git["Git diff loader<br/>[git.go]"]
  node_parser["Diff parser<br/>[diff.go]"]
end

subgraph group_viewer["Interactive viewer"]
  node_app["Viewer state<br/>[app.go]"]
  node_navigation["File navigation<br/>[app.go]"]
  node_search["Regex search<br/>[app.go]"]
  node_review["Viewed tracking<br/>[app.go]"]
  node_sidebar["File sidebar<br/>[sidebar.go]"]
end

subgraph group_terminal["Terminal interface"]
  node_render["Diff rendering<br/>[app.go]"]
end

node_user(("User"))
node_repository[("Git repository")]
node_screen["Terminal screen"]

node_user -->|"starts"| node_entry
node_entry -->|"creates"| node_reload
node_entry -->|"initial load"| node_git
node_git -->|"reads diff"| node_repository
node_git -->|"returns text"| node_reload
node_reload -->|"parses output"| node_parser
node_entry -->|"starts viewer"| node_app
node_app -->|"refreshes via"| node_reload
node_parser -->|"provides rows"| node_app
node_app -->|"handles movement"| node_navigation
node_app -->|"handles queries"| node_search
node_app -->|"tracks marks"| node_review
node_app -->|"builds file list"| node_sidebar
node_app -->|"draws view"| node_render
node_render -->|"updates display"| node_screen
node_screen -->|"delivers input"| node_app

click node_entry "https://github.com/furqanalishah/differ/blob/main/main.go"
click node_reload "https://github.com/furqanalishah/differ/blob/main/main.go"
click node_git "https://github.com/furqanalishah/differ/blob/main/git.go"
click node_parser "https://github.com/furqanalishah/differ/blob/main/diff.go"
click node_app "https://github.com/furqanalishah/differ/blob/main/app.go"
click node_navigation "https://github.com/furqanalishah/differ/blob/main/app.go"
click node_search "https://github.com/furqanalishah/differ/blob/main/app.go"
click node_review "https://github.com/furqanalishah/differ/blob/main/app.go"
click node_sidebar "https://github.com/furqanalishah/differ/blob/main/sidebar.go"
click node_render "https://github.com/furqanalishah/differ/blob/main/app.go"

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_entry,node_reload,node_git,node_parser,node_user,node_screen toneBlue
class node_app,node_navigation,node_search,node_review,node_sidebar,node_repository toneAmber
class node_render toneMint
```

## Components

### Diff loading

- [CLI and setup](https://github.com/furqanalishah/differ/blob/main/main.go): `main.go`
- [Reload callback](https://github.com/furqanalishah/differ/blob/main/main.go): `main.go`
- [Git diff loader](https://github.com/furqanalishah/differ/blob/main/git.go): `git.go`
- [Diff parser](https://github.com/furqanalishah/differ/blob/main/diff.go): `diff.go`

### Interactive viewer

- [Viewer state](https://github.com/furqanalishah/differ/blob/main/app.go): `app.go`
- [File navigation](https://github.com/furqanalishah/differ/blob/main/app.go): `app.go`
- [Regex search](https://github.com/furqanalishah/differ/blob/main/app.go): `app.go`
- [Viewed tracking](https://github.com/furqanalishah/differ/blob/main/app.go): `app.go`
- [File sidebar](https://github.com/furqanalishah/differ/blob/main/sidebar.go): `sidebar.go`

### Terminal interface

- [Diff rendering](https://github.com/furqanalishah/differ/blob/main/app.go): `app.go`

### Other components

- **User**
- **Git repository**
- **Terminal screen**

## Connections

- User → CLI and setup: starts
- CLI and setup → Reload callback: creates
- CLI and setup → Git diff loader: initial load
- Git diff loader → Git repository: reads diff
- Git diff loader → Reload callback: returns text
- Reload callback → Diff parser: parses output
- CLI and setup → Viewer state: starts viewer
- Viewer state → Reload callback: refreshes via
- Diff parser → Viewer state: provides rows
- Viewer state → File navigation: handles movement
- Viewer state → Regex search: handles queries
- Viewer state → Viewed tracking: tracks marks
- Viewer state → File sidebar: builds file list
- Viewer state → Diff rendering: draws view
- Diff rendering → Terminal screen: updates display
- Terminal screen → Viewer state: delivers input
