# ramessesn/cherry-utility-web architecture

> Architecture diagram of the GitHub repository ramessesn/cherry-utility-web, 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/ramessesn/cherry-utility-web
- Repository: https://github.com/ramessesn/cherry-utility-web

## Overview

CHERRY Utility for Mac is a browser-based keyboard controller with direct WebHID or a Safari hidapi bridge. The documented workflow is user action in the UI → keyboard transport → configuration/profile/lighting commands → device response reflected in the UI. The sampled server.py confirms bridge endpoints, HID I/O, event streaming, static hosting and battery lookup; web implementation details were not sampled, so UI links follow README documentation and are dashed where implementation is unverified.

Main entry points: [`web/index.html`](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html) (Control UI), [`server.py`](https://github.com/ramessesn/cherry-utility-web/blob/main/server.py) (HTTP service), [`bin/cherry`](https://github.com/ramessesn/cherry-utility-web/blob/main/bin/cherry) (CLI launcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser Utility"]
  node_webui["Control UI<br/>[index.html]"]
  node_webhid["WebHID transport<br/>[index.html]"]
end

subgraph group_service["Local Service"]
  node_server["HTTP service<br/>[server.py]"]
  node_bridge["HID bridge<br/>[server.py]"]
  node_battery["Bluetooth battery<br/>[server.py]"]
  node_log[("Protocol logs<br/>[server.py]")]
  node_cherry["CLI launcher"]
end

subgraph group_device["Keyboard I/O"]
  node_hid["hidapi"]
  node_keyboard["CHERRY keyboard"]
end

subgraph group_features["Keyboard Features"]
  node_lighting["Lighting controls<br/>[index.html]"]
  node_perkey["Per-key lighting<br/>[index.html]"]
  node_profiles["Hardware profiles<br/>[index.html]"]
  node_presets["Lighting presets<br/>[index.html]"]
  node_settings["UI settings<br/>[index.html]"]
  node_protocol["Protocol debug<br/>[index.html]"]
  node_keymap["Key map<br/>[index.html]"]
  node_feedback["Device feedback<br/>[index.html]"]
  node_clock["Time sync<br/>[index.html]"]
end

node_user(("Keyboard user"))

node_user -.->|"controls"| node_webui
node_webui -.->|"configures"| node_lighting
node_webui -.->|"paints"| node_perkey
node_webui -.->|"switches"| node_profiles
node_webui -.->|"stores"| node_presets
node_webui -.->|"selects"| node_settings
node_webui -.->|"probes"| node_protocol
node_lighting -.->|"sends commands"| node_webhid
node_perkey -.->|"sends LED data"| node_webhid
node_profiles -.->|"reads and writes"| node_webhid
node_webui -.->|"requests bridge"| node_server
node_webhid -.->|"communicates"| node_keyboard
node_server -->|"routes HID requests"| node_bridge
node_server -->|"serves battery"| node_battery
node_bridge -->|"opens and reads"| node_hid
node_bridge -->|"sends reports"| node_keyboard
node_keyboard -->|"streams reports"| node_bridge
node_bridge -->|"publishes events"| node_server
node_server -->|"serves page"| node_webui
node_webui -.->|"renders mapping"| node_keymap
node_webui -.->|"shows responses"| node_feedback
node_webui -.->|"sets device time"| node_clock
node_clock -.->|"writes time"| node_keyboard
node_battery -.->|"reports charge"| node_webui
node_webui -->|"posts logs"| node_server
node_server -->|"writes logs"| node_log
node_user -->|"starts service"| node_cherry
node_cherry -.->|"launches"| node_server

click node_webui "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_lighting "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_perkey "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_profiles "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_presets "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_settings "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_protocol "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_webhid "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_server "https://github.com/ramessesn/cherry-utility-web/blob/main/server.py"
click node_bridge "https://github.com/ramessesn/cherry-utility-web/blob/main/server.py"
click node_battery "https://github.com/ramessesn/cherry-utility-web/blob/main/server.py"
click node_keymap "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_feedback "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_clock "https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html"
click node_log "https://github.com/ramessesn/cherry-utility-web/blob/main/server.py"
click node_cherry "https://github.com/ramessesn/cherry-utility-web/blob/main/bin/cherry"

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_webui,node_webhid,node_user toneBlue
class node_server,node_bridge,node_battery,node_log,node_cherry toneAmber
class node_hid,node_keyboard toneMint
class node_lighting,node_perkey,node_profiles,node_presets,node_settings,node_protocol,node_keymap,node_feedback,node_clock toneRose
```

## Components

### Browser Utility

- [Control UI](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [WebHID transport](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`

### Local Service

- [HTTP service](https://github.com/ramessesn/cherry-utility-web/blob/main/server.py): `server.py`
- [HID bridge](https://github.com/ramessesn/cherry-utility-web/blob/main/server.py): `server.py`
- [Bluetooth battery](https://github.com/ramessesn/cherry-utility-web/blob/main/server.py): `server.py`
- [Protocol logs](https://github.com/ramessesn/cherry-utility-web/blob/main/server.py): `server.py`
- [CLI launcher](https://github.com/ramessesn/cherry-utility-web/blob/main/bin/cherry): `bin/cherry`

### Keyboard I/O

- **hidapi**
- **CHERRY keyboard**

### Keyboard Features

- [Lighting controls](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [Per-key lighting](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [Hardware profiles](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [Lighting presets](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [UI settings](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [Protocol debug](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [Key map](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [Device feedback](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`
- [Time sync](https://github.com/ramessesn/cherry-utility-web/blob/main/web/index.html): `web/index.html`

### Other components

- **Keyboard user**

## Connections

- Keyboard user → Control UI: controls (evidence: `README.md`)
- Control UI → Lighting controls: configures (evidence: `README.md`)
- Control UI → Per-key lighting: paints (evidence: `README.md`)
- Control UI → Hardware profiles: switches (evidence: `README.md`)
- Control UI → Lighting presets: stores (evidence: `README.md`)
- Control UI → UI settings: selects (evidence: `README.md`)
- Control UI → Protocol debug: probes (evidence: `README.md`)
- Lighting controls → WebHID transport: sends commands (evidence: `README.md`)
- Per-key lighting → WebHID transport: sends LED data (evidence: `README.md`)
- Hardware profiles → WebHID transport: reads and writes (evidence: `README.md`)
- Control UI → HTTP service: requests bridge (evidence: `README.md`)
- WebHID transport → CHERRY keyboard: communicates (evidence: `README.md`)
- HTTP service → HID bridge: routes HID requests (evidence: `server.py`)
- HTTP service → Bluetooth battery: serves battery (evidence: `server.py`)
- HID bridge → hidapi: opens and reads (evidence: `server.py`)
- HID bridge → CHERRY keyboard: sends reports (evidence: `server.py`)
- CHERRY keyboard → HID bridge: streams reports (evidence: `server.py`)
- HID bridge → HTTP service: publishes events (evidence: `server.py`)
- HTTP service → Control UI: serves page (evidence: `server.py`)
- Control UI → Key map: renders mapping (evidence: `README.md`)
- Control UI → Device feedback: shows responses (evidence: `README.md`)
- Control UI → Time sync: sets device time (evidence: `README.md`)
- Time sync → CHERRY keyboard: writes time (evidence: `README.md`)
- Bluetooth battery → Control UI: reports charge (evidence: `README.md`)
- Control UI → HTTP service: posts logs (evidence: `server.py`)
- HTTP service → Protocol logs: writes logs (evidence: `server.py`)
- Keyboard user → CLI launcher: starts service (evidence: `README.md`)
- CLI launcher → HTTP service: launches (evidence: `README.md`)
