# nazard2008/ideal-octo-rotary-phone architecture

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

- Interactive diagram: https://gitdiagram.com/nazard2008/ideal-octo-rotary-phone
- Repository: https://github.com/nazard2008/ideal-octo-rotary-phone

## Overview

LIUMA is a device-management platform comprising an Android agent, a web console, and a Fastify backend. The apparent workflow is an operator using the console to manage devices and request device capabilities; the backend exposes APIs and sockets, while the agent connects and routes commands to feature services. The source index and excerpts support the Android service/socket and backend startup/authentication relationships shown; most console-to-backend and device-feature wiring was not sampled, so those links are marked unverified or omitted.

Main entry points: [`backend/src/index.ts`](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/index.ts) (HTTP server), [`frontend/src/pages/device`](https://github.com/nazard2008/ideal-octo-rotary-phone/tree/main/frontend/src/pages/device) (Device views), [`backend/src/routes/auth.ts`](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/routes/auth.ts) (Authentication), [`LIUMA/app/src/main/java/com/liuma/app/service/MainService.java`](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/service/MainService.java) (Main service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Operator console"]
  node_web_console["Web console<br/>[App.tsx]"]
  node_device_views["Device views"]
  node_web_api["API client<br/>[api.ts]"]
  node_web_socket["Socket client<br/>[socket.ts]"]
end

subgraph group_server["Backend services"]
  node_backend["HTTP server<br/>[index.ts]"]
  node_auth_routes["Authentication<br/>[auth.ts]"]
  node_auth_middleware["Auth middleware<br/>[auth.ts]"]
  node_device_routes["Device routes<br/>[device.ts]"]
  node_other_routes["Management routes"]
  node_socket_service["Socket service<br/>[socket.ts]"]
  node_task_manager["Task manager<br/>[tasks.ts]"]
  node_db_layer["Database access<br/>[index.ts]"]
  node_sqlite[("SQLite data<br/>[schema.ts]")]
end

subgraph group_agent["Android agent"]
  node_android_app["Agent startup<br/>[LiumaApp.java]"]
  node_main_service["Main service<br/>[MainService.java]"]
  node_protocol["Command protocol<br/>[Protocol.java]"]
  node_socket_client["Device socket<br/>[SocketClient.java]"]
  node_command_router["Command router"]
end

subgraph group_device_features["Device capabilities"]
  node_device_features["Device feature services"]
  node_screen_capture["Screen capture"]
  node_remote_control["Remote control"]
  node_hvnc["Virtual display<br/>[HvncService.kt]"]
  node_location["Location tracking<br/>[LocationService.kt]"]
end

node_operator(("Operator"))

node_operator -.->|"uses"| node_web_console
node_web_console -.->|"presents"| node_device_views
node_device_views -.->|"requests data"| node_web_api
node_device_views -.->|"sends commands"| node_web_socket
node_web_api -.->|"HTTP requests"| node_backend
node_web_socket -.->|"socket events"| node_socket_service
node_backend -->|"registers"| node_auth_routes
node_backend -->|"registers"| node_device_routes
node_backend -->|"registers"| node_other_routes
node_backend -->|"initializes"| node_socket_service
node_backend -->|"starts"| node_task_manager
node_auth_routes -->|"gets user"| node_auth_middleware
node_auth_routes -->|"reads and writes"| node_db_layer
node_auth_middleware -->|"checks session"| node_db_layer
node_db_layer -->|"persists records"| node_sqlite
node_android_app -.->|"starts"| node_main_service
node_main_service -->|"uses connection"| node_socket_client
node_main_service -->|"initializes"| node_command_router
node_socket_client -->|"initializes"| node_command_router
node_socket_client -.->|"enrolls and connects"| node_backend
node_command_router -.->|"dispatches commands"| node_device_features
node_remote_control -->|"uses capture"| node_screen_capture
node_hvnc -.->|"provides capability"| node_device_features
node_location -.->|"provides capability"| node_device_features

click node_web_console "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/frontend/src/App.tsx"
click node_device_views "https://github.com/nazard2008/ideal-octo-rotary-phone/tree/main/frontend/src/pages/device"
click node_web_api "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/frontend/src/services/api.ts"
click node_web_socket "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/frontend/src/services/socket.ts"
click node_backend "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/index.ts"
click node_auth_routes "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/routes/auth.ts"
click node_auth_middleware "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/middleware/auth.ts"
click node_device_routes "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/routes/device.ts"
click node_other_routes "https://github.com/nazard2008/ideal-octo-rotary-phone/tree/main/backend/src/routes"
click node_socket_service "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/services/socket.ts"
click node_task_manager "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/services/tasks.ts"
click node_db_layer "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/db/index.ts"
click node_sqlite "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/db/schema.ts"
click node_android_app "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/core/LiumaApp.java"
click node_main_service "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/service/MainService.java"
click node_protocol "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/core/Protocol.java"
click node_socket_client "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/core/network/SocketClient.java"
click node_command_router "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/core/network/SocketCommandRouter.java"
click node_device_features "https://github.com/nazard2008/ideal-octo-rotary-phone/tree/main/LIUMA/app/src/main/java/com/liuma/app/features"
click node_screen_capture "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/features/screen/ScreenCaptureService.kt"
click node_remote_control "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/features/screen/RemoteControlService.kt"
click node_hvnc "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/features/hvnc/HvncService.kt"
click node_location "https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/features/gps/LocationService.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_web_console,node_device_views,node_web_api,node_web_socket toneBlue
class node_backend,node_auth_routes,node_auth_middleware,node_device_routes,node_other_routes,node_socket_service,node_task_manager,node_db_layer,node_sqlite toneAmber
class node_android_app,node_main_service,node_protocol,node_socket_client,node_command_router toneMint
class node_device_features,node_screen_capture,node_remote_control,node_hvnc,node_location toneRose
class node_operator toneIndigo
```

## Components

### Operator console

- [Web console](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Device views](https://github.com/nazard2008/ideal-octo-rotary-phone/tree/main/frontend/src/pages/device): `frontend/src/pages/device`
- [API client](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [Socket client](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/frontend/src/services/socket.ts): `frontend/src/services/socket.ts`

### Backend services

- [HTTP server](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/index.ts): `backend/src/index.ts`
- [Authentication](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`
- [Auth middleware](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/middleware/auth.ts): `backend/src/middleware/auth.ts`
- [Device routes](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/routes/device.ts): `backend/src/routes/device.ts`
- [Management routes](https://github.com/nazard2008/ideal-octo-rotary-phone/tree/main/backend/src/routes): `backend/src/routes`
- [Socket service](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/services/socket.ts): `backend/src/services/socket.ts`
- [Task manager](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/services/tasks.ts): `backend/src/services/tasks.ts`
- [Database access](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/db/index.ts): `backend/src/db/index.ts`
- [SQLite data](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/backend/src/db/schema.ts): `backend/src/db/schema.ts`

### Android agent

- [Agent startup](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/core/LiumaApp.java): `LIUMA/app/src/main/java/com/liuma/app/core/LiumaApp.java`
- [Main service](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/service/MainService.java): `LIUMA/app/src/main/java/com/liuma/app/service/MainService.java`
- [Command protocol](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/core/Protocol.java): `LIUMA/app/src/main/java/com/liuma/app/core/Protocol.java`
- [Device socket](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/core/network/SocketClient.java): `LIUMA/app/src/main/java/com/liuma/app/core/network/SocketClient.java`
- [Command router](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/core/network/SocketCommandRouter.java): `LIUMA/app/src/main/java/com/liuma/app/core/network/SocketCommandRouter.java`

### Device capabilities

- [Device feature services](https://github.com/nazard2008/ideal-octo-rotary-phone/tree/main/LIUMA/app/src/main/java/com/liuma/app/features): `LIUMA/app/src/main/java/com/liuma/app/features`
- [Screen capture](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/features/screen/ScreenCaptureService.kt): `LIUMA/app/src/main/java/com/liuma/app/features/screen/ScreenCaptureService.kt`
- [Remote control](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/features/screen/RemoteControlService.kt): `LIUMA/app/src/main/java/com/liuma/app/features/screen/RemoteControlService.kt`
- [Virtual display](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/features/hvnc/HvncService.kt): `LIUMA/app/src/main/java/com/liuma/app/features/hvnc/HvncService.kt`
- [Location tracking](https://github.com/nazard2008/ideal-octo-rotary-phone/blob/main/LIUMA/app/src/main/java/com/liuma/app/features/gps/LocationService.kt): `LIUMA/app/src/main/java/com/liuma/app/features/gps/LocationService.kt`

### Other components

- **Operator**

## Connections

- Operator → Web console: uses
- Web console → Device views: presents
- Device views → API client: requests data
- Device views → Socket client: sends commands
- API client → HTTP server: HTTP requests
- Socket client → Socket service: socket events
- HTTP server → Authentication: registers (evidence: `backend/src/index.ts`)
- HTTP server → Device routes: registers (evidence: `backend/src/index.ts`)
- HTTP server → Management routes: registers (evidence: `backend/src/index.ts`)
- HTTP server → Socket service: initializes (evidence: `backend/src/index.ts`)
- HTTP server → Task manager: starts (evidence: `backend/src/index.ts`)
- Authentication → Auth middleware: gets user (evidence: `backend/src/routes/auth.ts`)
- Authentication → Database access: reads and writes (evidence: `backend/src/routes/auth.ts`)
- Auth middleware → Database access: checks session (evidence: `backend/src/middleware/auth.ts`)
- Database access → SQLite data: persists records (evidence: `backend/src/db/index.ts`)
- Agent startup → Main service: starts
- Main service → Device socket: uses connection (evidence: `LIUMA/app/src/main/java/com/liuma/app/service/MainService.java`)
- Main service → Command router: initializes (evidence: `LIUMA/app/src/main/java/com/liuma/app/service/MainService.java`)
- Device socket → Command router: initializes (evidence: `LIUMA/app/src/main/java/com/liuma/app/core/network/SocketClient.java`)
- Device socket → HTTP server: enrolls and connects
- Command router → Device feature services: dispatches commands
- Remote control → Screen capture: uses capture (evidence: `LIUMA/app/src/main/java/com/liuma/app/features/screen/RemoteControlService.kt`)
- Virtual display → Device feature services: provides capability (evidence: `LIUMA/app/src/main/java/com/liuma/app/features/hvnc/HvncService.kt`)
- Location tracking → Device feature services: provides capability (evidence: `LIUMA/app/src/main/java/com/liuma/app/features/gps/LocationService.kt`)
