# dokiriii/pc_contoller architecture

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

- Interactive diagram: https://gitdiagram.com/dokiriii/pc_contoller
- Repository: https://github.com/dokiriii/pc_contoller

## Overview

This repository pairs a Flutter client (its Dart application sources are not present in the supplied tree) with a Python remote-input server. The visible server workflow accepts TCP commands with responses and UDP commands without acknowledgements, parses JSON, routes by command type, and executes keyboard, text, mouse, or system actions. Server startup coordinates both transports; platform-native mouse input is abstracted for Linux and Windows. Client-to-server product behavior is evident only from server-side protocol comments, so client runtime links are not inferred.

Main entry points: [`server/core/command_handler.py`](https://github.com/dokiriii/pc_contoller/blob/main/server/core/command_handler.py) (Command handlers), [`server/server/server.py`](https://github.com/dokiriii/pc_contoller/blob/main/server/server/server.py) (Server lifecycle), [`server/server/tcp_worker.py`](https://github.com/dokiriii/pc_contoller/blob/main/server/server/tcp_worker.py) (TCP worker), [`server/server/udp_worker.py`](https://github.com/dokiriii/pc_contoller/blob/main/server/server/udp_worker.py) (UDP worker)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_transport["Server transport"]
  node_entry["Server entry<br/>[main.py]"]
  node_server["Server lifecycle<br/>[server.py]"]
  node_tcp["TCP connection<br/>[tcp_connection.py]"]
  node_tcpworker["TCP worker<br/>[tcp_worker.py]"]
  node_udp["UDP connection<br/>[udp_connection.py]"]
  node_udpworker["UDP worker<br/>[udp_worker.py]"]
end

subgraph group_commands["Command processing"]
  node_protocol["JSON protocol<br/>[protocol.py]"]
  node_router["Command router<br/>[router.py]"]
  node_handler["Command handlers<br/>[command_handler.py]"]
  node_result["Command result<br/>[command_result.py]"]
end

subgraph group_input["Input execution"]
  node_keyboard["Keyboard actions<br/>[keyboard.py]"]
  node_text["Text actions<br/>[text.py]"]
  node_mouse["Mouse actions<br/>[mouse.py]"]
  node_mouseapi["Mouse platform API<br/>[mouse_input.py]"]
  node_linuxmouse["Linux mouse input"]
  node_winmouse["Windows mouse input"]
  node_systemcmd["System commands<br/>[system.py]"]
end

subgraph group_client["Flutter client shells"]
  node_flutter["Flutter client"]
  node_linuxshell["Linux app shell<br/>[my_application.cc]"]
  node_windowsshell["Windows app shell<br/>[main.cpp]"]
  node_macshell["macOS app shell<br/>[AppDelegate.swift]"]
  node_iosshell["iOS app shell<br/>[AppDelegate.swift]"]
end

node_user(("Remote user"))

node_user -.->|"uses"| node_flutter
node_entry -->|"starts"| node_server
node_server -->|"creates"| node_tcp
node_server -->|"starts"| node_udp
node_server -->|"dispatches"| node_tcpworker
node_server -->|"starts"| node_udpworker
node_tcpworker -->|"receives commands"| node_tcp
node_tcpworker -->|"parses"| node_protocol
node_tcpworker -->|"routes"| node_router
node_tcpworker -->|"sends response"| node_tcp
node_udpworker -->|"receives packets"| node_udp
node_udpworker -->|"parses"| node_protocol
node_udpworker -->|"routes"| node_router
node_router -->|"dispatches"| node_handler
node_handler -->|"dispatches"| node_keyboard
node_handler -->|"dispatches"| node_text
node_handler -->|"dispatches"| node_mouse
node_handler -->|"dispatches"| node_systemcmd
node_handler -->|"returns"| node_result
node_router -->|"returns"| node_result
node_mouse -->|"calls"| node_mouseapi
node_mouseapi -->|"selects platform"| node_linuxmouse
node_mouseapi -->|"selects platform"| node_winmouse
node_linuxshell -.->|"hosts"| node_flutter
node_windowsshell -.->|"hosts"| node_flutter
node_macshell -.->|"hosts"| node_flutter
node_iosshell -.->|"hosts"| node_flutter

click node_entry "https://github.com/dokiriii/pc_contoller/blob/main/server/main.py"
click node_server "https://github.com/dokiriii/pc_contoller/blob/main/server/server/server.py"
click node_tcp "https://github.com/dokiriii/pc_contoller/blob/main/server/server/tcp_connection.py"
click node_tcpworker "https://github.com/dokiriii/pc_contoller/blob/main/server/server/tcp_worker.py"
click node_udp "https://github.com/dokiriii/pc_contoller/blob/main/server/server/udp_connection.py"
click node_udpworker "https://github.com/dokiriii/pc_contoller/blob/main/server/server/udp_worker.py"
click node_protocol "https://github.com/dokiriii/pc_contoller/blob/main/server/server/protocol.py"
click node_router "https://github.com/dokiriii/pc_contoller/blob/main/server/server/router.py"
click node_handler "https://github.com/dokiriii/pc_contoller/blob/main/server/core/command_handler.py"
click node_result "https://github.com/dokiriii/pc_contoller/blob/main/server/core/command_result.py"
click node_keyboard "https://github.com/dokiriii/pc_contoller/blob/main/server/commands/keyboard.py"
click node_text "https://github.com/dokiriii/pc_contoller/blob/main/server/commands/text.py"
click node_mouse "https://github.com/dokiriii/pc_contoller/blob/main/server/commands/mouse.py"
click node_mouseapi "https://github.com/dokiriii/pc_contoller/blob/main/server/input/mouse_input.py"
click node_linuxmouse "https://github.com/dokiriii/pc_contoller/blob/main/server/input/mouse_input_linux.py"
click node_winmouse "https://github.com/dokiriii/pc_contoller/blob/main/server/input/mouse_input_windows.py"
click node_systemcmd "https://github.com/dokiriii/pc_contoller/blob/main/server/commands/system.py"
click node_linuxshell "https://github.com/dokiriii/pc_contoller/blob/main/client/linux/runner/my_application.cc"
click node_windowsshell "https://github.com/dokiriii/pc_contoller/blob/main/client/windows/runner/main.cpp"
click node_macshell "https://github.com/dokiriii/pc_contoller/blob/main/client/macos/Runner/AppDelegate.swift"
click node_iosshell "https://github.com/dokiriii/pc_contoller/blob/main/client/ios/Runner/AppDelegate.swift"

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_entry,node_server,node_tcp,node_tcpworker,node_udp,node_udpworker,node_user toneBlue
class node_protocol,node_router,node_handler,node_result toneAmber
class node_keyboard,node_text,node_mouse,node_mouseapi,node_linuxmouse,node_winmouse,node_systemcmd toneMint
class node_flutter,node_linuxshell,node_windowsshell,node_macshell,node_iosshell toneRose
```

## Components

### Server transport

- [Server entry](https://github.com/dokiriii/pc_contoller/blob/main/server/main.py): `server/main.py`
- [Server lifecycle](https://github.com/dokiriii/pc_contoller/blob/main/server/server/server.py): `server/server/server.py`
- [TCP connection](https://github.com/dokiriii/pc_contoller/blob/main/server/server/tcp_connection.py): `server/server/tcp_connection.py`
- [TCP worker](https://github.com/dokiriii/pc_contoller/blob/main/server/server/tcp_worker.py): `server/server/tcp_worker.py`
- [UDP connection](https://github.com/dokiriii/pc_contoller/blob/main/server/server/udp_connection.py): `server/server/udp_connection.py`
- [UDP worker](https://github.com/dokiriii/pc_contoller/blob/main/server/server/udp_worker.py): `server/server/udp_worker.py`

### Command processing

- [JSON protocol](https://github.com/dokiriii/pc_contoller/blob/main/server/server/protocol.py): `server/server/protocol.py`
- [Command router](https://github.com/dokiriii/pc_contoller/blob/main/server/server/router.py): `server/server/router.py`
- [Command handlers](https://github.com/dokiriii/pc_contoller/blob/main/server/core/command_handler.py): `server/core/command_handler.py`
- [Command result](https://github.com/dokiriii/pc_contoller/blob/main/server/core/command_result.py): `server/core/command_result.py`

### Input execution

- [Keyboard actions](https://github.com/dokiriii/pc_contoller/blob/main/server/commands/keyboard.py): `server/commands/keyboard.py`
- [Text actions](https://github.com/dokiriii/pc_contoller/blob/main/server/commands/text.py): `server/commands/text.py`
- [Mouse actions](https://github.com/dokiriii/pc_contoller/blob/main/server/commands/mouse.py): `server/commands/mouse.py`
- [Mouse platform API](https://github.com/dokiriii/pc_contoller/blob/main/server/input/mouse_input.py): `server/input/mouse_input.py`
- [Linux mouse input](https://github.com/dokiriii/pc_contoller/blob/main/server/input/mouse_input_linux.py): `server/input/mouse_input_linux.py`
- [Windows mouse input](https://github.com/dokiriii/pc_contoller/blob/main/server/input/mouse_input_windows.py): `server/input/mouse_input_windows.py`
- [System commands](https://github.com/dokiriii/pc_contoller/blob/main/server/commands/system.py): `server/commands/system.py`

### Flutter client shells

- **Flutter client**
- [Linux app shell](https://github.com/dokiriii/pc_contoller/blob/main/client/linux/runner/my_application.cc): `client/linux/runner/my_application.cc`
- [Windows app shell](https://github.com/dokiriii/pc_contoller/blob/main/client/windows/runner/main.cpp): `client/windows/runner/main.cpp`
- [macOS app shell](https://github.com/dokiriii/pc_contoller/blob/main/client/macos/Runner/AppDelegate.swift): `client/macos/Runner/AppDelegate.swift`
- [iOS app shell](https://github.com/dokiriii/pc_contoller/blob/main/client/ios/Runner/AppDelegate.swift): `client/ios/Runner/AppDelegate.swift`

### Other components

- **Remote user**

## Connections

- Remote user → Flutter client: uses
- Server entry → Server lifecycle: starts (evidence: `server/main.py`)
- Server lifecycle → TCP connection: creates (evidence: `server/server/server.py`)
- Server lifecycle → UDP connection: starts (evidence: `server/server/server.py`)
- Server lifecycle → TCP worker: dispatches (evidence: `server/server/server.py`)
- Server lifecycle → UDP worker: starts (evidence: `server/server/server.py`)
- TCP worker → TCP connection: receives commands (evidence: `server/server/tcp_worker.py`)
- TCP worker → JSON protocol: parses (evidence: `server/server/tcp_worker.py`)
- TCP worker → Command router: routes (evidence: `server/server/tcp_worker.py`)
- TCP worker → TCP connection: sends response (evidence: `server/server/tcp_worker.py`)
- UDP worker → UDP connection: receives packets (evidence: `server/server/udp_worker.py`)
- UDP worker → JSON protocol: parses (evidence: `server/server/udp_worker.py`)
- UDP worker → Command router: routes (evidence: `server/server/udp_worker.py`)
- Command router → Command handlers: dispatches (evidence: `server/server/router.py`)
- Command handlers → Keyboard actions: dispatches (evidence: `server/core/command_handler.py`)
- Command handlers → Text actions: dispatches (evidence: `server/core/command_handler.py`)
- Command handlers → Mouse actions: dispatches (evidence: `server/core/command_handler.py`)
- Command handlers → System commands: dispatches (evidence: `server/core/command_handler.py`)
- Command handlers → Command result: returns (evidence: `server/core/command_handler.py`)
- Command router → Command result: returns (evidence: `server/server/router.py`)
- Mouse actions → Mouse platform API: calls (evidence: `server/commands/mouse.py`)
- Mouse platform API → Linux mouse input: selects platform (evidence: `server/input/mouse_input.py`)
- Mouse platform API → Windows mouse input: selects platform (evidence: `server/input/mouse_input.py`)
- Linux app shell → Flutter client: hosts
- Windows app shell → Flutter client: hosts
- macOS app shell → Flutter client: hosts
- iOS app shell → Flutter client: hosts
