# immense/remotely architecture

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

- Interactive diagram: https://gitdiagram.com/immense/remotely
- Repository: https://github.com/immense/remotely

## Overview

Remotely is a .NET remote-control and remote-scripting platform: operators use the server UI or browser viewer to manage devices, request sessions, and run scripts; agents and desktop clients connect back to the server. The graph highlights device connectivity, interactive control, scripting, management, and persistence. The README documents these product capabilities, while sampled source confirms selected startup, API, viewer, and logging behavior; unsampled subsystem wiring is therefore kept conservative.

Main entry points: [`Server/Hubs/DesktopHub.cs`](https://github.com/immense/remotely/blob/master/Server/Hubs/DesktopHub.cs) (Desktop hub), [`Agent/Program.cs`](https://github.com/immense/remotely/blob/master/Agent/Program.cs) (Device agent), [`Agent/Services/AgentHubConnection.cs`](https://github.com/immense/remotely/blob/master/Agent/Services/AgentHubConnection.cs) (Agent connection), [`Desktop.Shared/Services/DesktopHubConnection.cs`](https://github.com/immense/remotely/blob/master/Desktop.Shared/Services/DesktopHubConnection.cs) (Desktop connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_server["Server and management"]
  node_server_ui["Management UI"]
  node_api["Management APIs"]
  node_data["Data service<br/>[DataService.cs]"]
  node_database[("Application database<br/>[AppDb.cs]")]
  node_agent_hub["Agent hub<br/>[AgentHub.cs]"]
  node_desktop_hub["Desktop hub<br/>[DesktopHub.cs]"]
  node_viewer_hub["Viewer hub<br/>[ViewerHub.cs]"]
  node_scripting_api["Scripting APIs"]
  node_scheduler["Script scheduling<br/>[ScriptScheduler.cs]"]
  node_logs["Server logs<br/>[LogsManager.cs]"]
end

subgraph group_agent["Agent and scripting"]
  node_agent["Device agent<br/>[Program.cs]"]
  node_agent_connection["Agent connection"]
  node_script_executor["Script execution<br/>[ScriptExecutor.cs]"]
end

subgraph group_desktop["Desktop client"]
  node_desktop_app["Remote desktop app<br/>[Program.cs]"]
  node_desktop_connection["Desktop connection"]
  node_screen_capture["Screen capture"]
  node_input["Remote input"]
end

subgraph group_viewer["Browser viewer"]
  node_browser_viewer["Browser viewer<br/>[App.js]"]
  node_viewer_connection["Viewer connection"]
end

subgraph group_shared["Shared contracts"]
  node_shared_dtos["Control messages<br/>[DtoWrapper.cs]"]
end

node_operator(("Operator"))

node_operator -->|"manages devices"| node_server_ui
node_server_ui -->|"requests management"| node_api
node_api -->|"calls data service"| node_data
node_data -->|"persists records"| node_database
node_agent -->|"starts connection"| node_agent_connection
node_agent_connection -->|"connects to"| node_agent_hub
node_agent_hub -->|"dispatches commands"| node_agent
node_scripting_api -->|"dispatches scripts"| node_agent_hub
node_scheduler -->|"runs scheduled scripts"| node_scripting_api
node_agent -->|"executes scripts"| node_script_executor
node_desktop_app -->|"starts client"| node_desktop_connection
node_desktop_connection -->|"connects to"| node_desktop_hub
node_desktop_hub -->|"requests capture"| node_screen_capture
node_desktop_hub -->|"dispatches input"| node_input
node_browser_viewer -->|"connects through"| node_viewer_connection
node_viewer_connection -->|"sends control"| node_viewer_hub
node_viewer_hub -->|"relays session data"| node_desktop_hub
node_agent_connection -->|"exchanges messages"| node_shared_dtos
node_desktop_connection -->|"exchanges messages"| node_shared_dtos
node_viewer_connection -->|"uses message types"| node_shared_dtos
node_operator -->|"controls device"| node_browser_viewer

click node_server_ui "https://github.com/immense/remotely/blob/master/Server/Components/Pages/DeviceDetails.razor.cs"
click node_api "https://github.com/immense/remotely/blob/master/Server/API/OrganizationManagementController.cs"
click node_data "https://github.com/immense/remotely/blob/master/Server/Services/DataService.cs"
click node_database "https://github.com/immense/remotely/blob/master/Server/Data/AppDb.cs"
click node_agent_hub "https://github.com/immense/remotely/blob/master/Server/Hubs/AgentHub.cs"
click node_desktop_hub "https://github.com/immense/remotely/blob/master/Server/Hubs/DesktopHub.cs"
click node_viewer_hub "https://github.com/immense/remotely/blob/master/Server/Hubs/ViewerHub.cs"
click node_scripting_api "https://github.com/immense/remotely/blob/master/Server/API/ScriptingController.cs"
click node_scheduler "https://github.com/immense/remotely/blob/master/Server/Services/ScriptScheduler.cs"
click node_agent "https://github.com/immense/remotely/blob/master/Agent/Program.cs"
click node_agent_connection "https://github.com/immense/remotely/blob/master/Agent/Services/AgentHubConnection.cs"
click node_script_executor "https://github.com/immense/remotely/blob/master/Agent/Services/ScriptExecutor.cs"
click node_desktop_app "https://github.com/immense/remotely/blob/master/Desktop.Win/Program.cs"
click node_desktop_connection "https://github.com/immense/remotely/blob/master/Desktop.Shared/Services/DesktopHubConnection.cs"
click node_screen_capture "https://github.com/immense/remotely/blob/master/Desktop.Win/Services/ScreenCapturerWin.cs"
click node_input "https://github.com/immense/remotely/blob/master/Desktop.Win/Services/KeyboardMouseInputWin.cs"
click node_browser_viewer "https://github.com/immense/remotely/blob/master/Server/wwwroot/src/App.js"
click node_viewer_connection "https://github.com/immense/remotely/blob/master/Server/wwwroot/src/ViewerHubConnection.ts"
click node_shared_dtos "https://github.com/immense/remotely/blob/master/Shared/Models/Dtos/DtoWrapper.cs"
click node_logs "https://github.com/immense/remotely/blob/master/Server/Services/LogsManager.cs"

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_server_ui,node_api,node_data,node_database,node_agent_hub,node_desktop_hub,node_viewer_hub,node_scripting_api,node_scheduler,node_logs toneBlue
class node_agent,node_agent_connection,node_script_executor toneAmber
class node_desktop_app,node_desktop_connection,node_screen_capture,node_input toneMint
class node_browser_viewer,node_viewer_connection toneRose
class node_shared_dtos,node_operator toneIndigo
```

## Components

### Server and management

- [Management UI](https://github.com/immense/remotely/blob/master/Server/Components/Pages/DeviceDetails.razor.cs): `Server/Components/Pages/DeviceDetails.razor.cs`
- [Management APIs](https://github.com/immense/remotely/blob/master/Server/API/OrganizationManagementController.cs): `Server/API/OrganizationManagementController.cs`
- [Data service](https://github.com/immense/remotely/blob/master/Server/Services/DataService.cs): `Server/Services/DataService.cs`
- [Application database](https://github.com/immense/remotely/blob/master/Server/Data/AppDb.cs): `Server/Data/AppDb.cs`
- [Agent hub](https://github.com/immense/remotely/blob/master/Server/Hubs/AgentHub.cs): `Server/Hubs/AgentHub.cs`
- [Desktop hub](https://github.com/immense/remotely/blob/master/Server/Hubs/DesktopHub.cs): `Server/Hubs/DesktopHub.cs`
- [Viewer hub](https://github.com/immense/remotely/blob/master/Server/Hubs/ViewerHub.cs): `Server/Hubs/ViewerHub.cs`
- [Scripting APIs](https://github.com/immense/remotely/blob/master/Server/API/ScriptingController.cs): `Server/API/ScriptingController.cs`
- [Script scheduling](https://github.com/immense/remotely/blob/master/Server/Services/ScriptScheduler.cs): `Server/Services/ScriptScheduler.cs`
- [Server logs](https://github.com/immense/remotely/blob/master/Server/Services/LogsManager.cs): `Server/Services/LogsManager.cs`

### Agent and scripting

- [Device agent](https://github.com/immense/remotely/blob/master/Agent/Program.cs): `Agent/Program.cs`
- [Agent connection](https://github.com/immense/remotely/blob/master/Agent/Services/AgentHubConnection.cs): `Agent/Services/AgentHubConnection.cs`
- [Script execution](https://github.com/immense/remotely/blob/master/Agent/Services/ScriptExecutor.cs): `Agent/Services/ScriptExecutor.cs`

### Desktop client

- [Remote desktop app](https://github.com/immense/remotely/blob/master/Desktop.Win/Program.cs): `Desktop.Win/Program.cs`
- [Desktop connection](https://github.com/immense/remotely/blob/master/Desktop.Shared/Services/DesktopHubConnection.cs): `Desktop.Shared/Services/DesktopHubConnection.cs`
- [Screen capture](https://github.com/immense/remotely/blob/master/Desktop.Win/Services/ScreenCapturerWin.cs): `Desktop.Win/Services/ScreenCapturerWin.cs`
- [Remote input](https://github.com/immense/remotely/blob/master/Desktop.Win/Services/KeyboardMouseInputWin.cs): `Desktop.Win/Services/KeyboardMouseInputWin.cs`

### Browser viewer

- [Browser viewer](https://github.com/immense/remotely/blob/master/Server/wwwroot/src/App.js): `Server/wwwroot/src/App.js`
- [Viewer connection](https://github.com/immense/remotely/blob/master/Server/wwwroot/src/ViewerHubConnection.ts): `Server/wwwroot/src/ViewerHubConnection.ts`

### Shared contracts

- [Control messages](https://github.com/immense/remotely/blob/master/Shared/Models/Dtos/DtoWrapper.cs): `Shared/Models/Dtos/DtoWrapper.cs`

### Other components

- **Operator**

## Connections

- Operator → Management UI: manages devices
- Management UI → Management APIs: requests management
- Management APIs → Data service: calls data service
- Data service → Application database: persists records
- Device agent → Agent connection: starts connection
- Agent connection → Agent hub: connects to
- Agent hub → Device agent: dispatches commands
- Scripting APIs → Agent hub: dispatches scripts
- Script scheduling → Scripting APIs: runs scheduled scripts
- Device agent → Script execution: executes scripts
- Remote desktop app → Desktop connection: starts client
- Desktop connection → Desktop hub: connects to
- Desktop hub → Screen capture: requests capture
- Desktop hub → Remote input: dispatches input
- Browser viewer → Viewer connection: connects through
- Viewer connection → Viewer hub: sends control
- Viewer hub → Desktop hub: relays session data
- Agent connection → Control messages: exchanges messages
- Desktop connection → Control messages: exchanges messages
- Viewer connection → Control messages: uses message types
- Operator → Browser viewer: controls device
