# cyber-courses/cyber-ctf-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/cyber-courses/cyber-ctf-desktop
- Repository: https://github.com/cyber-courses/cyber-ctf-desktop

## Overview

Cyber CTF Desktop is a Tauri launcher for authenticated Cyber CTF labs, running Docker or Vagrant/VM workloads locally or on player-managed/cloud hosts. The player enters through the desktop shell, signs in, selects a lab, and launches it; Rust owns privileged commands, downloads, credentials, process execution, and runtime lifecycle. The UI also exposes machine readiness, servers, cloud accounts, hosted sessions, and settings. Relationships for unsampled subsystems reflect README documentation; source excerpts are partial, so some implementation-level links are intentionally omitted.

Main entry points: [`src/components/app-shell.tsx`](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src/components/app-shell.tsx) (App shell), [`src-tauri/src/runtime/mod.rs`](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/mod.rs) (Runtime lifecycle), [`src-tauri/src/lib.rs`](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/lib.rs) (Tauri command handlers), [`src/lib/tauri/index.ts`](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src/lib/tauri/index.ts) (Typed Tauri wrappers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop experience"]
  node_shell["App shell<br/>[app-shell.tsx]"]
  node_home["Home dashboard<br/>[home-screen.tsx]"]
  node_lab_ui["Lab catalogue and deploy"]
  node_hosted_ui["Hosted sessions"]
  node_machine_ui["Machine setup"]
  node_server_ui["Server setup"]
  node_cloud_ui["Cloud accounts"]
  node_settings_ui["Settings"]
end

subgraph group_bridge["Command boundary"]
  node_tauri_bridge["Typed Tauri wrappers<br/>[index.ts]"]
  node_commands["Tauri command handlers<br/>[lib.rs]"]
end

subgraph group_account_labs["Identity and labs"]
  node_account["Authentication and API"]
  node_lab_launch["Lab launch service<br/>[labs.rs]"]
end

subgraph group_machine["Machine readiness"]
  node_machine_probe["System detection and tests"]
  node_workloads["Workloads and storage<br/>[workloads.rs]"]
  node_platform["Platform setup"]
end

subgraph group_runtime["Lab runtimes"]
  node_runtime_entry["Runtime lifecycle<br/>[mod.rs]"]
  node_docker["Docker runtime"]
  node_vm_runtime["Local VM runtime<br/>[vm.rs]"]
  node_server_runtime["Remote servers"]
  node_cloud_runtime["Cloud provisioning<br/>[terraform.rs]"]
  node_providers["Vagrant providers<br/>[providers.rs]"]
  node_processes["Process execution<br/>[exec.rs]"]
end

node_player(("Player"))
node_local_machine["Player machine"]
node_cyber_backend["CyberBackend"]
node_cloud_services["Cloud providers"]

node_player -->|"uses"| node_shell
node_shell -->|"renders"| node_home
node_shell -->|"routes to"| node_lab_ui
node_shell -->|"routes to"| node_machine_ui
node_shell -->|"routes to"| node_server_ui
node_shell -->|"routes to"| node_cloud_ui
node_shell -->|"routes to"| node_settings_ui
node_lab_ui -.->|"invokes commands"| node_tauri_bridge
node_machine_ui -->|"invokes commands"| node_tauri_bridge
node_server_ui -->|"invokes commands"| node_tauri_bridge
node_hosted_ui -->|"invokes commands"| node_tauri_bridge
node_tauri_bridge -->|"calls Rust commands"| node_commands
node_commands -->|"dispatches auth"| node_account
node_commands -->|"dispatches checks"| node_machine_probe
node_commands -->|"dispatches launch"| node_lab_launch
node_player -->|"signs in"| node_account
node_account -->|"queries API"| node_cyber_backend
node_lab_launch -->|"requests startLab"| node_cyber_backend
node_lab_launch -->|"starts downloaded lab"| node_runtime_entry
node_machine_probe -->|"probes tools"| node_processes
node_machine_probe -->|"detects providers"| node_providers
node_commands -->|"dispatches storage"| node_workloads
node_commands -->|"dispatches installs"| node_platform
node_runtime_entry -->|"dispatches Docker"| node_docker
node_runtime_entry -->|"dispatches VMs"| node_vm_runtime
node_runtime_entry -->|"dispatches remote"| node_server_runtime
node_runtime_entry -->|"dispatches cloud"| node_cloud_runtime
node_runtime_entry -->|"runs tools"| node_processes
node_server_runtime -->|"uses providers"| node_providers
node_server_runtime -->|"creates labs project"| node_cloud_runtime
node_providers -->|"runs Vagrant"| node_processes
node_docker -.->|"runs Docker CLI"| node_processes
node_vm_runtime -.->|"runs Vagrant"| node_processes
node_runtime_entry -->|"runs locally"| node_local_machine
node_cloud_runtime -.->|"provisions resources"| node_cloud_services

click node_shell "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src/components/app-shell.tsx"
click node_home "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src/features/home/home-screen.tsx"
click node_lab_ui "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/labs"
click node_hosted_ui "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/hosted"
click node_machine_ui "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/machine"
click node_server_ui "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/servers"
click node_cloud_ui "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/cloud"
click node_settings_ui "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/settings"
click node_tauri_bridge "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src/lib/tauri/index.ts"
click node_commands "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/lib.rs"
click node_account "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/account"
click node_lab_launch "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/labs.rs"
click node_machine_probe "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/machine"
click node_workloads "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/machine/workloads.rs"
click node_platform "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/platform"
click node_runtime_entry "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/mod.rs"
click node_docker "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/runtime/docker"
click node_vm_runtime "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/vm.rs"
click node_server_runtime "https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/runtime/server"
click node_cloud_runtime "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/terraform.rs"
click node_providers "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/providers.rs"
click node_processes "https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/exec.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_shell,node_home,node_lab_ui,node_hosted_ui,node_machine_ui,node_server_ui,node_cloud_ui,node_settings_ui toneBlue
class node_tauri_bridge,node_commands toneAmber
class node_account,node_lab_launch toneMint
class node_machine_probe,node_workloads,node_platform toneRose
class node_runtime_entry,node_docker,node_vm_runtime,node_server_runtime,node_cloud_runtime,node_providers,node_processes,node_player,node_local_machine,node_cyber_backend,node_cloud_services toneIndigo
```

## Components

### Desktop experience

- [App shell](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src/components/app-shell.tsx): `src/components/app-shell.tsx`
- [Home dashboard](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src/features/home/home-screen.tsx): `src/features/home/home-screen.tsx`
- [Lab catalogue and deploy](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/labs): `src/features/labs`
- [Hosted sessions](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/hosted): `src/features/hosted`
- [Machine setup](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/machine): `src/features/machine`
- [Server setup](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/servers): `src/features/servers`
- [Cloud accounts](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/cloud): `src/features/cloud`
- [Settings](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src/features/settings): `src/features/settings`

### Command boundary

- [Typed Tauri wrappers](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src/lib/tauri/index.ts): `src/lib/tauri/index.ts`
- [Tauri command handlers](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/lib.rs): `src-tauri/src/lib.rs`

### Identity and labs

- [Authentication and API](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/account): `src-tauri/src/account`
- [Lab launch service](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/labs.rs): `src-tauri/src/labs.rs`

### Machine readiness

- [System detection and tests](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/machine): `src-tauri/src/machine`
- [Workloads and storage](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/machine/workloads.rs): `src-tauri/src/machine/workloads.rs`
- [Platform setup](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/platform): `src-tauri/src/platform`

### Lab runtimes

- [Runtime lifecycle](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/mod.rs): `src-tauri/src/runtime/mod.rs`
- [Docker runtime](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/runtime/docker): `src-tauri/src/runtime/docker`
- [Local VM runtime](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/vm.rs): `src-tauri/src/runtime/vm.rs`
- [Remote servers](https://github.com/cyber-courses/cyber-ctf-desktop/tree/main/src-tauri/src/runtime/server): `src-tauri/src/runtime/server`
- [Cloud provisioning](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/terraform.rs): `src-tauri/src/runtime/terraform.rs`
- [Vagrant providers](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/runtime/providers.rs): `src-tauri/src/runtime/providers.rs`
- [Process execution](https://github.com/cyber-courses/cyber-ctf-desktop/blob/main/src-tauri/src/exec.rs): `src-tauri/src/exec.rs`

### Other components

- **Player**
- **Player machine**
- **CyberBackend**
- **Cloud providers**

## Connections

- Player → App shell: uses (evidence: `README.md`)
- App shell → Home dashboard: renders (evidence: `src/components/app-shell.tsx`)
- App shell → Lab catalogue and deploy: routes to (evidence: `src/components/app-shell.tsx`)
- App shell → Machine setup: routes to (evidence: `src/components/app-shell.tsx`)
- App shell → Server setup: routes to (evidence: `src/components/app-shell.tsx`)
- App shell → Cloud accounts: routes to (evidence: `src/components/app-shell.tsx`)
- App shell → Settings: routes to (evidence: `src/components/app-shell.tsx`)
- Lab catalogue and deploy → Typed Tauri wrappers: invokes commands (evidence: `src/features/labs/network-diagram/index.tsx`)
- Machine setup → Typed Tauri wrappers: invokes commands (evidence: `src/features/machine/setup-steps/engine-step.tsx`)
- Server setup → Typed Tauri wrappers: invokes commands (evidence: `src/features/servers/host-setup/index.tsx`)
- Hosted sessions → Typed Tauri wrappers: invokes commands (evidence: `src/features/hosted/use-hosted-labs.ts`)
- Typed Tauri wrappers → Tauri command handlers: calls Rust commands (evidence: `README.md`)
- Tauri command handlers → Authentication and API: dispatches auth (evidence: `src-tauri/src/lib.rs`)
- Tauri command handlers → System detection and tests: dispatches checks (evidence: `src-tauri/src/lib.rs`)
- Tauri command handlers → Lab launch service: dispatches launch (evidence: `src-tauri/src/lib.rs`)
- Player → Authentication and API: signs in (evidence: `README.md`)
- Authentication and API → CyberBackend: queries API (evidence: `README.md`)
- Lab launch service → CyberBackend: requests startLab (evidence: `README.md`)
- Lab launch service → Runtime lifecycle: starts downloaded lab (evidence: `README.md`)
- System detection and tests → Process execution: probes tools (evidence: `src-tauri/src/machine/selftest.rs`)
- System detection and tests → Vagrant providers: detects providers (evidence: `src-tauri/src/machine/selftest.rs`)
- Tauri command handlers → Workloads and storage: dispatches storage (evidence: `src-tauri/src/lib.rs`)
- Tauri command handlers → Platform setup: dispatches installs (evidence: `src-tauri/src/lib.rs`)
- Runtime lifecycle → Docker runtime: dispatches Docker (evidence: `src-tauri/src/runtime/mod.rs`)
- Runtime lifecycle → Local VM runtime: dispatches VMs (evidence: `src-tauri/src/runtime/mod.rs`)
- Runtime lifecycle → Remote servers: dispatches remote (evidence: `src-tauri/src/runtime/mod.rs`)
- Runtime lifecycle → Cloud provisioning: dispatches cloud (evidence: `src-tauri/src/runtime/mod.rs`)
- Runtime lifecycle → Process execution: runs tools (evidence: `src-tauri/src/runtime/mod.rs`)
- Remote servers → Vagrant providers: uses providers (evidence: `src-tauri/src/runtime/server/mod.rs`)
- Remote servers → Cloud provisioning: creates labs project (evidence: `src-tauri/src/runtime/server/mod.rs`)
- Vagrant providers → Process execution: runs Vagrant (evidence: `src-tauri/src/runtime/providers.rs`)
- Docker runtime → Process execution: runs Docker CLI
- Local VM runtime → Process execution: runs Vagrant
- Runtime lifecycle → Player machine: runs locally (evidence: `README.md`)
- Cloud provisioning → Cloud providers: provisions resources
