# zetaloop/desktop architecture

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

- Interactive diagram: https://gitdiagram.com/zetaloop/desktop
- Repository: https://github.com/zetaloop/desktop

## Overview

GitHub Desktop 中文版 is an Electron Git client for managing local repositories and working with GitHub. Users add or clone repositories, inspect branches, changes and history, then perform Git operations and interact with GitHub features such as pull requests and CI checks. The renderer presents repository workflows; the main process handles desktop integration, and shared state/models represent repository data. The README documents additional Copilot, Difftastic and localization enhancements. Several subsystems are represented from the tree and README rather than sampled implementation, so their connections are marked unverified.

Main entry points: [`app/src/ui/app.tsx`](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/app.tsx) (Desktop renderer), [`app/src/main-process/main.ts`](https://github.com/zetaloop/desktop/blob/l10n/app/src/main-process/main.ts) (Electron main), [`app/src/ui/clone-repository/clone-repository.tsx`](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/clone-repository/clone-repository.tsx) (Add and clone repositories), [`app/src/lib/git`](https://github.com/zetaloop/desktop/tree/l10n/app/src/lib/git) (Git operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop application"]
  node_main["Electron main<br/>[main.ts]"]
  node_renderer["Desktop renderer<br/>[app.tsx]"]
  node_dispatcher["Action dispatcher<br/>[dispatcher.ts]"]
  node_state["Application state<br/>[app-state.ts]"]
  node_popup["Dialogs and popups<br/>[popup.ts]"]
end

subgraph group_repo["Repository workflows"]
  node_repo_setup["Add and clone repositories"]
  node_changes["Working changes<br/>[changes.tsx]"]
  node_diff["Diff inspection<br/>[index.tsx]"]
  node_history["Commit history<br/>[index.ts]"]
  node_branches["Branches and PRs"]
  node_repository_model["Repository model<br/>[repository.ts]"]
  node_branch_model["Branch model<br/>[branch.ts]"]
end

subgraph group_github["GitHub collaboration"]
  node_ci["CI checks<br/>[ci-checks.ts]"]
end

subgraph group_platform["Git and platform services"]
  node_git["Git operations"]
  node_api["GitHub API<br/>[api.ts]"]
  node_account["GitHub accounts<br/>[account.ts]"]
  node_notifications["Desktop notifications<br/>[notifications.ts]"]
end

subgraph group_enhancements["Localized enhancements"]
  node_copilot["Copilot assistance<br/>[copilot-store.ts]"]
  node_difftastic["Difftastic integration<br/>[invoke-difft.ts]"]
  node_log_translation["Git output localization"]
  node_updater["Automatic updates"]
end

node_user(("Desktop user"))
node_github{{"GitHub services"}}

node_user -.->|"uses"| node_renderer
node_renderer -->|"dispatches actions"| node_dispatcher
node_renderer -->|"uses state"| node_state
node_renderer -->|"renders dialogs"| node_popup
node_renderer -->|"checks repository"| node_git
node_renderer -.->|"offers cloning"| node_repo_setup
node_renderer -.->|"presents changes"| node_changes
node_renderer -.->|"presents diffs"| node_diff
node_renderer -.->|"presents history"| node_history
node_renderer -.->|"presents branches"| node_branches
node_dispatcher -.->|"updates"| node_state
node_repository_model -->|"uses branch data"| node_branch_model
node_account -->|"uses API endpoints"| node_api
node_main -->|"initializes"| node_notifications
node_main -->|"notifies"| node_github
node_branches -.->|"shows check status"| node_ci
node_copilot -.->|"uses Copilot"| node_github
node_difftastic -.->|"integrates diff tool"| node_diff
node_log_translation -.->|"localizes output"| node_git
node_main -.->|"supports updates"| node_updater
node_repo_setup -->|"creates repositories"| node_git
node_repo_setup -->|"loads GitHub repositories"| node_api

click node_main "https://github.com/zetaloop/desktop/blob/l10n/app/src/main-process/main.ts"
click node_renderer "https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/app.tsx"
click node_dispatcher "https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/dispatcher/dispatcher.ts"
click node_state "https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/app-state.ts"
click node_popup "https://github.com/zetaloop/desktop/blob/l10n/app/src/models/popup.ts"
click node_repo_setup "https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/clone-repository/clone-repository.tsx"
click node_changes "https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/changes/changes.tsx"
click node_diff "https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/diff/index.tsx"
click node_history "https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/history/index.ts"
click node_branches "https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/branches/branches-container.tsx"
click node_repository_model "https://github.com/zetaloop/desktop/blob/l10n/app/src/models/repository.ts"
click node_branch_model "https://github.com/zetaloop/desktop/blob/l10n/app/src/models/branch.ts"
click node_git "https://github.com/zetaloop/desktop/tree/l10n/app/src/lib/git"
click node_api "https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/api.ts"
click node_account "https://github.com/zetaloop/desktop/blob/l10n/app/src/models/account.ts"
click node_notifications "https://github.com/zetaloop/desktop/blob/l10n/app/src/main-process/notifications.ts"
click node_ci "https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/ci-checks/ci-checks.ts"
click node_copilot "https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/stores/copilot-store.ts"
click node_difftastic "https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/difft/invoke-difft.ts"
click node_log_translation "https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/actions-log-parser/action-log-parser.ts"
click node_updater "https://github.com/zetaloop/desktop/blob/l10n/app/src/main-process/squirrel-updater.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_main,node_renderer,node_dispatcher,node_state,node_popup,node_user toneBlue
class node_repo_setup,node_changes,node_diff,node_history,node_branches,node_repository_model,node_branch_model toneAmber
class node_ci toneMint
class node_git,node_api,node_account,node_notifications toneRose
class node_copilot,node_difftastic,node_log_translation,node_updater,node_github toneIndigo
```

## Components

### Desktop application

- [Electron main](https://github.com/zetaloop/desktop/blob/l10n/app/src/main-process/main.ts): `app/src/main-process/main.ts`
- [Desktop renderer](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/app.tsx): `app/src/ui/app.tsx`
- [Action dispatcher](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/dispatcher/dispatcher.ts): `app/src/ui/dispatcher/dispatcher.ts`
- [Application state](https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/app-state.ts): `app/src/lib/app-state.ts`
- [Dialogs and popups](https://github.com/zetaloop/desktop/blob/l10n/app/src/models/popup.ts): `app/src/models/popup.ts`

### Repository workflows

- [Add and clone repositories](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/clone-repository/clone-repository.tsx): `app/src/ui/clone-repository/clone-repository.tsx`
- [Working changes](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/changes/changes.tsx): `app/src/ui/changes/changes.tsx`
- [Diff inspection](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/diff/index.tsx): `app/src/ui/diff/index.tsx`
- [Commit history](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/history/index.ts): `app/src/ui/history/index.ts`
- [Branches and PRs](https://github.com/zetaloop/desktop/blob/l10n/app/src/ui/branches/branches-container.tsx): `app/src/ui/branches/branches-container.tsx`
- [Repository model](https://github.com/zetaloop/desktop/blob/l10n/app/src/models/repository.ts): `app/src/models/repository.ts`
- [Branch model](https://github.com/zetaloop/desktop/blob/l10n/app/src/models/branch.ts): `app/src/models/branch.ts`

### GitHub collaboration

- [CI checks](https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/ci-checks/ci-checks.ts): `app/src/lib/ci-checks/ci-checks.ts`

### Git and platform services

- [Git operations](https://github.com/zetaloop/desktop/tree/l10n/app/src/lib/git): `app/src/lib/git`
- [GitHub API](https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/api.ts): `app/src/lib/api.ts`
- [GitHub accounts](https://github.com/zetaloop/desktop/blob/l10n/app/src/models/account.ts): `app/src/models/account.ts`
- [Desktop notifications](https://github.com/zetaloop/desktop/blob/l10n/app/src/main-process/notifications.ts): `app/src/main-process/notifications.ts`

### Localized enhancements

- [Copilot assistance](https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/stores/copilot-store.ts): `app/src/lib/stores/copilot-store.ts`
- [Difftastic integration](https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/difft/invoke-difft.ts): `app/src/lib/difft/invoke-difft.ts`
- [Git output localization](https://github.com/zetaloop/desktop/blob/l10n/app/src/lib/actions-log-parser/action-log-parser.ts): `app/src/lib/actions-log-parser/action-log-parser.ts`
- [Automatic updates](https://github.com/zetaloop/desktop/blob/l10n/app/src/main-process/squirrel-updater.ts): `app/src/main-process/squirrel-updater.ts`

### Other components

- **Desktop user**
- **GitHub services**

## Connections

- Desktop user → Desktop renderer: uses
- Desktop renderer → Action dispatcher: dispatches actions (evidence: `app/src/ui/app.tsx`)
- Desktop renderer → Application state: uses state (evidence: `app/src/ui/app.tsx`)
- Desktop renderer → Dialogs and popups: renders dialogs (evidence: `app/src/ui/app.tsx`)
- Desktop renderer → Git operations: checks repository (evidence: `app/src/ui/app.tsx`)
- Desktop renderer → Add and clone repositories: offers cloning
- Desktop renderer → Working changes: presents changes
- Desktop renderer → Diff inspection: presents diffs
- Desktop renderer → Commit history: presents history
- Desktop renderer → Branches and PRs: presents branches
- Action dispatcher → Application state: updates
- Repository model → Branch model: uses branch data (evidence: `app/src/models/repository.ts`)
- GitHub accounts → GitHub API: uses API endpoints (evidence: `app/src/models/account.ts`)
- Electron main → Desktop notifications: initializes (evidence: `app/src/main-process/main.ts`)
- Electron main → GitHub services: notifies (evidence: `app/src/main-process/main.ts`)
- Branches and PRs → CI checks: shows check status
- Copilot assistance → GitHub services: uses Copilot
- Difftastic integration → Diff inspection: integrates diff tool
- Git output localization → Git operations: localizes output
- Electron main → Automatic updates: supports updates (evidence: `app/src/main-process/main.ts`)
- Add and clone repositories → Git operations: creates repositories
- Add and clone repositories → GitHub API: loads GitHub repositories (evidence: `app/src/ui/clone-repository/clone-repository.tsx`)
