# nilbuild/diffity architecture

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

- Interactive diagram: https://gitdiagram.com/nilbuild/diffity
- Repository: https://github.com/nilbuild/diffity

## Overview

Diffity is a macOS GitHub-style code-review app. A user opens a repository, selects a working-tree diff, commit, range, branch, or pull request, reviews rendered changes, and adds threads; reviews can be sent to Claude or submitted/synchronized with GitHub. The graph separates the React UI, frontend data bridge, Rust repository services, agent runtime, and GitHub integration. README statements support the documented product flows; source-index references and excerpts support only the cited internal connections, so unsampled implementation links are omitted.

Main entry points: [`src/lib/tauri.ts`](https://github.com/nilbuild/diffity/blob/main/src/lib/tauri.ts) (Tauri bridge), [`src/routes/repo-layout.tsx`](https://github.com/nilbuild/diffity/blob/main/src/routes/repo-layout.tsx) (Repository views), [`src-tauri/src/github/service.rs`](https://github.com/nilbuild/diffity/blob/main/src-tauri/src/github/service.rs) (PR review service), [`src/components/diff/file-block.tsx`](https://github.com/nilbuild/diffity/blob/main/src/components/diff/file-block.tsx) (Diff review)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Review interface"]
  node_app["App routing<br/>[App.tsx]"]
  node_repo["Repository views<br/>[repo-layout.tsx]"]
  node_diffview["Diff review<br/>[file-block.tsx]"]
  node_comments["Comment threads<br/>[thread-card.tsx]"]
  node_filebrowse["File browser<br/>[tree-page.tsx]"]
  node_welcome["Open projects<br/>[welcome.tsx]"]
  node_review_submit["Submit review<br/>[finish-review.tsx]"]
end

subgraph group_frontend["Frontend data"]
  node_api["Frontend API<br/>[api.ts]"]
  node_tauri["Tauri bridge<br/>[tauri.ts]"]
  node_queries["Query definitions<br/>[diff.ts]"]
end

subgraph group_backend["Repository services"]
  node_commands["App commands"]
  node_diffcore["Diff and Git<br/>[diff.rs]"]
  node_treecore["File tree<br/>[tree.rs]"]
  node_store[("Review storage<br/>[store.rs]")]
end

subgraph group_agents["Agent workflows"]
  node_claude_ui["Claude actions<br/>[claude-runner.ts]"]
  node_agent_manager["Agent manager<br/>[manager.rs]"]
  node_agent_session["Agent session<br/>[session.rs]"]
end

subgraph group_github["GitHub integration"]
  node_github_service["PR review service<br/>[service.rs]"]
  node_github_remote["GitHub API<br/>[graphql.rs]"]
end

node_user(("Reviewer"))
node_github(("GitHub"))
node_claude(("Claude Code"))

node_user -->|"opens repository"| node_welcome
node_user -->|"selects changes"| node_repo
node_app -->|"routes to"| node_welcome
node_app -->|"routes to"| node_repo
node_repo -->|"shows diff"| node_diffview
node_repo -->|"opens files"| node_filebrowse
node_user -->|"adds comments"| node_comments
node_diffview -->|"anchors threads"| node_comments
node_diffview -->|"requests diff"| node_queries
node_queries -.->|"uses API"| node_api
node_api -->|"fetches diff"| node_tauri
node_api -->|"loads threads"| node_tauri
node_tauri -->|"invokes commands"| node_commands
node_commands -.->|"serves repository data"| node_diffcore
node_commands -.->|"persists review data"| node_store
node_user -->|"starts Claude review"| node_claude_ui
node_comments -->|"sends comments"| node_claude_ui
node_claude_ui -->|"starts agent action"| node_tauri
node_tauri -.->|"dispatches agent action"| node_agent_manager
node_agent_manager -->|"loads chat records"| node_store
node_agent_manager -->|"starts session"| node_agent_session
node_agent_session -->|"runs agent"| node_claude
node_user -->|"submits review"| node_review_submit
node_review_submit -->|"posts review"| node_tauri
node_tauri -.->|"invokes review commands"| node_github_service
node_github_service -->|"queries GitHub"| node_github_remote
node_github_remote -->|"sends GraphQL"| node_github
node_github_service -->|"syncs thread IDs"| node_store
node_github -->|"returns review data"| node_github_service

click node_app "https://github.com/nilbuild/diffity/blob/main/src/App.tsx"
click node_repo "https://github.com/nilbuild/diffity/blob/main/src/routes/repo-layout.tsx"
click node_diffview "https://github.com/nilbuild/diffity/blob/main/src/components/diff/file-block.tsx"
click node_comments "https://github.com/nilbuild/diffity/blob/main/src/components/comments/thread-card.tsx"
click node_filebrowse "https://github.com/nilbuild/diffity/blob/main/src/components/tree/tree-page.tsx"
click node_welcome "https://github.com/nilbuild/diffity/blob/main/src/routes/welcome.tsx"
click node_review_submit "https://github.com/nilbuild/diffity/blob/main/src/features/review/finish-review.tsx"
click node_api "https://github.com/nilbuild/diffity/blob/main/src/lib/api.ts"
click node_tauri "https://github.com/nilbuild/diffity/blob/main/src/lib/tauri.ts"
click node_queries "https://github.com/nilbuild/diffity/blob/main/src/queries/diff.ts"
click node_commands "https://github.com/nilbuild/diffity/tree/main/src-tauri/src/commands"
click node_diffcore "https://github.com/nilbuild/diffity/blob/main/src-tauri/src/core/diff.rs"
click node_treecore "https://github.com/nilbuild/diffity/blob/main/src-tauri/src/core/tree.rs"
click node_store "https://github.com/nilbuild/diffity/blob/main/src-tauri/src/core/store.rs"
click node_github_service "https://github.com/nilbuild/diffity/blob/main/src-tauri/src/github/service.rs"
click node_github_remote "https://github.com/nilbuild/diffity/blob/main/src-tauri/src/github/graphql.rs"
click node_claude_ui "https://github.com/nilbuild/diffity/blob/main/src/features/claude/claude-runner.ts"
click node_agent_manager "https://github.com/nilbuild/diffity/blob/main/src-tauri/src/agents/manager.rs"
click node_agent_session "https://github.com/nilbuild/diffity/blob/main/src-tauri/src/agents/session.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_repo,node_diffview,node_comments,node_filebrowse,node_welcome,node_review_submit,node_user toneBlue
class node_api,node_tauri,node_queries toneAmber
class node_commands,node_diffcore,node_treecore,node_store toneMint
class node_claude_ui,node_agent_manager,node_agent_session toneRose
class node_github_service,node_github_remote,node_github,node_claude toneIndigo
```

## Components

### Review interface

- [App routing](https://github.com/nilbuild/diffity/blob/main/src/App.tsx): `src/App.tsx`
- [Repository views](https://github.com/nilbuild/diffity/blob/main/src/routes/repo-layout.tsx): `src/routes/repo-layout.tsx`
- [Diff review](https://github.com/nilbuild/diffity/blob/main/src/components/diff/file-block.tsx): `src/components/diff/file-block.tsx`
- [Comment threads](https://github.com/nilbuild/diffity/blob/main/src/components/comments/thread-card.tsx): `src/components/comments/thread-card.tsx`
- [File browser](https://github.com/nilbuild/diffity/blob/main/src/components/tree/tree-page.tsx): `src/components/tree/tree-page.tsx`
- [Open projects](https://github.com/nilbuild/diffity/blob/main/src/routes/welcome.tsx): `src/routes/welcome.tsx`
- [Submit review](https://github.com/nilbuild/diffity/blob/main/src/features/review/finish-review.tsx): `src/features/review/finish-review.tsx`

### Frontend data

- [Frontend API](https://github.com/nilbuild/diffity/blob/main/src/lib/api.ts): `src/lib/api.ts`
- [Tauri bridge](https://github.com/nilbuild/diffity/blob/main/src/lib/tauri.ts): `src/lib/tauri.ts`
- [Query definitions](https://github.com/nilbuild/diffity/blob/main/src/queries/diff.ts): `src/queries/diff.ts`

### Repository services

- [App commands](https://github.com/nilbuild/diffity/tree/main/src-tauri/src/commands): `src-tauri/src/commands`
- [Diff and Git](https://github.com/nilbuild/diffity/blob/main/src-tauri/src/core/diff.rs): `src-tauri/src/core/diff.rs`
- [File tree](https://github.com/nilbuild/diffity/blob/main/src-tauri/src/core/tree.rs): `src-tauri/src/core/tree.rs`
- [Review storage](https://github.com/nilbuild/diffity/blob/main/src-tauri/src/core/store.rs): `src-tauri/src/core/store.rs`

### Agent workflows

- [Claude actions](https://github.com/nilbuild/diffity/blob/main/src/features/claude/claude-runner.ts): `src/features/claude/claude-runner.ts`
- [Agent manager](https://github.com/nilbuild/diffity/blob/main/src-tauri/src/agents/manager.rs): `src-tauri/src/agents/manager.rs`
- [Agent session](https://github.com/nilbuild/diffity/blob/main/src-tauri/src/agents/session.rs): `src-tauri/src/agents/session.rs`

### GitHub integration

- [PR review service](https://github.com/nilbuild/diffity/blob/main/src-tauri/src/github/service.rs): `src-tauri/src/github/service.rs`
- [GitHub API](https://github.com/nilbuild/diffity/blob/main/src-tauri/src/github/graphql.rs): `src-tauri/src/github/graphql.rs`

### Other components

- **Reviewer**
- **GitHub**
- **Claude Code**

## Connections

- Reviewer → Open projects: opens repository (evidence: `README.md`)
- Reviewer → Repository views: selects changes (evidence: `README.md`)
- App routing → Open projects: routes to (evidence: `src/App.tsx`)
- App routing → Repository views: routes to (evidence: `src/App.tsx`)
- Repository views → Diff review: shows diff (evidence: `README.md`)
- Repository views → File browser: opens files (evidence: `README.md`)
- Reviewer → Comment threads: adds comments (evidence: `README.md`)
- Diff review → Comment threads: anchors threads (evidence: `README.md`)
- Diff review → Query definitions: requests diff (evidence: `src/components/diff/file-block.tsx`)
- Query definitions → Frontend API: uses API
- Frontend API → Tauri bridge: fetches diff (evidence: `src/lib/api.ts`)
- Frontend API → Tauri bridge: loads threads (evidence: `src/lib/api.ts`)
- Tauri bridge → App commands: invokes commands (evidence: `src/lib/tauri.ts`)
- App commands → Diff and Git: serves repository data
- App commands → Review storage: persists review data
- Reviewer → Claude actions: starts Claude review (evidence: `README.md`)
- Comment threads → Claude actions: sends comments (evidence: `README.md`)
- Claude actions → Tauri bridge: starts agent action (evidence: `src/features/claude/ask-claude-review.tsx`)
- Tauri bridge → Agent manager: dispatches agent action
- Agent manager → Review storage: loads chat records (evidence: `src-tauri/src/agents/manager.rs`)
- Agent manager → Agent session: starts session (evidence: `src-tauri/src/agents/manager.rs`)
- Agent session → Claude Code: runs agent (evidence: `README.md`)
- Reviewer → Submit review: submits review (evidence: `README.md`)
- Submit review → Tauri bridge: posts review (evidence: `src/lib/tauri.ts`)
- Tauri bridge → PR review service: invokes review commands
- PR review service → GitHub API: queries GitHub (evidence: `src-tauri/src/github/service.rs`)
- GitHub API → GitHub: sends GraphQL (evidence: `README.md`)
- PR review service → Review storage: syncs thread IDs (evidence: `src-tauri/src/github/service.rs`)
- GitHub → PR review service: returns review data (evidence: `README.md`)
