# mdmesh-app/mdmesh architecture

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

- Interactive diagram: https://gitdiagram.com/mdmesh-app/mdmesh
- Repository: https://github.com/mdmesh-app/mdmesh

## Overview

MDMesh is a self-hosted Android MDM: administrators enroll and manage a device fleet through a React console and Java control plane, while a Kotlin Device-Owner agent checks in, reports state, and applies commands and desired configuration. The graph emphasizes enrollment, fleet management, app delivery, kiosk/policy control, telemetry/location, and connectivity. Several server and console capabilities are documented but their full implementations were not sampled; those links are identified as README-supported rather than inferred from source.

Main entry points: [`server/src/main/java/com/hmdm/rest/resource`](https://github.com/mdmesh-app/mdmesh/tree/main/server/src/main/java/com/hmdm/rest/resource) (REST control plane), [`web/src/App.tsx`](https://github.com/mdmesh-app/mdmesh/blob/main/web/src/App.tsx) (Console routes), [`agent-android/core/src/main/kotlin/com/mdmesh/core/sync/CheckInCoordinator.kt`](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/sync/CheckInCoordinator.kt) (Check-in coordination), [`agent-android/core/src/main/kotlin/com/mdmesh/core/command/CommandDispatcher.kt`](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/command/CommandDispatcher.kt) (Command dispatch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Admin console"]
  node_console_app["Console routes<br/>[App.tsx]"]
  node_device_views["Fleet views<br/>[DevicesPage.tsx]"]
  node_device_detail["Device detail"]
  node_app_config_views["Apps and configs<br/>[AppsPage.tsx]"]
  node_enroll_view["Enrollment view<br/>[EnrollPage.tsx]"]
end

subgraph group_server["Control plane"]
  node_server_api["REST control plane"]
  node_device_store[("Device persistence<br/>[DeviceDAO.java]")]
  node_status_service["Configuration status"]
  node_event_service["Event dispatch<br/>[EventService.java]"]
end

subgraph group_agent["Device agent"]
  node_enrollment["Device enrollment"]
  node_checkin_service["Check-in runtime<br/>[CheckInService.kt]"]
  node_checkin_coord["Check-in coordination"]
  node_telemetry["Device telemetry"]
  node_command_dispatch["Command dispatch"]
end

subgraph group_management["Device management"]
  node_install["App installation<br/>[InstallManager.kt]"]
  node_policy["Device policies<br/>[PolicyManager.kt]"]
  node_kiosk["Kiosk mode<br/>[KioskApplier.kt]"]
  node_location["Location tracking"]
end

subgraph group_runtime["Connectivity and updates"]
  node_connectivity["Wake transport"]
  node_agent_identity[("Device identity<br/>[DeviceIdentity.kt]")]
end

node_admin(("Administrator"))
node_mdm_server(("MDM server"))

node_admin -->|"manages fleet"| node_console_app
node_console_app -->|"routes to"| node_device_views
node_console_app -->|"routes to"| node_device_detail
node_console_app -->|"routes to"| node_app_config_views
node_console_app -->|"routes to"| node_enroll_view
node_device_views -.->|"requests fleet data"| node_server_api
node_device_detail -.->|"requests device data"| node_server_api
node_app_config_views -.->|"manages apps and configs"| node_server_api
node_enroll_view -.->|"requests enrollment QR"| node_server_api
node_server_api -.->|"reads and writes"| node_device_store
node_server_api -.->|"reports config status"| node_status_service
node_enrollment -->|"posts enrollment"| node_server_api
node_enrollment -->|"saves credentials"| node_agent_identity
node_checkin_service -->|"runs check-in"| node_checkin_coord
node_checkin_service -->|"starts wake transport"| node_connectivity
node_checkin_coord -->|"checks in"| node_mdm_server
node_checkin_coord -.->|"collects device state"| node_telemetry
node_checkin_coord -.->|"handles commands"| node_command_dispatch
node_command_dispatch -.->|"installs apps"| node_install
node_command_dispatch -.->|"applies policies"| node_policy
node_command_dispatch -.->|"applies kiosk state"| node_kiosk
node_checkin_coord -.->|"reports location"| node_location
node_connectivity -.->|"signals wake"| node_mdm_server
node_server_api -.->|"publishes events"| node_event_service
node_mdm_server -.->|"delivers desired state"| node_checkin_service

click node_console_app "https://github.com/mdmesh-app/mdmesh/blob/main/web/src/App.tsx"
click node_device_views "https://github.com/mdmesh-app/mdmesh/blob/main/web/src/pages/DevicesPage.tsx"
click node_device_detail "https://github.com/mdmesh-app/mdmesh/blob/main/web/src/pages/DeviceDetailPage.tsx"
click node_app_config_views "https://github.com/mdmesh-app/mdmesh/blob/main/web/src/pages/AppsPage.tsx"
click node_enroll_view "https://github.com/mdmesh-app/mdmesh/blob/main/web/src/pages/EnrollPage.tsx"
click node_server_api "https://github.com/mdmesh-app/mdmesh/tree/main/server/src/main/java/com/hmdm/rest/resource"
click node_device_store "https://github.com/mdmesh-app/mdmesh/blob/main/common/src/main/java/com/hmdm/persistence/DeviceDAO.java"
click node_status_service "https://github.com/mdmesh-app/mdmesh/blob/main/common/src/main/java/com/hmdm/service/DeviceStatusService.java"
click node_event_service "https://github.com/mdmesh-app/mdmesh/blob/main/common/src/main/java/com/hmdm/event/EventService.java"
click node_enrollment "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/sync/EnrollmentManager.kt"
click node_checkin_service "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/app/src/main/kotlin/com/mdmesh/agent/service/CheckInService.kt"
click node_checkin_coord "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/sync/CheckInCoordinator.kt"
click node_telemetry "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/telemetry/TelemetryAssembler.kt"
click node_command_dispatch "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/command/CommandDispatcher.kt"
click node_install "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/install/InstallManager.kt"
click node_policy "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/policy/src/main/kotlin/com/mdmesh/policy/PolicyManager.kt"
click node_kiosk "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/kiosk/KioskApplier.kt"
click node_location "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/location/LocationCollector.kt"
click node_connectivity "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/transport/TransportManager.kt"
click node_agent_identity "https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/store/DeviceIdentity.kt"

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_console_app,node_device_views,node_device_detail,node_app_config_views,node_enroll_view toneBlue
class node_server_api,node_device_store,node_status_service,node_event_service toneAmber
class node_enrollment,node_checkin_service,node_checkin_coord,node_telemetry,node_command_dispatch,node_mdm_server toneMint
class node_install,node_policy,node_kiosk,node_location toneRose
class node_connectivity,node_agent_identity,node_admin toneIndigo
```

## Components

### Admin console

- [Console routes](https://github.com/mdmesh-app/mdmesh/blob/main/web/src/App.tsx): `web/src/App.tsx`
- [Fleet views](https://github.com/mdmesh-app/mdmesh/blob/main/web/src/pages/DevicesPage.tsx): `web/src/pages/DevicesPage.tsx`
- [Device detail](https://github.com/mdmesh-app/mdmesh/blob/main/web/src/pages/DeviceDetailPage.tsx): `web/src/pages/DeviceDetailPage.tsx`
- [Apps and configs](https://github.com/mdmesh-app/mdmesh/blob/main/web/src/pages/AppsPage.tsx): `web/src/pages/AppsPage.tsx`
- [Enrollment view](https://github.com/mdmesh-app/mdmesh/blob/main/web/src/pages/EnrollPage.tsx): `web/src/pages/EnrollPage.tsx`

### Control plane

- [REST control plane](https://github.com/mdmesh-app/mdmesh/tree/main/server/src/main/java/com/hmdm/rest/resource): `server/src/main/java/com/hmdm/rest/resource`
- [Device persistence](https://github.com/mdmesh-app/mdmesh/blob/main/common/src/main/java/com/hmdm/persistence/DeviceDAO.java): `common/src/main/java/com/hmdm/persistence/DeviceDAO.java`
- [Configuration status](https://github.com/mdmesh-app/mdmesh/blob/main/common/src/main/java/com/hmdm/service/DeviceStatusService.java): `common/src/main/java/com/hmdm/service/DeviceStatusService.java`
- [Event dispatch](https://github.com/mdmesh-app/mdmesh/blob/main/common/src/main/java/com/hmdm/event/EventService.java): `common/src/main/java/com/hmdm/event/EventService.java`

### Device agent

- [Device enrollment](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/sync/EnrollmentManager.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/sync/EnrollmentManager.kt`
- [Check-in runtime](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/app/src/main/kotlin/com/mdmesh/agent/service/CheckInService.kt): `agent-android/app/src/main/kotlin/com/mdmesh/agent/service/CheckInService.kt`
- [Check-in coordination](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/sync/CheckInCoordinator.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/sync/CheckInCoordinator.kt`
- [Device telemetry](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/telemetry/TelemetryAssembler.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/telemetry/TelemetryAssembler.kt`
- [Command dispatch](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/command/CommandDispatcher.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/command/CommandDispatcher.kt`

### Device management

- [App installation](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/install/InstallManager.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/install/InstallManager.kt`
- [Device policies](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/policy/src/main/kotlin/com/mdmesh/policy/PolicyManager.kt): `agent-android/policy/src/main/kotlin/com/mdmesh/policy/PolicyManager.kt`
- [Kiosk mode](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/kiosk/KioskApplier.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/kiosk/KioskApplier.kt`
- [Location tracking](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/location/LocationCollector.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/location/LocationCollector.kt`

### Connectivity and updates

- [Wake transport](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/transport/TransportManager.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/transport/TransportManager.kt`
- [Device identity](https://github.com/mdmesh-app/mdmesh/blob/main/agent-android/core/src/main/kotlin/com/mdmesh/core/store/DeviceIdentity.kt): `agent-android/core/src/main/kotlin/com/mdmesh/core/store/DeviceIdentity.kt`

### Other components

- **Administrator**
- **MDM server**

## Connections

- Administrator → Console routes: manages fleet (evidence: `README.md`)
- Console routes → Fleet views: routes to (evidence: `web/src/App.tsx`)
- Console routes → Device detail: routes to (evidence: `web/src/App.tsx`)
- Console routes → Apps and configs: routes to (evidence: `web/src/App.tsx`)
- Console routes → Enrollment view: routes to (evidence: `web/src/App.tsx`)
- Fleet views → REST control plane: requests fleet data
- Device detail → REST control plane: requests device data
- Apps and configs → REST control plane: manages apps and configs (evidence: `README.md`)
- Enrollment view → REST control plane: requests enrollment QR (evidence: `README.md`)
- REST control plane → Device persistence: reads and writes
- REST control plane → Configuration status: reports config status
- Device enrollment → REST control plane: posts enrollment (evidence: `agent-android/core/src/main/kotlin/com/mdmesh/core/sync/EnrollmentManager.kt`)
- Device enrollment → Device identity: saves credentials (evidence: `agent-android/core/src/main/kotlin/com/mdmesh/core/sync/EnrollmentManager.kt`)
- Check-in runtime → Check-in coordination: runs check-in (evidence: `agent-android/app/src/main/kotlin/com/mdmesh/agent/service/CheckInService.kt`)
- Check-in runtime → Wake transport: starts wake transport (evidence: `agent-android/app/src/main/kotlin/com/mdmesh/agent/service/CheckInService.kt`)
- Check-in coordination → MDM server: checks in (evidence: `README.md`)
- Check-in coordination → Device telemetry: collects device state
- Check-in coordination → Command dispatch: handles commands (evidence: `README.md`)
- Command dispatch → App installation: installs apps (evidence: `README.md`)
- Command dispatch → Device policies: applies policies (evidence: `README.md`)
- Command dispatch → Kiosk mode: applies kiosk state (evidence: `README.md`)
- Check-in coordination → Location tracking: reports location (evidence: `README.md`)
- Wake transport → MDM server: signals wake (evidence: `README.md`)
- REST control plane → Event dispatch: publishes events
- MDM server → Check-in runtime: delivers desired state (evidence: `README.md`)
