# kerberos-io/agent architecture

> Architecture diagram of the GitHub repository kerberos-io/agent, 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/kerberos-io/agent
- Repository: https://github.com/kerberos-io/agent

## Overview

Kerberos Agent is an edge video-surveillance agent: it connects to a camera, processes its feed for motion-based or continuous recording, and makes recordings available through a web interface. Users configure and inspect the agent through the UI and its API; the backend also exposes live streaming, camera control, and cloud integrations. The excerpts establish key startup, routing, capture, and UI relationships; several cloud and storage internals were not sampled, so those capabilities are shown at subsystem level without speculative call chains.

Main entry points: [`machinery/src/routers/http/routes.go`](https://github.com/kerberos-io/agent/blob/master/machinery/src/routers/http/routes.go) (HTTP API), [`machinery/src/capture/main.go`](https://github.com/kerberos-io/agent/blob/master/machinery/src/capture/main.go) (Capture and record), [`machinery/src/routers/websocket/main.go`](https://github.com/kerberos-io/agent/blob/master/machinery/src/routers/websocket/main.go) (WebSocket streaming), [`ui/src/App.jsx`](https://github.com/kerberos-io/agent/blob/master/ui/src/App.jsx) (Agent web UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Agent runtime"]
  node_startup["Agent startup<br/>[main.go]"]
  node_configuration["Configuration<br/>[main.go]"]
  node_components["Camera controls"]
  node_onvif["ONVIF control<br/>[main.go]"]
end

subgraph group_media["Video processing"]
  node_capture["Capture and record<br/>[main.go]"]
  node_motion["Motion detection<br/>[main.go]"]
  node_packets["Media packets"]
  node_webrtc["WebRTC streaming<br/>[main.go]"]
end

subgraph group_interfaces["User interfaces"]
  node_http["HTTP API<br/>[routes.go]"]
  node_websocket["WebSocket streaming<br/>[main.go]"]
  node_mqtt["MQTT remote access<br/>[main.go]"]
  node_ui["Agent web UI<br/>[App.jsx]"]
  node_pages["Dashboard and settings<br/>[Settings.jsx]"]
  node_actions["UI actions<br/>[agent.js]"]
  node_api["UI API client<br/>[agent.js]"]
  node_state["UI state<br/>[agent.js]"]
end

subgraph group_integrations["Cloud integrations"]
  node_cloud["Cloud and storage"]
end

node_operator(("Operator"))
node_camera(("RTSP camera"))

node_operator -->|"uses"| node_ui
node_ui -->|"routes to"| node_pages
node_ui -->|"dispatches"| node_actions
node_actions -->|"calls"| node_api
node_actions -.->|"updates"| node_state
node_api -.->|"requests"| node_http
node_startup -->|"loads"| node_configuration
node_startup -->|"starts"| node_http
node_http -->|"routes controls"| node_components
node_http -->|"routes stream"| node_websocket
node_http -->|"routes control"| node_onvif
node_camera -.->|"provides feed"| node_capture
node_capture -->|"uses"| node_packets
node_capture -.->|"detects motion"| node_motion
node_capture -.->|"uploads recordings"| node_cloud
node_websocket -->|"streams camera"| node_capture
node_websocket -.->|"uses"| node_webrtc
node_mqtt -->|"registers candidates"| node_webrtc
node_mqtt -->|"connects camera"| node_capture
node_operator -.->|"accesses"| node_http
node_http -->|"verifies storage"| node_cloud

click node_startup "https://github.com/kerberos-io/agent/blob/master/machinery/main.go"
click node_configuration "https://github.com/kerberos-io/agent/blob/master/machinery/src/config/main.go"
click node_http "https://github.com/kerberos-io/agent/blob/master/machinery/src/routers/http/routes.go"
click node_components "https://github.com/kerberos-io/agent/tree/master/machinery/src/components"
click node_capture "https://github.com/kerberos-io/agent/blob/master/machinery/src/capture/main.go"
click node_motion "https://github.com/kerberos-io/agent/blob/master/machinery/src/computervision/main.go"
click node_onvif "https://github.com/kerberos-io/agent/blob/master/machinery/src/onvif/main.go"
click node_packets "https://github.com/kerberos-io/agent/tree/master/machinery/src/packets"
click node_webrtc "https://github.com/kerberos-io/agent/blob/master/machinery/src/webrtc/main.go"
click node_websocket "https://github.com/kerberos-io/agent/blob/master/machinery/src/routers/websocket/main.go"
click node_mqtt "https://github.com/kerberos-io/agent/blob/master/machinery/src/routers/mqtt/main.go"
click node_cloud "https://github.com/kerberos-io/agent/tree/master/machinery/src/cloud"
click node_ui "https://github.com/kerberos-io/agent/blob/master/ui/src/App.jsx"
click node_pages "https://github.com/kerberos-io/agent/blob/master/ui/src/pages/Settings/Settings.jsx"
click node_actions "https://github.com/kerberos-io/agent/blob/master/ui/src/actions/agent.js"
click node_api "https://github.com/kerberos-io/agent/blob/master/ui/src/api/agent.js"
click node_state "https://github.com/kerberos-io/agent/blob/master/ui/src/reducers/agent.js"

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_startup,node_configuration,node_components,node_onvif toneBlue
class node_capture,node_motion,node_packets,node_webrtc toneAmber
class node_http,node_websocket,node_mqtt,node_ui,node_pages,node_actions,node_api,node_state toneMint
class node_cloud toneRose
class node_operator,node_camera toneIndigo
```

## Components

### Agent runtime

- [Agent startup](https://github.com/kerberos-io/agent/blob/master/machinery/main.go): `machinery/main.go`
- [Configuration](https://github.com/kerberos-io/agent/blob/master/machinery/src/config/main.go): `machinery/src/config/main.go`
- [Camera controls](https://github.com/kerberos-io/agent/tree/master/machinery/src/components): `machinery/src/components`
- [ONVIF control](https://github.com/kerberos-io/agent/blob/master/machinery/src/onvif/main.go): `machinery/src/onvif/main.go`

### Video processing

- [Capture and record](https://github.com/kerberos-io/agent/blob/master/machinery/src/capture/main.go): `machinery/src/capture/main.go`
- [Motion detection](https://github.com/kerberos-io/agent/blob/master/machinery/src/computervision/main.go): `machinery/src/computervision/main.go`
- [Media packets](https://github.com/kerberos-io/agent/tree/master/machinery/src/packets): `machinery/src/packets`
- [WebRTC streaming](https://github.com/kerberos-io/agent/blob/master/machinery/src/webrtc/main.go): `machinery/src/webrtc/main.go`

### User interfaces

- [HTTP API](https://github.com/kerberos-io/agent/blob/master/machinery/src/routers/http/routes.go): `machinery/src/routers/http/routes.go`
- [WebSocket streaming](https://github.com/kerberos-io/agent/blob/master/machinery/src/routers/websocket/main.go): `machinery/src/routers/websocket/main.go`
- [MQTT remote access](https://github.com/kerberos-io/agent/blob/master/machinery/src/routers/mqtt/main.go): `machinery/src/routers/mqtt/main.go`
- [Agent web UI](https://github.com/kerberos-io/agent/blob/master/ui/src/App.jsx): `ui/src/App.jsx`
- [Dashboard and settings](https://github.com/kerberos-io/agent/blob/master/ui/src/pages/Settings/Settings.jsx): `ui/src/pages/Settings/Settings.jsx`
- [UI actions](https://github.com/kerberos-io/agent/blob/master/ui/src/actions/agent.js): `ui/src/actions/agent.js`
- [UI API client](https://github.com/kerberos-io/agent/blob/master/ui/src/api/agent.js): `ui/src/api/agent.js`
- [UI state](https://github.com/kerberos-io/agent/blob/master/ui/src/reducers/agent.js): `ui/src/reducers/agent.js`

### Cloud integrations

- [Cloud and storage](https://github.com/kerberos-io/agent/tree/master/machinery/src/cloud): `machinery/src/cloud`

### Other components

- **Operator**
- **RTSP camera**

## Connections

- Operator → Agent web UI: uses
- Agent web UI → Dashboard and settings: routes to (evidence: `ui/src/index.jsx`)
- Agent web UI → UI actions: dispatches (evidence: `ui/src/App.jsx`)
- UI actions → UI API client: calls (evidence: `ui/src/actions/agent.js`)
- UI actions → UI state: updates
- UI API client → HTTP API: requests
- Agent startup → Configuration: loads (evidence: `machinery/src/config/main.go`)
- Agent startup → HTTP API: starts (evidence: `machinery/main.go`)
- HTTP API → Camera controls: routes controls (evidence: `machinery/src/routers/http/routes.go`)
- HTTP API → WebSocket streaming: routes stream (evidence: `machinery/src/routers/http/routes.go`)
- HTTP API → ONVIF control: routes control (evidence: `machinery/src/routers/http/routes.go`)
- RTSP camera → Capture and record: provides feed (evidence: `README.md`)
- Capture and record → Media packets: uses (evidence: `machinery/src/capture/main.go`)
- Capture and record → Motion detection: detects motion
- Capture and record → Cloud and storage: uploads recordings (evidence: `README.md`)
- WebSocket streaming → Capture and record: streams camera (evidence: `machinery/src/routers/websocket/main.go`)
- WebSocket streaming → WebRTC streaming: uses
- MQTT remote access → WebRTC streaming: registers candidates (evidence: `machinery/src/routers/mqtt/main.go`)
- MQTT remote access → Capture and record: connects camera (evidence: `machinery/src/routers/mqtt/main.go`)
- Operator → HTTP API: accesses (evidence: `README.md`)
- HTTP API → Cloud and storage: verifies storage (evidence: `machinery/src/routers/http/routes.go`)
