# leukipp/touchkio architecture

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

- Interactive diagram: https://gitdiagram.com/leukipp/touchkio
- Repository: https://github.com/leukipp/touchkio

## Overview

TouchKio is an Electron kiosk for displaying Home Assistant dashboards on Linux touch devices, with optional MQTT controls and sensors. The main workflow starts the app, configures its arguments, opens dashboard pages in a touch-oriented kiosk window, and optionally exposes device and kiosk state through MQTT. Hardware support covers display, audio, system, and network capabilities. The source excerpts show the principal modules and several calls; some UI asset wiring and MQTT command handling are not visible, so those links are omitted or marked unverified.

Main entry points: [`js/webview.js`](https://github.com/leukipp/touchkio/blob/main/js/webview.js) (Kiosk webviews), [`index.js`](https://github.com/leukipp/touchkio/blob/main/index.js) (Electron app), [`js/integration.js`](https://github.com/leukipp/touchkio/blob/main/js/integration.js) (MQTT integration), [`js/hardware.js`](https://github.com/leukipp/touchkio/blob/main/js/hardware.js) (Linux hardware)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and configuration"]
  node_app["Electron app<br/>[index.js]"]
  node_arguments["Arguments and setup<br/>[index.js]"]
end

subgraph group_kiosk["Kiosk browsing"]
  node_webview["Kiosk webviews<br/>[webview.js]"]
  node_dashboard["Dashboard website"]
  node_header["Status header<br/>[header.html]"]
  node_navigation["Navigation bar<br/>[navigation.html]"]
  node_pager["Page controls<br/>[pager.html]"]
  node_widget["Control widget<br/>[widget.html]"]
end

subgraph group_device["Device capabilities"]
  node_hardware["Linux hardware<br/>[hardware.js]"]
end

subgraph group_mqtt["MQTT integration"]
  node_mqtt["MQTT integration<br/>[integration.js]"]
end

node_user(("Kiosk operator"))
node_broker(("MQTT broker"))
node_homeassistant(("Home Assistant"))

node_user -->|"launches"| node_app
node_app -->|"configures"| node_arguments
node_app -->|"loads"| node_webview
node_app -->|"loads"| node_hardware
node_app -->|"loads"| node_mqtt
node_webview -->|"loads pages"| node_dashboard
node_webview -.->|"uses UI"| node_header
node_webview -.->|"uses UI"| node_navigation
node_webview -.->|"uses UI"| node_pager
node_webview -.->|"uses UI"| node_widget
node_mqtt -->|"reads device state"| node_hardware
node_mqtt -->|"connects and publishes"| node_broker
node_broker -->|"exchanges data"| node_homeassistant
node_webview -.->|"reports kiosk state"| node_mqtt

click node_app "https://github.com/leukipp/touchkio/blob/main/index.js"
click node_arguments "https://github.com/leukipp/touchkio/blob/main/index.js"
click node_webview "https://github.com/leukipp/touchkio/blob/main/js/webview.js"
click node_header "https://github.com/leukipp/touchkio/blob/main/html/header.html"
click node_navigation "https://github.com/leukipp/touchkio/blob/main/html/navigation.html"
click node_pager "https://github.com/leukipp/touchkio/blob/main/html/pager.html"
click node_widget "https://github.com/leukipp/touchkio/blob/main/html/widget.html"
click node_hardware "https://github.com/leukipp/touchkio/blob/main/js/hardware.js"
click node_mqtt "https://github.com/leukipp/touchkio/blob/main/js/integration.js"

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_app,node_arguments toneBlue
class node_webview,node_dashboard,node_header,node_navigation,node_pager,node_widget toneAmber
class node_hardware toneMint
class node_mqtt toneRose
class node_user,node_broker,node_homeassistant toneIndigo
```

## Components

### Startup and configuration

- [Electron app](https://github.com/leukipp/touchkio/blob/main/index.js): `index.js`
- [Arguments and setup](https://github.com/leukipp/touchkio/blob/main/index.js): `index.js`

### Kiosk browsing

- [Kiosk webviews](https://github.com/leukipp/touchkio/blob/main/js/webview.js): `js/webview.js`
- **Dashboard website**
- [Status header](https://github.com/leukipp/touchkio/blob/main/html/header.html): `html/header.html`
- [Navigation bar](https://github.com/leukipp/touchkio/blob/main/html/navigation.html): `html/navigation.html`
- [Page controls](https://github.com/leukipp/touchkio/blob/main/html/pager.html): `html/pager.html`
- [Control widget](https://github.com/leukipp/touchkio/blob/main/html/widget.html): `html/widget.html`

### Device capabilities

- [Linux hardware](https://github.com/leukipp/touchkio/blob/main/js/hardware.js): `js/hardware.js`

### MQTT integration

- [MQTT integration](https://github.com/leukipp/touchkio/blob/main/js/integration.js): `js/integration.js`

### Other components

- **Kiosk operator**
- **MQTT broker**
- **Home Assistant**

## Connections

- Kiosk operator → Electron app: launches (evidence: `README.md`)
- Electron app → Arguments and setup: configures (evidence: `index.js`)
- Electron app → Kiosk webviews: loads (evidence: `index.js`)
- Electron app → Linux hardware: loads (evidence: `index.js`)
- Electron app → MQTT integration: loads (evidence: `index.js`)
- Kiosk webviews → Dashboard website: loads pages (evidence: `README.md`)
- Kiosk webviews → Status header: uses UI
- Kiosk webviews → Navigation bar: uses UI
- Kiosk webviews → Page controls: uses UI
- Kiosk webviews → Control widget: uses UI
- MQTT integration → Linux hardware: reads device state (evidence: `js/integration.js`)
- MQTT integration → MQTT broker: connects and publishes (evidence: `js/integration.js`)
- MQTT broker → Home Assistant: exchanges data (evidence: `README.md`)
- Kiosk webviews → MQTT integration: reports kiosk state (evidence: `js/webview.js`)
