# jramirez-codes/nex architecture

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

- Interactive diagram: https://gitdiagram.com/jramirez-codes/nex
- Repository: https://github.com/jramirez-codes/nex
- Video tour (about a minute): https://gitdiagram.com/jramirez-codes/nex/video

## Overview

nex is a GPU-rendered desktop terminal for Linux and macOS, combining terminal sessions with tabs, split panes, file browsing, Git changes, and SSH-aware workflows. The main user path runs from keyboard/mouse actions through app state and pane layout to terminal execution and rendering. Separate branches cover explorer operations, remote session following and uploads, agent visibility, and saved sessions. README and excerpts support the principal capabilities; some subsystem links are omitted where sampled source does not establish their caller.

Main entry points: [`src/app/workspace/mod.rs`](https://github.com/jramirez-codes/nex/blob/main/src/app/workspace/mod.rs) (Tabs and panes), [`src/app/mod.rs`](https://github.com/jramirez-codes/nex/blob/main/src/app/mod.rs) (App frame), [`src/file_explorer/mod.rs`](https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/mod.rs) (File explorer), [`src/terminal/mod.rs`](https://github.com/jramirez-codes/nex/blob/main/src/terminal/mod.rs) (Terminal surface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and workspace"]
  node_app["App frame<br/>[mod.rs]"]
  node_actions["User actions<br/>[actions.rs]"]
  node_input["Keyboard and mouse<br/>[keyboard.rs]"]
  node_workspace["Tabs and panes<br/>[mod.rs]"]
  node_layout["Split tree<br/>[layout.rs]"]
  node_config["Configuration<br/>[config.rs]"]
  node_session["Session restore<br/>[mod.rs]"]
end

subgraph group_terminal["Terminal runtime"]
  node_terminal["Terminal surface<br/>[mod.rs]"]
  node_search["Scrollback search<br/>[search.rs]"]
  node_pty["PTY and shell<br/>[mod.rs]"]
end

subgraph group_remote["SSH workflows"]
  node_remote["SSH tracking<br/>[mod.rs]"]
  node_remote_exec["Remote execution<br/>[exec.rs]"]
  node_upload["Remote uploads<br/>[upload.rs]"]
  node_host["nex host service<br/>[main.rs]"]
end

subgraph group_panes["Workspace tools"]
  node_explorer["File explorer<br/>[mod.rs]"]
  node_explorer_view["Explorer view<br/>[mod.rs]"]
  node_explorer_ops["File operations<br/>[ops.rs]"]
  node_transfer["File transfer<br/>[transfer.rs]"]
  node_git["Git changes<br/>[mod.rs]"]
  node_agents["Agent overview<br/>[mod.rs]"]
end

subgraph group_platform["Rendering and platform"]
  node_renderer["GPU terminal paint<br/>[mod.rs]"]
  node_ui["Window chrome and UI<br/>[widgets.rs]"]
  node_platform["OS services<br/>[mod.rs]"]
end

node_user(("Desktop user"))
node_filesystem[("Local filesystem")]
node_ssh_host(("SSH server"))

node_user -->|"presses keys"| node_input
node_input -.->|"dispatches actions"| node_actions
node_actions -->|"changes panes"| node_workspace
node_workspace -.->|"lays out panes"| node_layout
node_app -.->|"draws workspace"| node_workspace
node_app -->|"loads settings"| node_config
node_app -.->|"restores state"| node_session
node_workspace -.->|"hosts terminals"| node_terminal
node_terminal -->|"runs shell"| node_pty
node_terminal -->|"provides snapshots"| node_renderer
node_app -->|"handles search"| node_search
node_terminal -->|"tracks SSH pane"| node_remote
node_remote -->|"runs remote commands"| node_remote_exec
node_remote_exec -.->|"connects over SSH"| node_ssh_host
node_remote -.->|"coordinates uploads"| node_upload
node_upload -.->|"sends files"| node_ssh_host
node_remote_exec -.->|"uses host service"| node_host
node_workspace -->|"hosts Files pane"| node_explorer
node_explorer -->|"provides explorer state"| node_explorer_view
node_explorer -.->|"performs operations"| node_explorer_ops
node_explorer -->|"handles transfers"| node_transfer
node_explorer_ops -.->|"reads and writes"| node_filesystem
node_workspace -.->|"hosts Changes pane"| node_git
node_workspace -.->|"hosts Agents pane"| node_agents
node_explorer -->|"opens local files"| node_platform
node_renderer -.->|"uses paint utilities"| node_ui
node_app -->|"uses OS services"| node_platform

click node_app "https://github.com/jramirez-codes/nex/blob/main/src/app/mod.rs"
click node_actions "https://github.com/jramirez-codes/nex/blob/main/src/app/actions.rs"
click node_input "https://github.com/jramirez-codes/nex/blob/main/src/app/input/keyboard.rs"
click node_workspace "https://github.com/jramirez-codes/nex/blob/main/src/app/workspace/mod.rs"
click node_layout "https://github.com/jramirez-codes/nex/blob/main/src/layout.rs"
click node_config "https://github.com/jramirez-codes/nex/blob/main/src/config.rs"
click node_session "https://github.com/jramirez-codes/nex/blob/main/src/session/mod.rs"
click node_terminal "https://github.com/jramirez-codes/nex/blob/main/src/terminal/mod.rs"
click node_search "https://github.com/jramirez-codes/nex/blob/main/src/terminal/search.rs"
click node_pty "https://github.com/jramirez-codes/nex/blob/main/src/terminal/mod.rs"
click node_renderer "https://github.com/jramirez-codes/nex/blob/main/src/render/mod.rs"
click node_ui "https://github.com/jramirez-codes/nex/blob/main/src/ui/widgets.rs"
click node_platform "https://github.com/jramirez-codes/nex/blob/main/src/platform/mod.rs"
click node_explorer "https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/mod.rs"
click node_explorer_view "https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/view/mod.rs"
click node_explorer_ops "https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/fs/ops.rs"
click node_transfer "https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/fs/transfer.rs"
click node_git "https://github.com/jramirez-codes/nex/blob/main/src/git_diff/mod.rs"
click node_agents "https://github.com/jramirez-codes/nex/blob/main/src/agents/mod.rs"
click node_remote "https://github.com/jramirez-codes/nex/blob/main/src/remote/mod.rs"
click node_remote_exec "https://github.com/jramirez-codes/nex/blob/main/src/remote/exec.rs"
click node_upload "https://github.com/jramirez-codes/nex/blob/main/src/remote/upload.rs"
click node_host "https://github.com/jramirez-codes/nex/blob/main/nex-host/src/main.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_actions,node_input,node_workspace,node_layout,node_config,node_session,node_user toneBlue
class node_terminal,node_search,node_pty,node_filesystem toneAmber
class node_remote,node_remote_exec,node_upload,node_host,node_ssh_host toneMint
class node_explorer,node_explorer_view,node_explorer_ops,node_transfer,node_git,node_agents toneRose
class node_renderer,node_ui,node_platform toneIndigo
```

## Components

### App and workspace

- [App frame](https://github.com/jramirez-codes/nex/blob/main/src/app/mod.rs): `src/app/mod.rs`
- [User actions](https://github.com/jramirez-codes/nex/blob/main/src/app/actions.rs): `src/app/actions.rs`
- [Keyboard and mouse](https://github.com/jramirez-codes/nex/blob/main/src/app/input/keyboard.rs): `src/app/input/keyboard.rs`
- [Tabs and panes](https://github.com/jramirez-codes/nex/blob/main/src/app/workspace/mod.rs): `src/app/workspace/mod.rs`
- [Split tree](https://github.com/jramirez-codes/nex/blob/main/src/layout.rs): `src/layout.rs`
- [Configuration](https://github.com/jramirez-codes/nex/blob/main/src/config.rs): `src/config.rs`
- [Session restore](https://github.com/jramirez-codes/nex/blob/main/src/session/mod.rs): `src/session/mod.rs`

### Terminal runtime

- [Terminal surface](https://github.com/jramirez-codes/nex/blob/main/src/terminal/mod.rs): `src/terminal/mod.rs`
- [Scrollback search](https://github.com/jramirez-codes/nex/blob/main/src/terminal/search.rs): `src/terminal/search.rs`
- [PTY and shell](https://github.com/jramirez-codes/nex/blob/main/src/terminal/mod.rs): `src/terminal/mod.rs`

### SSH workflows

- [SSH tracking](https://github.com/jramirez-codes/nex/blob/main/src/remote/mod.rs): `src/remote/mod.rs`
- [Remote execution](https://github.com/jramirez-codes/nex/blob/main/src/remote/exec.rs): `src/remote/exec.rs`
- [Remote uploads](https://github.com/jramirez-codes/nex/blob/main/src/remote/upload.rs): `src/remote/upload.rs`
- [nex host service](https://github.com/jramirez-codes/nex/blob/main/nex-host/src/main.rs): `nex-host/src/main.rs`

### Workspace tools

- [File explorer](https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/mod.rs): `src/file_explorer/mod.rs`
- [Explorer view](https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/view/mod.rs): `src/file_explorer/view/mod.rs`
- [File operations](https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/fs/ops.rs): `src/file_explorer/fs/ops.rs`
- [File transfer](https://github.com/jramirez-codes/nex/blob/main/src/file_explorer/fs/transfer.rs): `src/file_explorer/fs/transfer.rs`
- [Git changes](https://github.com/jramirez-codes/nex/blob/main/src/git_diff/mod.rs): `src/git_diff/mod.rs`
- [Agent overview](https://github.com/jramirez-codes/nex/blob/main/src/agents/mod.rs): `src/agents/mod.rs`

### Rendering and platform

- [GPU terminal paint](https://github.com/jramirez-codes/nex/blob/main/src/render/mod.rs): `src/render/mod.rs`
- [Window chrome and UI](https://github.com/jramirez-codes/nex/blob/main/src/ui/widgets.rs): `src/ui/widgets.rs`
- [OS services](https://github.com/jramirez-codes/nex/blob/main/src/platform/mod.rs): `src/platform/mod.rs`

### Other components

- **Desktop user**
- **Local filesystem**
- **SSH server**

## Connections

- Desktop user → Keyboard and mouse: presses keys
- Keyboard and mouse → User actions: dispatches actions
- User actions → Tabs and panes: changes panes (evidence: `src/app/actions.rs`)
- Tabs and panes → Split tree: lays out panes
- App frame → Tabs and panes: draws workspace (evidence: `src/app/mod.rs`)
- App frame → Configuration: loads settings (evidence: `src/app/mod.rs`)
- App frame → Session restore: restores state (evidence: `src/app/mod.rs`)
- Tabs and panes → Terminal surface: hosts terminals
- Terminal surface → PTY and shell: runs shell (evidence: `src/terminal/mod.rs`)
- Terminal surface → GPU terminal paint: provides snapshots (evidence: `src/render/mod.rs`)
- App frame → Scrollback search: handles search (evidence: `src/app/actions.rs`)
- Terminal surface → SSH tracking: tracks SSH pane (evidence: `src/terminal/mod.rs`)
- SSH tracking → Remote execution: runs remote commands (evidence: `src/remote/exec.rs`)
- Remote execution → SSH server: connects over SSH
- SSH tracking → Remote uploads: coordinates uploads (evidence: `src/remote/mod.rs`)
- Remote uploads → SSH server: sends files
- Remote execution → nex host service: uses host service
- Tabs and panes → File explorer: hosts Files pane (evidence: `src/file_explorer/mod.rs`)
- File explorer → Explorer view: provides explorer state (evidence: `src/file_explorer/view/mod.rs`)
- File explorer → File operations: performs operations
- File explorer → File transfer: handles transfers (evidence: `src/file_explorer/input/mod.rs`)
- File operations → Local filesystem: reads and writes
- Tabs and panes → Git changes: hosts Changes pane
- Tabs and panes → Agent overview: hosts Agents pane
- File explorer → OS services: opens local files (evidence: `src/file_explorer/mod.rs`)
- GPU terminal paint → Window chrome and UI: uses paint utilities
- App frame → OS services: uses OS services (evidence: `src/app/mod.rs`)
