# brijr/gui architecture

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

- Interactive diagram: https://gitdiagram.com/brijr/gui
- Repository: https://github.com/brijr/gui

## Overview

Gui is a desktop app for directing local AI coding agents against a live project preview. The main workflow is selecting an element or area, sending that context through chat to an agent, and reviewing the updated preview; checkpoints support undo. The graph also preserves canvases, project setup, terminals, recordings, GitHub/account features, and settings. README statements support the product flow; source-index references and excerpts support selected internal links, while unsampled runtime details are not inferred.

Main entry points: [`src/main/index.ts`](https://github.com/brijr/gui/blob/main/src/main/index.ts) (App orchestration), [`src/renderer/src/app/app.tsx`](https://github.com/brijr/gui/blob/main/src/renderer/src/app/app.tsx) (App chrome), [`src/renderer/src/settings/settings-app.tsx`](https://github.com/brijr/gui/blob/main/src/renderer/src/settings/settings-app.tsx) (Settings UI), [`accounts/src/worker.ts`](https://github.com/brijr/gui/blob/main/accounts/src/worker.ts) (Account service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_ui["App chrome<br/>[app.tsx]"]
  node_pick["Design picking<br/>[overlay.tsx]"]
  node_chatui["Chat panel<br/>[chat-panel.tsx]"]
  node_ipc["IPC contracts<br/>[ipc.ts]"]
  node_preload["Secure preload<br/>[index.ts]"]
  node_requests["IPC requests<br/>[ipc-requests.ts]"]
  node_shortcuts["Shortcut definitions<br/>[shortcuts.ts]"]
end

subgraph group_runtime["Main runtime"]
  node_main["App orchestration<br/>[index.ts]"]
  node_project["Project and server<br/>[project.ts]"]
  node_preview["Live preview<br/>[tab.ts]"]
  node_source["Source mapping<br/>[source-resolver.ts]"]
  node_terminal["Terminal and logs<br/>[terminal.ts]"]
  node_recordings["Screen recordings<br/>[recordings.ts]"]
end

subgraph group_editing["Agent editing"]
  node_agent["Agent sessions<br/>[agent.ts]"]
  node_chat["Chat orchestration<br/>[chat.ts]"]
  node_history[("Undo history<br/>[history.ts]")]
  node_checkpoints[("File checkpoints<br/>[checkpoints.ts]")]
end

subgraph group_canvas["Canvas design"]
  node_board["Canvas workflow<br/>[canvas.tsx]"]
  node_boardmodel["Board model<br/>[board.ts]"]
end

subgraph group_services["Accounts and state"]
  node_settings["Settings UI<br/>[settings-app.tsx]"]
  node_prefs[("Preferences<br/>[prefs.ts]")]
  node_account["Account handling<br/>[account.ts]"]
  node_accountipc["Account IPC<br/>[account-ipc.ts]"]
  node_github["GitHub operations<br/>[github.ts]"]
  node_sharedaccount["Account types<br/>[account.ts]"]
  node_sharedgithub["GitHub types<br/>[github.ts]"]
  node_accountservice["Account service<br/>[worker.ts]"]
  node_repoindex["Repository access"]
end

node_user(("Designer"))

node_user -->|"selects area"| node_pick
node_pick -->|"sends context"| node_chatui
node_user -->|"requests changes"| node_chatui
node_chatui -.->|"sends requests"| node_preload
node_preload -->|"uses contracts"| node_ipc
node_main -->|"handles requests"| node_ipc
node_main -.->|"configures bridge"| node_preload
node_main -->|"opens project"| node_project
node_project -.->|"runs preview"| node_preview
node_main -.->|"starts chat"| node_chat
node_chat -.->|"drives agent"| node_agent
node_agent -->|"edits project"| node_user
node_chat -.->|"records turns"| node_history
node_history -->|"uses snapshots"| node_checkpoints
node_agent -->|"checks work"| node_preview
node_pick -->|"identifies source"| node_source
node_ui -->|"shows canvas"| node_board
node_board -->|"uses board data"| node_boardmodel
node_main -->|"clones repository"| node_github
node_settings -.->|"manages account"| node_accountipc
node_accountipc -->|"dispatches account calls"| node_account
node_accountipc -->|"dispatches GitHub calls"| node_github
node_account -->|"uses account types"| node_sharedaccount
node_github -.->|"uses GitHub types"| node_sharedgithub
node_accountservice -->|"looks up repositories"| node_repoindex
node_accountservice -->|"uses account types"| node_sharedaccount
node_accountservice -->|"uses GitHub types"| node_sharedgithub
node_ui -->|"presents shortcuts"| node_shortcuts
node_settings -.->|"updates preferences"| node_prefs
node_ui -->|"opens terminal"| node_terminal
node_main -->|"captures sessions"| node_recordings
node_settings -.->|"uses request types"| node_requests

click node_ui "https://github.com/brijr/gui/blob/main/src/renderer/src/app/app.tsx"
click node_pick "https://github.com/brijr/gui/blob/main/src/renderer/src/pick/overlay.tsx"
click node_chatui "https://github.com/brijr/gui/blob/main/src/renderer/src/chat/chat-panel.tsx"
click node_ipc "https://github.com/brijr/gui/blob/main/src/shared/ipc.ts"
click node_preload "https://github.com/brijr/gui/blob/main/src/preload/index.ts"
click node_main "https://github.com/brijr/gui/blob/main/src/main/index.ts"
click node_project "https://github.com/brijr/gui/blob/main/src/main/project.ts"
click node_preview "https://github.com/brijr/gui/blob/main/src/main/tab.ts"
click node_source "https://github.com/brijr/gui/blob/main/src/main/source-resolver.ts"
click node_agent "https://github.com/brijr/gui/blob/main/src/main/agent.ts"
click node_chat "https://github.com/brijr/gui/blob/main/src/main/chat.ts"
click node_history "https://github.com/brijr/gui/blob/main/src/main/history.ts"
click node_checkpoints "https://github.com/brijr/gui/blob/main/src/main/checkpoints.ts"
click node_board "https://github.com/brijr/gui/blob/main/src/renderer/src/app/canvas.tsx"
click node_boardmodel "https://github.com/brijr/gui/blob/main/src/shared/board.ts"
click node_terminal "https://github.com/brijr/gui/blob/main/src/main/terminal.ts"
click node_recordings "https://github.com/brijr/gui/blob/main/src/main/recordings.ts"
click node_settings "https://github.com/brijr/gui/blob/main/src/renderer/src/settings/settings-app.tsx"
click node_prefs "https://github.com/brijr/gui/blob/main/src/main/prefs.ts"
click node_account "https://github.com/brijr/gui/blob/main/src/main/account.ts"
click node_accountipc "https://github.com/brijr/gui/blob/main/src/main/account-ipc.ts"
click node_github "https://github.com/brijr/gui/blob/main/src/main/github.ts"
click node_sharedaccount "https://github.com/brijr/gui/blob/main/src/shared/account.ts"
click node_sharedgithub "https://github.com/brijr/gui/blob/main/src/shared/github.ts"
click node_requests "https://github.com/brijr/gui/blob/main/src/shared/ipc-requests.ts"
click node_shortcuts "https://github.com/brijr/gui/blob/main/src/shared/shortcuts.ts"
click node_accountservice "https://github.com/brijr/gui/blob/main/accounts/src/worker.ts"
click node_repoindex "https://github.com/brijr/gui/blob/main/accounts/src/github-repositories.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_ui,node_pick,node_chatui,node_ipc,node_preload,node_requests,node_shortcuts toneBlue
class node_main,node_project,node_preview,node_source,node_terminal,node_recordings toneAmber
class node_agent,node_chat,node_history,node_checkpoints toneMint
class node_board,node_boardmodel toneRose
class node_settings,node_prefs,node_account,node_accountipc,node_github,node_sharedaccount,node_sharedgithub,node_accountservice,node_repoindex,node_user toneIndigo
```

## Components

### App experience

- [App chrome](https://github.com/brijr/gui/blob/main/src/renderer/src/app/app.tsx): `src/renderer/src/app/app.tsx`
- [Design picking](https://github.com/brijr/gui/blob/main/src/renderer/src/pick/overlay.tsx): `src/renderer/src/pick/overlay.tsx`
- [Chat panel](https://github.com/brijr/gui/blob/main/src/renderer/src/chat/chat-panel.tsx): `src/renderer/src/chat/chat-panel.tsx`
- [IPC contracts](https://github.com/brijr/gui/blob/main/src/shared/ipc.ts): `src/shared/ipc.ts`
- [Secure preload](https://github.com/brijr/gui/blob/main/src/preload/index.ts): `src/preload/index.ts`
- [IPC requests](https://github.com/brijr/gui/blob/main/src/shared/ipc-requests.ts): `src/shared/ipc-requests.ts`
- [Shortcut definitions](https://github.com/brijr/gui/blob/main/src/shared/shortcuts.ts): `src/shared/shortcuts.ts`

### Main runtime

- [App orchestration](https://github.com/brijr/gui/blob/main/src/main/index.ts): `src/main/index.ts`
- [Project and server](https://github.com/brijr/gui/blob/main/src/main/project.ts): `src/main/project.ts`
- [Live preview](https://github.com/brijr/gui/blob/main/src/main/tab.ts): `src/main/tab.ts`
- [Source mapping](https://github.com/brijr/gui/blob/main/src/main/source-resolver.ts): `src/main/source-resolver.ts`
- [Terminal and logs](https://github.com/brijr/gui/blob/main/src/main/terminal.ts): `src/main/terminal.ts`
- [Screen recordings](https://github.com/brijr/gui/blob/main/src/main/recordings.ts): `src/main/recordings.ts`

### Agent editing

- [Agent sessions](https://github.com/brijr/gui/blob/main/src/main/agent.ts): `src/main/agent.ts`
- [Chat orchestration](https://github.com/brijr/gui/blob/main/src/main/chat.ts): `src/main/chat.ts`
- [Undo history](https://github.com/brijr/gui/blob/main/src/main/history.ts): `src/main/history.ts`
- [File checkpoints](https://github.com/brijr/gui/blob/main/src/main/checkpoints.ts): `src/main/checkpoints.ts`

### Canvas design

- [Canvas workflow](https://github.com/brijr/gui/blob/main/src/renderer/src/app/canvas.tsx): `src/renderer/src/app/canvas.tsx`
- [Board model](https://github.com/brijr/gui/blob/main/src/shared/board.ts): `src/shared/board.ts`

### Accounts and state

- [Settings UI](https://github.com/brijr/gui/blob/main/src/renderer/src/settings/settings-app.tsx): `src/renderer/src/settings/settings-app.tsx`
- [Preferences](https://github.com/brijr/gui/blob/main/src/main/prefs.ts): `src/main/prefs.ts`
- [Account handling](https://github.com/brijr/gui/blob/main/src/main/account.ts): `src/main/account.ts`
- [Account IPC](https://github.com/brijr/gui/blob/main/src/main/account-ipc.ts): `src/main/account-ipc.ts`
- [GitHub operations](https://github.com/brijr/gui/blob/main/src/main/github.ts): `src/main/github.ts`
- [Account types](https://github.com/brijr/gui/blob/main/src/shared/account.ts): `src/shared/account.ts`
- [GitHub types](https://github.com/brijr/gui/blob/main/src/shared/github.ts): `src/shared/github.ts`
- [Account service](https://github.com/brijr/gui/blob/main/accounts/src/worker.ts): `accounts/src/worker.ts`
- [Repository access](https://github.com/brijr/gui/blob/main/accounts/src/github-repositories.ts): `accounts/src/github-repositories.ts`

### Other components

- **Designer**

## Connections

- Designer → Design picking: selects area (evidence: `README.md`)
- Design picking → Chat panel: sends context (evidence: `README.md`)
- Designer → Chat panel: requests changes (evidence: `README.md`)
- Chat panel → Secure preload: sends requests
- Secure preload → IPC contracts: uses contracts (evidence: `src/preload/index.ts`)
- App orchestration → IPC contracts: handles requests (evidence: `src/main/index.ts`)
- App orchestration → Secure preload: configures bridge
- App orchestration → Project and server: opens project (evidence: `src/main/index.ts`)
- Project and server → Live preview: runs preview
- App orchestration → Chat orchestration: starts chat (evidence: `src/main/index.ts`)
- Chat orchestration → Agent sessions: drives agent
- Agent sessions → Designer: edits project (evidence: `README.md`)
- Chat orchestration → Undo history: records turns
- Undo history → File checkpoints: uses snapshots (evidence: `src/main/history.ts`)
- Agent sessions → Live preview: checks work (evidence: `README.md`)
- Design picking → Source mapping: identifies source (evidence: `README.md`)
- App chrome → Canvas workflow: shows canvas (evidence: `src/renderer/src/app/app.tsx`)
- Canvas workflow → Board model: uses board data
- App orchestration → GitHub operations: clones repository (evidence: `src/main/index.ts`)
- Settings UI → Account IPC: manages account
- Account IPC → Account handling: dispatches account calls (evidence: `src/main/account-ipc.ts`)
- Account IPC → GitHub operations: dispatches GitHub calls (evidence: `src/main/account-ipc.ts`)
- Account handling → Account types: uses account types (evidence: `src/main/account.ts`)
- GitHub operations → GitHub types: uses GitHub types
- Account service → Repository access: looks up repositories (evidence: `accounts/src/worker.ts`)
- Account service → Account types: uses account types (evidence: `accounts/src/worker.ts`)
- Account service → GitHub types: uses GitHub types (evidence: `accounts/src/worker.ts`)
- App chrome → Shortcut definitions: presents shortcuts (evidence: `src/shared/shortcuts.ts`)
- Settings UI → Preferences: updates preferences
- App chrome → Terminal and logs: opens terminal (evidence: `README.md`)
- App orchestration → Screen recordings: captures sessions (evidence: `src/main/index.ts`)
- Settings UI → IPC requests: uses request types
