How myz21/mdm works
1. This is a single Spring Boot backend service for Apple MDM and agent management, organized as a modular monolith rather than separate deployable services. The application entry point is AppleMdmApplication, with most behavior split into package-level subsystems under controllers, services, repositories, and models.
2. The primary request entrypoints are REST controllers in controllers/. They cover major product areas: enrollment, device management, app/catalog management, ABM/DEP/VPP integration, remote control sessions, reports, system settings, and agent operations. These controllers are thin API adapters that delegate into service-layer workflows.
3. The service layer is where most business logic lives. It is further divided into domain-oriented packages such as services/enrollment, services/agent, services/apple, services/app, services/device, services/report, services/screenshare, services/terminal, and services/vnc. This split indicates the application handles both device lifecycle management and live session orchestration, not just CRUD APIs.
4. Persistence is handled through JPA repositories in repositories/, backed by a relational database. The data model is rich and Apple-MDM-specific: devices, identities, commands, enrollment history/status, app groups, enterprise apps, telemetry, presence, locations, policies, system settings, and audit logs. Flyway migrations in src/main/resources/db/migration define schema evolution, including later additions for command reporting, bulk commands, optimistic locking, and agent auth history.
5. The domain model is explicitly separated into persistent entities under domains/ and API DTOs under models/api/. There are also specialized model packages for Apple certificates/protocols, profile payloads, and session state. This separation matters for architecture diagrams because external request/response shapes are not the same as database entities.
6. Device and agent management is a major subsystem. services/agent and related controllers support agent authentication, command dispatch, telemetry ingestion, location tracking, presence tracking, activity logging, push notifications, and geofence-related behavior. There is a time-based command timeout scheduler, suggesting asynchronous lifecycle handling around command delivery and completion.
7. Enrollment is another core subsystem and has several paths: standard enrollment, account-driven enrollment, web authentication enrollment, check-in, profile generation, disenrollment, and enrollment auditing. Enrollment also depends on identity and OAuth2/account resolution logic, which is reflected in resolver/strategy classes and EnrollmentAuditService / EnrollmentStatusService.
8. Apple ecosystem integrations are isolated in services/apple and related config classes. The codebase includes services for ABM/DEP, VPP, APNs push, certificates, SCEP, and command building/sending. Supporting model packages under models/cert and models/profile suggest the service generates Apple configuration profiles and certificate-backed payloads for managed devices.
9. Commands and policy application appear to be a central orchestration path. Policy changes trigger listeners in event/listener, which then drive command creation, queueing, sending, and compliance tracking. There are strategy classes for platform-specific payload generation across iOS, macOS, tvOS, visionOS, and watchOS, indicating policy generation is platform-aware.
10. The application also includes real-time collaboration and remote management subsystems. WebSocket configuration, Redis relay, and session models support screen sharing, remote terminal, and VNC-style connectivity. These live-session features are separated into dedicated services and handlers rather than being mixed into device CRUD logic.
11. Messaging and integration infrastructure is present beyond HTTP. RabbitMQ configuration, MQTT message routing, and Redis-backed command queueing indicate the system relies on async/event-driven flows for notifications, command delivery, and cross-node coordination. Redis is especially important for command queues and websocket/session relay behavior.
12. Reporting and analytics are treated as a separate read-optimized area. services/report and controllers/ReportController expose fleet health, compliance, enrollment trends, command trends, and security/device reports. The existence of custom repository implementations and query indexes in migrations suggests these are database-heavy aggregation queries rather than simple entity fetches.
13. Security is layered into the web boundary with custom filters and JWT handling. The repo includes agent-token authentication, platform permission checks, custom JWT conversion, and security context configuration. This implies distinct trust models for human/admin API calls versus device/agent calls.
14. Supporting concerns are handled through configuration modules: async execution, audit metadata, HTTP client beans, OpenAPI/Swagger docs, web configuration, Redis, MQTT, websocket, and enrollment-related properties. There is also a simple Thymeleaf template for enrollment-login.html, so the backend serves at least one server-rendered enrollment page in addition to JSON APIs.
15. Operationally, the project is built with Maven, packaged in Docker, and deployed via GitHub Actions. application.yaml, config/license.dat, and the deployment workflow indicate a conventional containerized Spring Boot service with externalized configuration and licensing.
Main entry points: AppleMdmApplication.java Apple MDM · repositories JPA Repos · command Command/Policy Engine · controllers Device/Agent API
Components 21
API Layer
REST controllers and request/response boundaries
- Enrollment API · Enrollment, check-in, web auth, and profile endpoints
src/main/java/com/arcyintel/arcops/apple_mdm/controllers - Device/Agent API · Device, agent auth, command, notification, and MDM control endpoints
src/main/java/com/arcyintel/arcops/apple_mdm/controllers - App/Account API · App catalog, app groups, accounts, ABM, and enterprise app endpoints
src/main/java/com/arcyintel/arcops/apple_mdm/controllers - Remote Ops API · Screen share, terminal, VNC, and remote control endpoints
src/main/java/com/arcyintel/arcops/apple_mdm/controllers - Report/System API · Reporting, dashboard, settings, discovery, and certificate endpoints
src/main/java/com/arcyintel/arcops/apple_mdm/controllers - API Models · Request/response models, cert payloads, profile payloads, and session state
src/main/java/com/arcyintel/arcops/apple_mdm/models
Service Layer
Business workflows and orchestrators
- Apple MDM · Application entry point and composition root
src/main/java/com/arcyintel/arcops/apple_mdm/AppleMdmApplication.java - Enrollment Orchestrator · Enrollment, status, audit, profile generation, auth strategy, and disenrollment flows
src/main/java/com/arcyintel/arcops/apple_mdm/services/enrollment - Device/Agent Ops · Agent auth, telemetry, location, presence, push, retention, and device lookup
src/main/java/com/arcyintel/arcops/apple_mdm/services/agent - Apple Integrations · ABM/DEP/VPP, APNs, certificates, SCEP, and Apple-specific platform services
src/main/java/com/arcyintel/arcops/apple_mdm/services/apple - Command/Policy Engine · Command build/send/queue, policy application, compliance tracking, and platform payload strategies
src/main/java/com/arcyintel/arcops/apple_mdm/services/apple/command - App Management · App catalog, app groups, enterprise apps, iTunes app resolution, and temp storage
src/main/java/com/arcyintel/arcops/apple_mdm/services/app - Remote Sessions · Screen share, remote terminal, VNC, signaling, and relay handling
src/main/java/com/arcyintel/arcops/apple_mdm/services/screenshare - Report Analytics · Fleet health, compliance, enrollment, command, and security reporting
src/main/java/com/arcyintel/arcops/apple_mdm/services/report - Settings · System setting read/write workflows
src/main/java/com/arcyintel/arcops/apple_mdm/services/settings
Persistence
Entities, repositories, and schema evolution
- JPA Repos · Repository layer for devices, enrollment, apps, commands, settings, and logs
src/main/java/com/arcyintel/arcops/apple_mdm/repositories - Domain Entities · Relational entities for devices, identities, commands, enrollment, apps, policies, and telemetry
src/main/java/com/arcyintel/arcops/apple_mdm/domains - Flyway Migrations · Versioned database changes for the MDM schema and reporting indexes
src/main/resources/db/migration
Infrastructure
Security, messaging, realtime, and configuration
- Security · JWT, agent token, platform permission, and security context filters
src/main/java/com/arcyintel/arcops/apple_mdm/configs/security - Messaging/Relay · RabbitMQ, MQTT, Redis queueing, and websocket relay infrastructure
src/main/java/com/arcyintel/arcops/apple_mdm/configs - Web Config · Async, HTTP, OpenAPI, Redis, websocket, and MVC configuration
src/main/java/com/arcyintel/arcops/apple_mdm/configs
Connections 31
- Apple MDM → Security: boots with · Security is part of application composition
- Apple MDM → Web Config: boots with · Web and infra configuration are loaded at startup
- Apple MDM → Enrollment API: exposes · Public enrollment endpoints
- Apple MDM → Device/Agent API: exposes · Device and agent endpoints
- Apple MDM → App/Account API: exposes · App, account, and ABM endpoints
- Apple MDM → Remote Ops API: exposes · Remote session endpoints
- Apple MDM → Report/System API: exposes · Reporting and system endpoints
- Enrollment API → Enrollment Orchestrator: delegates to · REST layer forwards enrollment workflows
- Device/Agent API → Device/Agent Ops: delegates to · REST layer forwards agent/device workflows
- Device/Agent API → Command/Policy Engine: delegates to · Command endpoints orchestrate policy and command flow
- App/Account API → App Management: delegates to · App and account operations use app services
- App/Account API → Apple Integrations: delegates to · ABM/DEP/VPP and certificate operations use Apple integrations
- Remote Ops API → Remote Sessions: delegates to · Remote control APIs manage live sessions
- Report/System API → Report Analytics: delegates to · Reporting endpoints use aggregation services
- Report/System API → Settings: delegates to · Settings endpoints use settings service
- Enrollment Orchestrator → JPA Repos: reads/writes · Enrollment workflows persist status and audit data
- Device/Agent Ops → JPA Repos: reads/writes · Agent workflows persist telemetry, presence, and history
- App Management → JPA Repos: reads/writes · App and account workflows persist catalog and account data
- Command/Policy Engine → JPA Repos: reads/writes · Command orchestration persists commands and compliance state
- Report Analytics → JPA Repos: queries · Reports use repository-backed aggregation queries
- JPA Repos → Domain Entities: maps · Repositories operate on JPA entities
- Flyway Migrations → Domain Entities: evolves · Schema changes track entity and reporting evolution
- Security → Enrollment API: guards · Authentication and authorization at the web boundary
- Security → Device/Agent API: guards · Agent token and platform permission checks
- Messaging/Relay → Device/Agent Ops: supports · Async notifications, relay, and command delivery
- Messaging/Relay → Command/Policy Engine: supports · Queueing and event-driven command orchestration
- Messaging/Relay → Remote Sessions: supports · Websocket relay and session coordination
- Apple Integrations → Command/Policy Engine: provides · Apple command send/build primitives support policy execution
- Command/Policy Engine → API Models: uses · Command and policy flows consume DTOs and payload models
- Enrollment Orchestrator → API Models: uses · Enrollment APIs exchange DTOs and session/auth models
- App Management → API Models: uses · App and account endpoints use request/response models