# chiotas/lightkeeper architecture

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

- Interactive diagram: https://gitdiagram.com/chiotas/lightkeeper
- Repository: https://github.com/chiotas/lightkeeper

## Overview

Lightkeeper replaces the LG TV Home screen with a configurable launcher. A user edits tiles and appearance from a phone or computer; the settings service saves changes, and the TV Home displays them and launches apps, inputs, or web pages. The product also supports weather, optional Home Assistant data and light controls, custom backgrounds and logos, open-app management, updates, and remote-key/startup integration. Some links reflect README-documented behavior; unsampled implementation details are not inferred.

Main entry points: [`app/index.html`](https://github.com/chiotas/lightkeeper/blob/main/app/index.html) (Home screen), [`app/service/server.js`](https://github.com/chiotas/lightkeeper/blob/main/app/service/server.js) (Settings service), [`app/service/lightkeeper-init`](https://github.com/chiotas/lightkeeper/blob/main/app/service/lightkeeper-init) (Startup hook), [`app/service/settings.html`](https://github.com/chiotas/lightkeeper/blob/main/app/service/settings.html) (Settings page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tv["TV experience"]
  node_home["Home screen<br/>[index.html]"]
end

subgraph group_config["Settings and state"]
  node_settings["Settings page<br/>[settings.html]"]
  node_server["Settings service<br/>[server.js]"]
  node_state[("Saved settings<br/>[server.js]")]
end

subgraph group_integrations["TV integrations"]
  node_startup["Startup hook"]
  node_glasshouse["GlassHouse"]
  node_webos["webOS apps and inputs"]
  node_weather["Weather service"]
  node_ha["Home Assistant"]
end

subgraph group_assets["Visual assets"]
  node_logos["Logo catalogue<br/>[logos.js]"]
  node_backgrounds["Background presets<br/>[index.json]"]
end

node_person(("Viewer"))
node_admin(("Settings user"))
node_network(("Local browser"))

node_person -->|"opens Home"| node_home
node_home -->|"reads config"| node_server
node_server -.->|"saves settings"| node_state
node_admin -->|"edits settings"| node_network
node_network -->|"opens page"| node_settings
node_settings -->|"updates settings"| node_server
node_home -.->|"uses icons"| node_logos
node_server -->|"loads catalogue"| node_logos
node_home -.->|"shows presets"| node_backgrounds
node_home -->|"launches tiles"| node_webos
node_startup -->|"starts service"| node_server
node_startup -->|"sets key filter"| node_glasshouse
node_home -->|"gets forecast"| node_weather
node_server -->|"reads entities"| node_ha
node_home -->|"switches lights"| node_ha

click node_home "https://github.com/chiotas/lightkeeper/blob/main/app/index.html"
click node_logos "https://github.com/chiotas/lightkeeper/blob/main/app/logos.js"
click node_backgrounds "https://github.com/chiotas/lightkeeper/blob/main/app/backgrounds/index.json"
click node_settings "https://github.com/chiotas/lightkeeper/blob/main/app/service/settings.html"
click node_server "https://github.com/chiotas/lightkeeper/blob/main/app/service/server.js"
click node_state "https://github.com/chiotas/lightkeeper/blob/main/app/service/server.js"
click node_startup "https://github.com/chiotas/lightkeeper/blob/main/app/service/lightkeeper-init"

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_home,node_person,node_admin,node_network toneBlue
class node_settings,node_server,node_state toneAmber
class node_startup,node_glasshouse,node_webos,node_weather,node_ha toneMint
class node_logos,node_backgrounds toneRose
```

## Components

### TV experience

- [Home screen](https://github.com/chiotas/lightkeeper/blob/main/app/index.html): `app/index.html`

### Settings and state

- [Settings page](https://github.com/chiotas/lightkeeper/blob/main/app/service/settings.html): `app/service/settings.html`
- [Settings service](https://github.com/chiotas/lightkeeper/blob/main/app/service/server.js): `app/service/server.js`
- [Saved settings](https://github.com/chiotas/lightkeeper/blob/main/app/service/server.js): `app/service/server.js`

### TV integrations

- [Startup hook](https://github.com/chiotas/lightkeeper/blob/main/app/service/lightkeeper-init): `app/service/lightkeeper-init`
- **GlassHouse**
- **webOS apps and inputs**
- **Weather service**
- **Home Assistant**

### Visual assets

- [Logo catalogue](https://github.com/chiotas/lightkeeper/blob/main/app/logos.js): `app/logos.js`
- [Background presets](https://github.com/chiotas/lightkeeper/blob/main/app/backgrounds/index.json): `app/backgrounds/index.json`

### Other components

- **Viewer**
- **Settings user**
- **Local browser**

## Connections

- Viewer → Home screen: opens Home (evidence: `README.md`)
- Home screen → Settings service: reads config (evidence: `README.md`)
- Settings service → Saved settings: saves settings (evidence: `app/service/server.js`)
- Settings user → Local browser: edits settings (evidence: `README.md`)
- Local browser → Settings page: opens page (evidence: `README.md`)
- Settings page → Settings service: updates settings (evidence: `README.md`)
- Home screen → Logo catalogue: uses icons
- Settings service → Logo catalogue: loads catalogue (evidence: `app/service/server.js`)
- Home screen → Background presets: shows presets
- Home screen → webOS apps and inputs: launches tiles (evidence: `README.md`)
- Startup hook → Settings service: starts service (evidence: `app/service/server.js`)
- Startup hook → GlassHouse: sets key filter (evidence: `README.md`)
- Home screen → Weather service: gets forecast (evidence: `README.md`)
- Settings service → Home Assistant: reads entities (evidence: `README.md`)
- Home screen → Home Assistant: switches lights (evidence: `README.md`)
