# bitfocus/companion-satellite architecture

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

- Interactive diagram: https://gitdiagram.com/bitfocus/companion-satellite
- Repository: https://github.com/bitfocus/companion-satellite

## Overview

Companion Satellite discovers and manages local control surfaces, then exposes them to a Companion instance over the satellite protocol. The headless runtime starts the client, surface manager, REST API, and mDNS announcer; configuration changes can trigger reconnection or plugin updates. The web UI configures the service and reports status and surfaces. Connections among sampled modules are based on excerpts or SOURCE INDEX references; the UI’s REST interaction and some documented capabilities are represented at the README level.

Main entry points: [`satellite/src/surface-manager.ts`](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-manager.ts) (Surface manager), [`satellite/src/rest.ts`](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/rest.ts) (REST API), [`satellite/src/client/client.ts`](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/client/client.ts) (Satellite client), [`satellite/src/main.ts`](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/main.ts) (Runtime startup)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and configuration"]
  node_runtime_entry["Runtime startup<br/>[main.ts]"]
  node_configuration[("Configuration<br/>[config.ts]")]
  node_mdns["mDNS announcement<br/>[mdnsAnnouncer.ts]"]
  node_logging["Logging<br/>[logging.ts]"]
  node_common_utilities["Shared utilities<br/>[lib.ts]"]
end

subgraph group_companion["Companion connection"]
  node_protocol_client["Satellite client<br/>[client.ts]"]
  node_socket_transports["TCP and WebSocket"]
  node_schema_translation["Schema translation<br/>[translateSchema.ts]"]
  node_protocol_types["API types<br/>[apiTypes.ts]"]
end

subgraph group_surfaces["Surface lifecycle"]
  node_surface_manager["Surface manager<br/>[surface-manager.ts]"]
  node_plugin_loader["Plugin loading"]
  node_surface_handler["Surface child handler<br/>[child-handler.ts]"]
  node_ipc_types["Surface IPC types<br/>[ipc-types.ts]"]
  node_surface_host["Surface host context<br/>[host-context.ts]"]
  node_graphics_cards["Card graphics<br/>[cards.ts]"]
  node_graphics_locking["Graphics locking<br/>[locking.ts]"]
  node_process_respawn["Plugin process supervision<br/>[respawn.ts]"]
  node_ipc_wrapper["IPC wrapper<br/>[ipc-wrapper.ts]"]
end

subgraph group_api["Management API and UI"]
  node_rest_server["REST API<br/>[rest.ts]"]
  node_webui_entry["Web UI entry<br/>[main.tsx]"]
  node_webui_app["Configuration UI<br/>[App.tsx]"]
  node_webui_api["Web UI API client<br/>[rest.ts]"]
end

node_operator(("Operator"))
node_companion_service(("Companion"))

node_operator -->|"configures"| node_webui_app
node_webui_entry -->|"renders"| node_webui_app
node_webui_entry -->|"provides"| node_webui_api
node_webui_api -.->|"requests"| node_rest_server
node_runtime_entry -->|"opens"| node_configuration
node_runtime_entry -->|"starts"| node_protocol_client
node_runtime_entry -->|"creates"| node_surface_manager
node_runtime_entry -->|"starts"| node_rest_server
node_runtime_entry -->|"starts"| node_mdns
node_runtime_entry -->|"uses"| node_logging
node_configuration -->|"selects transport"| node_protocol_client
node_mdns -->|"reads settings"| node_configuration
node_protocol_client -->|"creates"| node_socket_transports
node_protocol_client -->|"uses"| node_schema_translation
node_protocol_client -->|"connects"| node_companion_service
node_protocol_client -->|"registers surfaces"| node_surface_manager
node_surface_manager -->|"loads plugins"| node_plugin_loader
node_surface_manager -->|"creates handlers"| node_surface_handler
node_surface_manager -->|"supervises processes"| node_process_respawn
node_surface_manager -->|"uses types"| node_protocol_types
node_surface_manager -->|"uses"| node_common_utilities
node_surface_handler -->|"dispatches IPC"| node_ipc_wrapper
node_surface_handler -->|"uses messages"| node_ipc_types
node_surface_handler -->|"monitors child"| node_process_respawn
node_surface_host -->|"uses messages"| node_ipc_types
node_surface_host -->|"uses"| node_graphics_cards
node_surface_host -->|"uses"| node_graphics_locking
node_rest_server -->|"reads status"| node_protocol_client
node_rest_server -->|"manages surfaces"| node_surface_manager
node_rest_server -->|"reads and updates"| node_configuration
node_rest_server -->|"uses types"| node_protocol_types
node_rest_server -->|"serves API"| node_operator

