Architecture
Wonkru MDM is a mobile device management (MDM) system for Android devices. It has a Serverpod server, a Flutter admin panel, and an Android Device Owner agent.
1.1 Components
Section titled “1.1 Components”flowchart LR
subgraph Admin
P[Panel<br/>wonkru_mdm_flutter<br/>Flutter web]
end
subgraph Server[Server - wonkru_mdm_server]
API[API :8080/8090<br/>admin endpoints + DeviceEndpoint]
WEB[Web :8082<br/>panel, /storage, /downloads]
Q[(PostgreSQL<br/>device_commands queue,<br/>policies, telemetry)]
FS[(Disk storage<br/>APK, file, certificate)]
R[DeviceConnectionRegistry<br/>in-memory]
end
subgraph Device[Android device]
M[Agent<br/>wonkru_mdm_mobil<br/>Device Owner]
end
P -- RPC, cookie auth --> API
P -- file upload --> WEB
M -- register / config / sync / log --> API
M <-- persistent stream: command / ack / heartbeat --> API
M -- APK, file, CA download --> WEB
API --- Q
API --- R
WEB --- FS
| Component | Technology | Responsibility |
|---|---|---|
| Server | Serverpod 4, PostgreSQL 16 | Identity, policy, command queue, telemetry, file storage, alerts |
| Panel | Flutter web (can also be compiled for desktop), GetX, go_router, shadcn_ui, Syncfusion DataGrid | Admin interface |
| Agent | Flutter + Kotlin, Android Device Owner | Applies the policy, runs commands, sends telemetry, launcher |
wonkru_core |
Serverpod module | Shared enums, DTOs, and catalogs of the three parties |
1.2 Key decisions
Section titled “1.2 Key decisions”Persistent Serverpod connection. The agent opens a two-way connection to the server
with DeviceEndpoint.connect. The server writes commands to device_commands before
sending them. Online devices receive commands immediately. Offline devices receive them
when they reconnect. The agent reports each result with an ack message. Commands survive
server restarts, and you can track their status in the panel.
Per-device token. At enrollment the server gives each device a random 256-bit token and stores only its SHA-256 in the DB.
Policy updates. The server sends update_policy when a new version is available. The
agent fetches the full policy with config and continues applying the last valid policy
while offline.
Single server. The server keeps connection records and rate limits in memory. This deployment needs no Redis instance.
Disk storage and signed links. APKs, files, and certificates live on disk (STORAGE_PATH).
Private files are downloaded through HMAC-signed, time-limited links.
1.3 Data flow summary
Section titled “1.3 Data flow summary”| Flow | Direction | Transport |
|---|---|---|
| Enrollment | agent → server | device.register (with the enrollment key) |
| Command | panel → server → agent | adminDevice.sendCommand → queue → stream command |
| Command result | agent → server → panel | stream ack → device_commands.response → panel query |
| Policy | server → agent | update_policy command → device.config |
| Telemetry | agent → server | device.sync (full), stream heartbeat (liveness) |
| Logs, reports | agent → server | device.log, device.report |
| Application / file / certificate | server → agent | HTTP download from the links in the policy JSON |
| Alerts | server → admin | Panel notification, email |
Details: End-to-end flows.