# usa-reddragon/dmrhub architecture

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

- Interactive diagram: https://gitdiagram.com/usa-reddragon/dmrhub
- Repository: https://github.com/usa-reddragon/dmrhub

## Overview

DMRHub is a single-binary DMR network server with a web administration and monitoring interface. Radio and peer traffic enters through protocol servers, which register with the routing hub; the hub supports call routing and repeater subscriptions, while the application also provides a Parrot and scheduled nets. Users manage the service through HTTP APIs and a Vue frontend, with persistent state in the database and supporting key-value and pub/sub backends. The README establishes the product capabilities; some subsystem links are omitted where the sampled source does not show their runtime wiring.

Main entry points: [`cmd/root.go`](https://github.com/usa-reddragon/dmrhub/blob/main/cmd/root.go) (Application startup), [`internal/dmr/hub/routing.go`](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/hub/routing.go) (Routing hub), [`internal/dmr/servers/mmdvm/server.go`](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/mmdvm/server.go) (MMDVM server), [`internal/http/server.go`](https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/server.go) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dmr["DMR runtime"]
  node_mmdvm["MMDVM server<br/>[server.go]"]
  node_mmdvm_packets["MMDVM packets<br/>[packet_handlers.go]"]
  node_openbridge["OpenBridge server<br/>[server.go]"]
  node_ipsc["IPSC server<br/>[server.go]"]
  node_hub["Routing hub<br/>[routing.go]"]
  node_subscriptions["Repeater subscriptions"]
  node_calltracker["Call tracking<br/>[call_tracker.go]"]
  node_parrot["Parrot playback<br/>[parrot.go]"]
  node_netscheduler["Scheduled nets<br/>[scheduler.go]"]
end

subgraph group_state["State and messaging"]
  node_database[("Application database<br/>[db.go]")]
  node_kv[("Key-value store<br/>[kv.go]")]
  node_pubsub["Pub/sub<br/>[pubsub.go]"]
end

subgraph group_web["Web interface"]
  node_httpserver["HTTP server<br/>[server.go]"]
  node_routes["API and websocket routes<br/>[routes.go]"]
  node_controllers["API controllers"]
  node_frontend["Web frontend<br/>[App.vue]"]
  node_frontend_routes["Frontend routes<br/>[routes.ts]"]
  node_api_client["Frontend API client<br/>[API.ts]"]
end

subgraph group_operations["Application services"]
  node_config["Configuration<br/>[config.go]"]
  node_entry["Application startup<br/>[root.go]"]
  node_metrics["Metrics endpoint<br/>[server.go]"]
  node_pprof["Profiling endpoint<br/>[server.go]"]
end

node_radio(("MMDVM repeater"))
node_peer(("OpenBridge peer"))
node_operator(("Web user"))

node_radio -->|"sends packets"| node_mmdvm
node_mmdvm -->|"dispatches packets"| node_mmdvm_packets
node_mmdvm -->|"registers with"| node_hub
node_peer -->|"sends packets"| node_openbridge
node_openbridge -->|"registers with"| node_hub
node_ipsc -.->|"registers with"| node_hub
node_hub -->|"manages"| node_subscriptions
node_entry -->|"starts"| node_mmdvm
node_entry -->|"starts"| node_openbridge
node_entry -->|"starts"| node_ipsc
node_entry -->|"creates"| node_hub
node_entry -->|"starts"| node_calltracker
node_entry -->|"starts"| node_netscheduler
node_entry -->|"initializes"| node_database
node_entry -->|"starts"| node_httpserver
node_entry -->|"loads"| node_config
node_entry -->|"starts"| node_metrics
node_entry -->|"starts"| node_pprof
node_operator -->|"uses"| node_frontend
node_frontend -->|"uses routes"| node_frontend_routes
node_operator -.->|"requests pages"| node_httpserver
node_httpserver -->|"mounts routes"| node_routes
node_routes -->|"routes requests"| node_controllers
node_api_client -.->|"calls API"| node_routes
node_entry -->|"configures"| node_kv
node_entry -->|"configures"| node_pubsub
node_parrot -->|"stores stream state"| node_kv
node_httpserver -->|"provides scheduler"| node_netscheduler
node_routes -->|"serves call websocket"| node_hub

click node_mmdvm "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/mmdvm/server.go"
click node_mmdvm_packets "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/mmdvm/packet_handlers.go"
click node_openbridge "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/openbridge/server.go"
click node_ipsc "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/ipsc/server.go"
click node_hub "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/hub/routing.go"
click node_subscriptions "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/hub/subscription_manager.go"
click node_calltracker "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/calltracker/call_tracker.go"
click node_parrot "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/parrot/parrot.go"
click node_netscheduler "https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/netscheduler/scheduler.go"
click node_database "https://github.com/usa-reddragon/dmrhub/blob/main/internal/db/db.go"
click node_kv "https://github.com/usa-reddragon/dmrhub/blob/main/internal/kv/kv.go"
click node_pubsub "https://github.com/usa-reddragon/dmrhub/blob/main/internal/pubsub/pubsub.go"
click node_httpserver "https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/server.go"
click node_routes "https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/api/routes.go"
click node_controllers "https://github.com/usa-reddragon/dmrhub/tree/main/internal/http/api/controllers/v1"
click node_frontend "https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/frontend/src/App.vue"
click node_frontend_routes "https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/frontend/src/router/routes.ts"
click node_api_client "https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/frontend/src/services/API.ts"
click node_config "https://github.com/usa-reddragon/dmrhub/blob/main/internal/config/config.go"
click node_entry "https://github.com/usa-reddragon/dmrhub/blob/main/cmd/root.go"
click node_metrics "https://github.com/usa-reddragon/dmrhub/blob/main/internal/metrics/server.go"
click node_pprof "https://github.com/usa-reddragon/dmrhub/blob/main/internal/pprof/server.go"

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_mmdvm,node_mmdvm_packets,node_openbridge,node_ipsc,node_hub,node_subscriptions,node_calltracker,node_parrot,node_netscheduler,node_operator toneBlue
class node_database,node_kv,node_pubsub toneAmber
class node_httpserver,node_routes,node_controllers,node_frontend,node_frontend_routes,node_api_client toneMint
class node_config,node_entry,node_metrics,node_pprof toneRose
class node_radio,node_peer toneIndigo
```

## Components

### DMR runtime

- [MMDVM server](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/mmdvm/server.go): `internal/dmr/servers/mmdvm/server.go`
- [MMDVM packets](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/mmdvm/packet_handlers.go): `internal/dmr/servers/mmdvm/packet_handlers.go`
- [OpenBridge server](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/openbridge/server.go): `internal/dmr/servers/openbridge/server.go`
- [IPSC server](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/servers/ipsc/server.go): `internal/dmr/servers/ipsc/server.go`
- [Routing hub](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/hub/routing.go): `internal/dmr/hub/routing.go`
- [Repeater subscriptions](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/hub/subscription_manager.go): `internal/dmr/hub/subscription_manager.go`
- [Call tracking](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/calltracker/call_tracker.go): `internal/dmr/calltracker/call_tracker.go`
- [Parrot playback](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/parrot/parrot.go): `internal/dmr/parrot/parrot.go`
- [Scheduled nets](https://github.com/usa-reddragon/dmrhub/blob/main/internal/dmr/netscheduler/scheduler.go): `internal/dmr/netscheduler/scheduler.go`

### State and messaging

- [Application database](https://github.com/usa-reddragon/dmrhub/blob/main/internal/db/db.go): `internal/db/db.go`
- [Key-value store](https://github.com/usa-reddragon/dmrhub/blob/main/internal/kv/kv.go): `internal/kv/kv.go`
- [Pub/sub](https://github.com/usa-reddragon/dmrhub/blob/main/internal/pubsub/pubsub.go): `internal/pubsub/pubsub.go`

### Web interface

- [HTTP server](https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/server.go): `internal/http/server.go`
- [API and websocket routes](https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/api/routes.go): `internal/http/api/routes.go`
- [API controllers](https://github.com/usa-reddragon/dmrhub/tree/main/internal/http/api/controllers/v1): `internal/http/api/controllers/v1`
- [Web frontend](https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/frontend/src/App.vue): `internal/http/frontend/src/App.vue`
- [Frontend routes](https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/frontend/src/router/routes.ts): `internal/http/frontend/src/router/routes.ts`
- [Frontend API client](https://github.com/usa-reddragon/dmrhub/blob/main/internal/http/frontend/src/services/API.ts): `internal/http/frontend/src/services/API.ts`

### Application services

- [Configuration](https://github.com/usa-reddragon/dmrhub/blob/main/internal/config/config.go): `internal/config/config.go`
- [Application startup](https://github.com/usa-reddragon/dmrhub/blob/main/cmd/root.go): `cmd/root.go`
- [Metrics endpoint](https://github.com/usa-reddragon/dmrhub/blob/main/internal/metrics/server.go): `internal/metrics/server.go`
- [Profiling endpoint](https://github.com/usa-reddragon/dmrhub/blob/main/internal/pprof/server.go): `internal/pprof/server.go`

### Other components

- **MMDVM repeater**
- **OpenBridge peer**
- **Web user**

## Connections

- MMDVM repeater → MMDVM server: sends packets
- MMDVM server → MMDVM packets: dispatches packets (evidence: `internal/dmr/servers/mmdvm/server.go`)
- MMDVM server → Routing hub: registers with (evidence: `internal/dmr/servers/mmdvm/server.go`)
- OpenBridge peer → OpenBridge server: sends packets
- OpenBridge server → Routing hub: registers with (evidence: `internal/dmr/servers/openbridge/server.go`)
- IPSC server → Routing hub: registers with
- Routing hub → Repeater subscriptions: manages (evidence: `internal/dmr/hub/subscription_manager.go`)
- Application startup → MMDVM server: starts (evidence: `cmd/root.go`)
- Application startup → OpenBridge server: starts (evidence: `cmd/root.go`)
- Application startup → IPSC server: starts (evidence: `cmd/root.go`)
- Application startup → Routing hub: creates (evidence: `cmd/root.go`)
- Application startup → Call tracking: starts (evidence: `cmd/root.go`)
- Application startup → Scheduled nets: starts (evidence: `cmd/root.go`)
- Application startup → Application database: initializes (evidence: `cmd/root.go`)
- Application startup → HTTP server: starts (evidence: `cmd/root.go`)
- Application startup → Configuration: loads (evidence: `cmd/root.go`)
- Application startup → Metrics endpoint: starts (evidence: `cmd/root.go`)
- Application startup → Profiling endpoint: starts (evidence: `cmd/root.go`)
- Web user → Web frontend: uses
- Web frontend → Frontend routes: uses routes
- Web user → HTTP server: requests pages
- HTTP server → API and websocket routes: mounts routes (evidence: `internal/http/server.go`)
- API and websocket routes → API controllers: routes requests (evidence: `internal/http/api/routes.go`)
- Frontend API client → API and websocket routes: calls API
- Application startup → Key-value store: configures (evidence: `cmd/root.go`)
- Application startup → Pub/sub: configures (evidence: `cmd/root.go`)
- Parrot playback → Key-value store: stores stream state
- HTTP server → Scheduled nets: provides scheduler (evidence: `internal/http/server.go`)
- API and websocket routes → Routing hub: serves call websocket (evidence: `internal/http/api/routes.go`)
