# chungpr0/coreterm architecture

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

- Interactive diagram: https://gitdiagram.com/chungpr0/coreterm
- Repository: https://github.com/chungpr0/coreterm

## Overview

CoreTerm is a Windows multi-tab terminal and SSH manager. Users organize saved hosts, launch local or SSH tabs, and work in terminal or SFTP panes; the app also supports key management, port forwarding, and localized settings. The graph separates the React workspace and domain features from the Rust Tauri services and persistence. Some backend command wiring and unsampled feature internals are represented at their existing directories; their specific call paths are not asserted.

Main entry points: [`src/app/App.tsx`](https://github.com/chungpr0/coreterm/blob/main/src/app/App.tsx) (Application Shell), [`src/modules/terminal/hooks/useSessionController.ts`](https://github.com/chungpr0/coreterm/blob/main/src/modules/terminal/hooks/useSessionController.ts) (Session Controller), [`src-tauri/src/hosts/service.rs`](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/hosts/service.rs) (Host Services), [`src-tauri/src/pty/manager.rs`](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/pty/manager.rs) (PTY Manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workspace["Workspace UI"]
  node_app["Application Shell<br/>[App.tsx]"]
  node_workspace_ui["Tabs and Workspace<br/>[TabBar.tsx]"]
  node_settings_ui["Settings<br/>[SettingsModal.tsx]"]
end

subgraph group_connections["Connections and Keys"]
  node_host_ui["Host Management<br/>[HostSidebar.tsx]"]
  node_key_ui["Key Vault<br/>[useKeyVault.ts]"]
end

subgraph group_terminal["Terminal Sessions"]
  node_terminal_ui["Terminal View"]
  node_session_control["Session Controller"]
end

subgraph group_sftp["SFTP Transfers"]
  node_sftp_ui["SFTP Browser"]
end

subgraph group_backend["Rust Backend"]
  node_host_service["Host Services<br/>[service.rs]"]
  node_host_policy["Host Policy<br/>[policy.rs]"]
  node_host_db[("Host and Group Store<br/>[host_repo.rs]")]
  node_key_engine["Key Engine<br/>[engine.rs]"]
  node_pty_manager["PTY Manager<br/>[manager.rs]"]
  node_shell_profiles["Shell Profiles<br/>[shells.rs]"]
  node_ssh_tools["SSH Configuration<br/>[arg_builder.rs]"]
  node_sftp_manager["SFTP Manager<br/>[manager.rs]"]
  node_sftp_session["SFTP Session<br/>[session.rs]"]
  node_transfer_engine["Transfer Engine<br/>[engine.rs]"]
  node_transfer_jobs["Transfer Jobs<br/>[job.rs]"]
  node_transfer_conflict["Conflict Handling<br/>[conflict.rs]"]
  node_path_guard["Path Guard<br/>[path_guard.rs]"]
end

node_user(("User"))
node_keyring[("Windows Keyring")]
node_openssh["OpenSSH Client"]

node_user -->|"uses"| node_app
node_app -->|"renders"| node_workspace_ui
node_app -->|"renders"| node_host_ui
node_app -->|"renders"| node_terminal_ui
node_app -->|"renders"| node_sftp_ui
node_app -->|"sets up"| node_session_control
node_session_control -->|"creates tabs"| node_workspace_ui
node_session_control -->|"checks reconnect"| node_host_ui
node_session_control -.->|"starts sessions"| node_pty_manager
node_host_ui -.->|"manages hosts"| node_host_service
node_host_service -->|"validates"| node_host_policy
node_host_service -->|"reads and writes"| node_host_db
node_key_ui -.->|"manages keys"| node_key_engine
node_key_engine -.->|"stores secrets"| node_keyring
node_key_engine -->|"generates RSA keys"| node_openssh
node_terminal_ui -->|"connects through"| node_session_control
node_pty_manager -->|"uses profiles"| node_shell_profiles
node_pty_manager -->|"uses SSH setup"| node_ssh_tools
node_terminal_ui -.->|"controls PTY"| node_pty_manager
node_host_service -->|"provides host config"| node_pty_manager
node_sftp_ui -.->|"controls transfers"| node_sftp_manager
node_sftp_manager -->|"loads host config"| node_host_service
node_sftp_manager -->|"uses sessions"| node_sftp_session
node_sftp_manager -->|"dispatches jobs"| node_transfer_engine
node_transfer_engine -->|"tracks jobs"| node_transfer_jobs
node_transfer_engine -->|"applies policy"| node_transfer_conflict
node_sftp_session -->|"guards paths"| node_path_guard
node_settings_ui -.->|"configures"| node_app

click node_app "https://github.com/chungpr0/coreterm/blob/main/src/app/App.tsx"
click node_workspace_ui "https://github.com/chungpr0/coreterm/blob/main/src/modules/workspace/components/TabBar.tsx"
click node_host_ui "https://github.com/chungpr0/coreterm/blob/main/src/modules/hosts/components/HostSidebar.tsx"
click node_key_ui "https://github.com/chungpr0/coreterm/blob/main/src/modules/keys/hooks/useKeyVault.ts"
click node_settings_ui "https://github.com/chungpr0/coreterm/blob/main/src/modules/settings/components/SettingsModal.tsx"
click node_terminal_ui "https://github.com/chungpr0/coreterm/blob/main/src/modules/terminal/hooks/useTerminalSession.ts"
click node_session_control "https://github.com/chungpr0/coreterm/blob/main/src/modules/terminal/hooks/useSessionController.ts"
click node_sftp_ui "https://github.com/chungpr0/coreterm/blob/main/src/modules/sftp/components/SftpSplitContainer.tsx"
click node_host_service "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/hosts/service.rs"
click node_host_policy "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/hosts/policy.rs"
click node_host_db "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/infra/db/host_repo.rs"
click node_key_engine "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/keys/engine.rs"
click node_pty_manager "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/pty/manager.rs"
click node_shell_profiles "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/pty/shells.rs"
click node_ssh_tools "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/ssh/arg_builder.rs"
click node_sftp_manager "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/manager.rs"
click node_sftp_session "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/session.rs"
click node_transfer_engine "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/transfer/engine.rs"
click node_transfer_jobs "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/transfer/job.rs"
click node_transfer_conflict "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/transfer/conflict.rs"
click node_path_guard "https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/core/path_guard.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_workspace_ui,node_settings_ui,node_user,node_openssh toneBlue
class node_host_ui,node_key_ui,node_keyring toneAmber
class node_terminal_ui,node_session_control toneMint
class node_sftp_ui toneRose
class node_host_service,node_host_policy,node_host_db,node_key_engine,node_pty_manager,node_shell_profiles,node_ssh_tools,node_sftp_manager,node_sftp_session,node_transfer_engine,node_transfer_jobs,node_transfer_conflict,node_path_guard toneIndigo
```

## Components

### Workspace UI

- [Application Shell](https://github.com/chungpr0/coreterm/blob/main/src/app/App.tsx): `src/app/App.tsx`
- [Tabs and Workspace](https://github.com/chungpr0/coreterm/blob/main/src/modules/workspace/components/TabBar.tsx): `src/modules/workspace/components/TabBar.tsx`
- [Settings](https://github.com/chungpr0/coreterm/blob/main/src/modules/settings/components/SettingsModal.tsx): `src/modules/settings/components/SettingsModal.tsx`

### Connections and Keys

- [Host Management](https://github.com/chungpr0/coreterm/blob/main/src/modules/hosts/components/HostSidebar.tsx): `src/modules/hosts/components/HostSidebar.tsx`
- [Key Vault](https://github.com/chungpr0/coreterm/blob/main/src/modules/keys/hooks/useKeyVault.ts): `src/modules/keys/hooks/useKeyVault.ts`

### Terminal Sessions

- [Terminal View](https://github.com/chungpr0/coreterm/blob/main/src/modules/terminal/hooks/useTerminalSession.ts): `src/modules/terminal/hooks/useTerminalSession.ts`
- [Session Controller](https://github.com/chungpr0/coreterm/blob/main/src/modules/terminal/hooks/useSessionController.ts): `src/modules/terminal/hooks/useSessionController.ts`

### SFTP Transfers

- [SFTP Browser](https://github.com/chungpr0/coreterm/blob/main/src/modules/sftp/components/SftpSplitContainer.tsx): `src/modules/sftp/components/SftpSplitContainer.tsx`

### Rust Backend

- [Host Services](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/hosts/service.rs): `src-tauri/src/hosts/service.rs`
- [Host Policy](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/hosts/policy.rs): `src-tauri/src/hosts/policy.rs`
- [Host and Group Store](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/infra/db/host_repo.rs): `src-tauri/src/infra/db/host_repo.rs`
- [Key Engine](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/keys/engine.rs): `src-tauri/src/keys/engine.rs`
- [PTY Manager](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/pty/manager.rs): `src-tauri/src/pty/manager.rs`
- [Shell Profiles](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/pty/shells.rs): `src-tauri/src/pty/shells.rs`
- [SSH Configuration](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/ssh/arg_builder.rs): `src-tauri/src/ssh/arg_builder.rs`
- [SFTP Manager](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/manager.rs): `src-tauri/src/sftp/manager.rs`
- [SFTP Session](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/session.rs): `src-tauri/src/sftp/session.rs`
- [Transfer Engine](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/transfer/engine.rs): `src-tauri/src/sftp/transfer/engine.rs`
- [Transfer Jobs](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/transfer/job.rs): `src-tauri/src/sftp/transfer/job.rs`
- [Conflict Handling](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/sftp/transfer/conflict.rs): `src-tauri/src/sftp/transfer/conflict.rs`
- [Path Guard](https://github.com/chungpr0/coreterm/blob/main/src-tauri/src/core/path_guard.rs): `src-tauri/src/core/path_guard.rs`

### Other components

- **User**
- **Windows Keyring**
- **OpenSSH Client**

## Connections

- User → Application Shell: uses (evidence: `README.md`)
- Application Shell → Tabs and Workspace: renders (evidence: `src/app/App.tsx`)
- Application Shell → Host Management: renders (evidence: `src/app/App.tsx`)
- Application Shell → Terminal View: renders (evidence: `src/app/App.tsx`)
- Application Shell → SFTP Browser: renders (evidence: `src/app/App.tsx`)
- Application Shell → Session Controller: sets up (evidence: `src/app/App.tsx`)
- Session Controller → Tabs and Workspace: creates tabs (evidence: `src/modules/terminal/hooks/useSessionController.ts`)
- Session Controller → Host Management: checks reconnect (evidence: `src/modules/terminal/hooks/useSessionController.ts`)
- Session Controller → PTY Manager: starts sessions
- Host Management → Host Services: manages hosts
- Host Services → Host Policy: validates (evidence: `src-tauri/src/hosts/service.rs`)
- Host Services → Host and Group Store: reads and writes (evidence: `src-tauri/src/hosts/service.rs`)
- Key Vault → Key Engine: manages keys
- Key Engine → Windows Keyring: stores secrets (evidence: `README.md`)
- Key Engine → OpenSSH Client: generates RSA keys (evidence: `src-tauri/src/keys/engine.rs`)
- Terminal View → Session Controller: connects through (evidence: `src/modules/terminal/hooks/useTerminalSession.ts`)
- PTY Manager → Shell Profiles: uses profiles (evidence: `src-tauri/src/pty/manager.rs`)
- PTY Manager → SSH Configuration: uses SSH setup (evidence: `src-tauri/src/pty/manager.rs`)
- Terminal View → PTY Manager: controls PTY
- Host Services → PTY Manager: provides host config (evidence: `src-tauri/src/pty/manager.rs`)
- SFTP Browser → SFTP Manager: controls transfers
- SFTP Manager → Host Services: loads host config (evidence: `src-tauri/src/sftp/manager.rs`)
- SFTP Manager → SFTP Session: uses sessions (evidence: `src-tauri/src/sftp/manager.rs`)
- SFTP Manager → Transfer Engine: dispatches jobs (evidence: `src-tauri/src/sftp/manager.rs`)
- Transfer Engine → Transfer Jobs: tracks jobs (evidence: `src-tauri/src/sftp/transfer/engine.rs`)
- Transfer Engine → Conflict Handling: applies policy (evidence: `src-tauri/src/sftp/transfer/engine.rs`)
- SFTP Session → Path Guard: guards paths (evidence: `src-tauri/src/sftp/session.rs`)
- Settings → Application Shell: configures
