# floodww/routineops architecture

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

- Interactive diagram: https://gitdiagram.com/floodww/routineops
- Repository: https://github.com/floodww/routineops

## Overview

RoutineOps is a self-hosted, cross-platform MDM/RMM product. Its main workflow enrolls an agent with a device certificate, maintains a secure server connection, reports device state, and receives administrative actions; operators manage the fleet through the web panel and REST API. The graph also preserves documented policy, security, update, alerting, and configuration-as-code capabilities. Some links reflect README-level contracts because their implementations were not sampled; those are cited to the README rather than inferred from module names.

Main entry points: [`cmd/agent/main.go`](https://github.com/floodww/routineops/blob/main/cmd/agent/main.go) (Agent runtime), [`internal/server/api/handler.go`](https://github.com/floodww/routineops/blob/main/internal/server/api/handler.go) (REST API), [`internal/server/gateway/gateway.go`](https://github.com/floodww/routineops/blob/main/internal/server/gateway/gateway.go) (Agent gateway), [`internal/server/storage/postgres.go`](https://github.com/floodww/routineops/blob/main/internal/server/storage/postgres.go) (Fleet database)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_agent["Device agent"]
  node_agent_runtime["Agent runtime<br/>[main.go]"]
  node_enrollment["Certificate enrollment<br/>[enroll.go]"]
  node_inventory["Device inventory<br/>[collector.go]"]
  node_script_runner["Script execution<br/>[runner.go]"]
  node_policy_sync["Policy sync<br/>[sync.go]"]
  node_security_monitor["Security monitoring<br/>[monitor.go]"]
  node_device_lock["Device lock<br/>[lock.go]"]
  node_admin_access["Admin access<br/>[manager.go]"]
  node_agent_updates["Agent self-update<br/>[selfupdate.go]"]
end

subgraph group_server["Server services"]
  node_server_runtime["Server runtime<br/>[main.go]"]
  node_rest_api["REST API<br/>[handler.go]"]
  node_grpc_gateway["Agent gateway<br/>[gateway.go]"]
  node_task_worker["Task worker<br/>[worker.go]"]
  node_uninstall_service["Software removal<br/>[routes.go]"]
end

subgraph group_panel["Management panel"]
  node_web_app["Panel application<br/>[App.tsx]"]
  node_panel_pages["Fleet management pages<br/>[Devices.tsx]"]
  node_api_client["Panel API client<br/>[api.ts]"]
end

subgraph group_state["Fleet state"]
  node_database[("Fleet database<br/>[postgres.go]")]
end

subgraph group_ops["Operational tooling"]
  node_config_cli["YAML configuration CLI<br/>[main.go]"]
  node_release_publisher["Release publisher<br/>[main.go]"]
end

node_operator(("IT operator"))
node_device(("Managed device"))

node_operator -->|"uses"| node_web_app
node_web_app -->|"routes to"| node_panel_pages
node_panel_pages -.->|"requests data"| node_api_client
node_api_client -.->|"calls REST"| node_rest_api
node_rest_api -->|"reads and writes"| node_database
node_server_runtime -.->|"mounts routes"| node_rest_api
node_server_runtime -->|"registers service"| node_grpc_gateway
node_grpc_gateway -.->|"persists device state"| node_database
node_grpc_gateway -.->|"dispatches tasks"| node_task_worker
node_device -->|"requests certificate"| node_enrollment
node_agent_runtime -->|"runs enrollment"| node_enrollment
node_agent_runtime -->|"maintains mTLS channel"| node_grpc_gateway
node_device -->|"runs on"| node_agent_runtime
node_agent_runtime -->|"collects state"| node_inventory
node_inventory -.->|"reports inventory"| node_grpc_gateway
node_grpc_gateway -.->|"sends commands"| node_agent_runtime
node_agent_runtime -.->|"runs scripts"| node_script_runner
node_rest_api -.->|"queues work"| node_task_worker
node_rest_api -->|"routes uninstall"| node_uninstall_service
node_uninstall_service -->|"selects target"| node_database
node_agent_runtime -->|"syncs policies"| node_policy_sync
node_policy_sync -.->|"feeds policy cache"| node_security_monitor
node_agent_runtime -->|"monitors device"| node_security_monitor
node_agent_runtime -.->|"enforces lock"| node_device_lock
node_agent_runtime -->|"handles privilege requests"| node_admin_access
node_agent_runtime -.->|"checks updates"| node_agent_updates
node_release_publisher -->|"registers signed release"| node_database
node_config_cli -.->|"applies configuration"| node_rest_api
node_config_cli -.->|"exports configuration"| node_database

click node_agent_runtime "https://github.com/floodww/routineops/blob/main/cmd/agent/main.go"
click node_enrollment "https://github.com/floodww/routineops/blob/main/internal/agent/enroll/enroll.go"
click node_inventory "https://github.com/floodww/routineops/blob/main/internal/agent/collector/collector.go"
click node_script_runner "https://github.com/floodww/routineops/blob/main/internal/agent/scripts/runner.go"
click node_policy_sync "https://github.com/floodww/routineops/blob/main/internal/agent/policy/sync.go"
click node_security_monitor "https://github.com/floodww/routineops/blob/main/internal/agent/security/monitor.go"
click node_device_lock "https://github.com/floodww/routineops/blob/main/internal/agent/lock/lock.go"
click node_admin_access "https://github.com/floodww/routineops/blob/main/internal/agent/admin/manager.go"
click node_agent_updates "https://github.com/floodww/routineops/blob/main/internal/agent/selfupdate/selfupdate.go"
click node_server_runtime "https://github.com/floodww/routineops/blob/main/cmd/server/main.go"
click node_rest_api "https://github.com/floodww/routineops/blob/main/internal/server/api/handler.go"
click node_grpc_gateway "https://github.com/floodww/routineops/blob/main/internal/server/gateway/gateway.go"
click node_task_worker "https://github.com/floodww/routineops/blob/main/internal/server/worker/worker.go"
click node_uninstall_service "https://github.com/floodww/routineops/blob/main/internal/server/uninstall/routes.go"
click node_database "https://github.com/floodww/routineops/blob/main/internal/server/storage/postgres.go"
click node_web_app "https://github.com/floodww/routineops/blob/main/web/src/App.tsx"
click node_panel_pages "https://github.com/floodww/routineops/blob/main/web/src/pages/Devices.tsx"
click node_api_client "https://github.com/floodww/routineops/blob/main/web/src/lib/api.ts"
click node_config_cli "https://github.com/floodww/routineops/blob/main/cmd/routineops/main.go"
click node_release_publisher "https://github.com/floodww/routineops/blob/main/cmd/publish-release/main.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_agent_runtime,node_enrollment,node_inventory,node_script_runner,node_policy_sync,node_security_monitor,node_device_lock,node_admin_access,node_agent_updates toneBlue
class node_server_runtime,node_rest_api,node_grpc_gateway,node_task_worker,node_uninstall_service toneAmber
class node_web_app,node_panel_pages,node_api_client toneMint
class node_database toneRose
class node_config_cli,node_release_publisher,node_operator,node_device toneIndigo
```

## Components

### Device agent

- [Agent runtime](https://github.com/floodww/routineops/blob/main/cmd/agent/main.go): `cmd/agent/main.go`
- [Certificate enrollment](https://github.com/floodww/routineops/blob/main/internal/agent/enroll/enroll.go): `internal/agent/enroll/enroll.go`
- [Device inventory](https://github.com/floodww/routineops/blob/main/internal/agent/collector/collector.go): `internal/agent/collector/collector.go`
- [Script execution](https://github.com/floodww/routineops/blob/main/internal/agent/scripts/runner.go): `internal/agent/scripts/runner.go`
- [Policy sync](https://github.com/floodww/routineops/blob/main/internal/agent/policy/sync.go): `internal/agent/policy/sync.go`
- [Security monitoring](https://github.com/floodww/routineops/blob/main/internal/agent/security/monitor.go): `internal/agent/security/monitor.go`
- [Device lock](https://github.com/floodww/routineops/blob/main/internal/agent/lock/lock.go): `internal/agent/lock/lock.go`
- [Admin access](https://github.com/floodww/routineops/blob/main/internal/agent/admin/manager.go): `internal/agent/admin/manager.go`
- [Agent self-update](https://github.com/floodww/routineops/blob/main/internal/agent/selfupdate/selfupdate.go): `internal/agent/selfupdate/selfupdate.go`

### Server services

- [Server runtime](https://github.com/floodww/routineops/blob/main/cmd/server/main.go): `cmd/server/main.go`
- [REST API](https://github.com/floodww/routineops/blob/main/internal/server/api/handler.go): `internal/server/api/handler.go`
- [Agent gateway](https://github.com/floodww/routineops/blob/main/internal/server/gateway/gateway.go): `internal/server/gateway/gateway.go`
- [Task worker](https://github.com/floodww/routineops/blob/main/internal/server/worker/worker.go): `internal/server/worker/worker.go`
- [Software removal](https://github.com/floodww/routineops/blob/main/internal/server/uninstall/routes.go): `internal/server/uninstall/routes.go`

### Management panel

- [Panel application](https://github.com/floodww/routineops/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Fleet management pages](https://github.com/floodww/routineops/blob/main/web/src/pages/Devices.tsx): `web/src/pages/Devices.tsx`
- [Panel API client](https://github.com/floodww/routineops/blob/main/web/src/lib/api.ts): `web/src/lib/api.ts`

### Fleet state

- [Fleet database](https://github.com/floodww/routineops/blob/main/internal/server/storage/postgres.go): `internal/server/storage/postgres.go`

### Operational tooling

- [YAML configuration CLI](https://github.com/floodww/routineops/blob/main/cmd/routineops/main.go): `cmd/routineops/main.go`
- [Release publisher](https://github.com/floodww/routineops/blob/main/cmd/publish-release/main.go): `cmd/publish-release/main.go`

### Other components

- **IT operator**
- **Managed device**

## Connections

- IT operator → Panel application: uses (evidence: `web/src/App.tsx`)
- Panel application → Fleet management pages: routes to (evidence: `web/src/App.tsx`)
- Fleet management pages → Panel API client: requests data
- Panel API client → REST API: calls REST
- REST API → Fleet database: reads and writes (evidence: `internal/server/api/handler.go`)
- Server runtime → REST API: mounts routes
- Server runtime → Agent gateway: registers service (evidence: `cmd/server/main.go`)
- Agent gateway → Fleet database: persists device state
- Agent gateway → Task worker: dispatches tasks
- Managed device → Certificate enrollment: requests certificate (evidence: `README.md`)
- Agent runtime → Certificate enrollment: runs enrollment (evidence: `cmd/agent/main.go`)
- Agent runtime → Agent gateway: maintains mTLS channel (evidence: `README.md`)
- Managed device → Agent runtime: runs on (evidence: `README.md`)
- Agent runtime → Device inventory: collects state (evidence: `cmd/agent/main.go`)
- Device inventory → Agent gateway: reports inventory
- Agent gateway → Agent runtime: sends commands
- Agent runtime → Script execution: runs scripts
- REST API → Task worker: queues work
- REST API → Software removal: routes uninstall (evidence: `internal/server/uninstall/routes.go`)
- Software removal → Fleet database: selects target (evidence: `internal/server/uninstall/routes.go`)
- Agent runtime → Policy sync: syncs policies (evidence: `cmd/agent/main.go`)
- Policy sync → Security monitoring: feeds policy cache
- Agent runtime → Security monitoring: monitors device (evidence: `cmd/agent/main.go`)
- Agent runtime → Device lock: enforces lock
- Agent runtime → Admin access: handles privilege requests (evidence: `cmd/agent/main.go`)
- Agent runtime → Agent self-update: checks updates
- Release publisher → Fleet database: registers signed release (evidence: `cmd/publish-release/main.go`)
- YAML configuration CLI → REST API: applies configuration
- YAML configuration CLI → Fleet database: exports configuration