click node_runtime_entry "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/main.ts"
click node_configuration "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/config.ts"
click node_mdns "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/mdnsAnnouncer.ts"
click node_logging "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/logging.ts"
click node_protocol_client "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/client/client.ts"
click node_socket_transports "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/client/socketImplementations.ts"
click node_schema_translation "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/translateSchema.ts"
click node_protocol_types "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/apiTypes.ts"
click node_surface_manager "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-manager.ts"
click node_plugin_loader "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-plugin-loader.ts"
click node_surface_handler "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-thread/child-handler.ts"
click node_ipc_types "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-thread/ipc-types.ts"
click node_surface_host "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-thread/host-context.ts"
click node_graphics_cards "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/graphics/cards.ts"
click node_graphics_locking "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/graphics/locking.ts"
click node_process_respawn "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/lib/respawn.ts"
click node_ipc_wrapper "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/lib/ipc-wrapper.ts"
click node_common_utilities "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/lib.ts"
click node_rest_server "https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/rest.ts"
click node_webui_entry "https://github.com/bitfocus/companion-satellite/blob/main/webui/src/main.tsx"
click node_webui_app "https://github.com/bitfocus/companion-satellite/blob/main/webui/src/app/App.tsx"
click node_webui_api "https://github.com/bitfocus/companion-satellite/blob/main/webui/src/Api/rest.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_runtime_entry,node_configuration,node_mdns,node_logging,node_common_utilities toneBlue
class node_protocol_client,node_socket_transports,node_schema_translation,node_protocol_types toneAmber
class node_surface_manager,node_plugin_loader,node_surface_handler,node_ipc_types,node_surface_host,node_graphics_cards,node_graphics_locking,node_process_respawn,node_ipc_wrapper toneMint
class node_rest_server,node_webui_entry,node_webui_app,node_webui_api toneRose
class node_operator,node_companion_service toneIndigo
```

## Components

### Runtime and configuration

- [Runtime startup](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/main.ts): `satellite/src/main.ts`
- [Configuration](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/config.ts): `satellite/src/config.ts`
- [mDNS announcement](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/mdnsAnnouncer.ts): `satellite/src/mdnsAnnouncer.ts`
- [Logging](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/logging.ts): `satellite/src/logging.ts`
- [Shared utilities](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/lib.ts): `satellite/src/lib.ts`

### Companion connection

- [Satellite client](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/client/client.ts): `satellite/src/client/client.ts`
- [TCP and WebSocket](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/client/socketImplementations.ts): `satellite/src/client/socketImplementations.ts`
- [Schema translation](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/translateSchema.ts): `satellite/src/translateSchema.ts`
- [API types](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/apiTypes.ts): `satellite/src/apiTypes.ts`

### Surface lifecycle

- [Surface manager](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-manager.ts): `satellite/src/surface-manager.ts`
- [Plugin loading](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-plugin-loader.ts): `satellite/src/surface-plugin-loader.ts`
- [Surface child handler](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-thread/child-handler.ts): `satellite/src/surface-thread/child-handler.ts`
- [Surface IPC types](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-thread/ipc-types.ts): `satellite/src/surface-thread/ipc-types.ts`
- [Surface host context](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/surface-thread/host-context.ts): `satellite/src/surface-thread/host-context.ts`
- [Card graphics](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/graphics/cards.ts): `satellite/src/graphics/cards.ts`
- [Graphics locking](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/graphics/locking.ts): `satellite/src/graphics/locking.ts`
- [Plugin process supervision](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/lib/respawn.ts): `satellite/src/lib/respawn.ts`
- [IPC wrapper](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/lib/ipc-wrapper.ts): `satellite/src/lib/ipc-wrapper.ts`

### Management API and UI

- [REST API](https://github.com/bitfocus/companion-satellite/blob/main/satellite/src/rest.ts): `satellite/src/rest.ts`
- [Web UI entry](https://github.com/bitfocus/companion-satellite/blob/main/webui/src/main.tsx): `webui/src/main.tsx`
- [Configuration UI](https://github.com/bitfocus/companion-satellite/blob/main/webui/src/app/App.tsx): `webui/src/app/App.tsx`
- [Web UI API client](https://github.com/bitfocus/companion-satellite/blob/main/webui/src/Api/rest.ts): `webui/src/Api/rest.ts`

### Other components

- **Operator**
- **Companion**

## Connections

- Operator → Configuration UI: configures (evidence: `README.md`)
- Web UI entry → Configuration UI: renders (evidence: `webui/src/main.tsx`)
- Web UI entry → Web UI API client: provides (evidence: `webui/src/main.tsx`)
- Web UI API client → REST API: requests (evidence: `README.md`)
- Runtime startup → Configuration: opens (evidence: `satellite/src/main.ts`)
- Runtime startup → Satellite client: starts (evidence: `satellite/src/main.ts`)
- Runtime startup → Surface manager: creates (evidence: `satellite/src/main.ts`)
- Runtime startup → REST API: starts (evidence: `satellite/src/main.ts`)
- Runtime startup → mDNS announcement: starts (evidence: `satellite/src/main.ts`)
- Runtime startup → Logging: uses (evidence: `satellite/src/main.ts`)
- Configuration → Satellite client: selects transport (evidence: `satellite/src/config.ts`)
- mDNS announcement → Configuration: reads settings (evidence: `satellite/src/mdnsAnnouncer.ts`)
- Satellite client → TCP and WebSocket: creates (evidence: `satellite/src/client/client.ts`)
- Satellite client → Schema translation: uses (evidence: `satellite/src/client/client.ts`)
- Satellite client → Companion: connects (evidence: `README.md`)
- Satellite client → Surface manager: registers surfaces (evidence: `satellite/src/surface-manager.ts`)
- Surface manager → Plugin loading: loads plugins (evidence: `satellite/src/surface-manager.ts`)
- Surface manager → Surface child handler: creates handlers (evidence: `satellite/src/surface-manager.ts`)
- Surface manager → Plugin process supervision: supervises processes (evidence: `satellite/src/surface-manager.ts`)
- Surface manager → API types: uses types (evidence: `satellite/src/surface-manager.ts`)
- Surface manager → Shared utilities: uses (evidence: `satellite/src/surface-manager.ts`)
- Surface child handler → IPC wrapper: dispatches IPC (evidence: `satellite/src/surface-thread/child-handler.ts`)
- Surface child handler → Surface IPC types: uses messages (evidence: `satellite/src/surface-thread/child-handler.ts`)
- Surface child handler → Plugin process supervision: monitors child (evidence: `satellite/src/surface-thread/child-handler.ts`)
- Surface host context → Surface IPC types: uses messages (evidence: `satellite/src/surface-thread/host-context.ts`)
- Surface host context → Card graphics: uses (evidence: `satellite/src/surface-thread/host-context.ts`)
- Surface host context → Graphics locking: uses (evidence: `satellite/src/surface-thread/host-context.ts`)
- REST API → Satellite client: reads status (evidence: `satellite/src/rest.ts`)
- REST API → Surface manager: manages surfaces (evidence: `satellite/src/rest.ts`)
- REST API → Configuration: reads and updates (evidence: `satellite/src/rest.ts`)
- REST API → API types: uses types (evidence: `satellite/src/rest.ts`)
- REST API → Operator: serves API (evidence: `README.md`)
