# mvinkarklins/lampa architecture

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

- Interactive diagram: https://gitdiagram.com/mvinkarklins/lampa
- Repository: https://github.com/mvinkarklins/lampa

## Overview

This repository provides five Lampa client plugins plus a profile-sync service. The user workflow begins when a viewer uses an added Lampa control or feature: browse age-filtered picks, search torrents, choose LG audio tracks, or use the redesigned interface. Profiles add per-profile settings and viewing data synchronized with a self-hosted server, which can also report viewing statistics. Client source is sampled only in excerpts; unsampled plugin details are represented only where README capabilities support them.

Main entry points: [`sync/server.js`](https://github.com/mvinkarklins/lampa/blob/main/sync/server.js) (Sync HTTP API), [`kids_age.js`](https://github.com/mvinkarklins/lampa/blob/main/kids_age.js) (Kids picks), [`lg_tracks.js`](https://github.com/mvinkarklins/lampa/blob/main/lg_tracks.js) (LG track picker), [`torrent_button.js`](https://github.com/mvinkarklins/lampa/blob/main/torrent_button.js) (Torrent search button)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Lampa plugins"]
  node_kids["Kids picks<br/>[kids_age.js]"]
  node_neo["Neo interface<br/>[neo.js]"]
  node_tracks["LG track picker<br/>[lg_tracks.js]"]
  node_torrent["Torrent search button<br/>[torrent_button.js]"]
  node_profiles["Profiles plugin<br/>[profiles.js]"]
  node_localdata[("Device profile data<br/>[profiles.js]")]
end

subgraph group_sync["Profile sync service"]
  node_syncserver["Sync HTTP API<br/>[server.js]"]
end

subgraph group_state["Sync storage and stats"]
  node_jsonfiles[("JSON data files<br/>[server.js]")]
  node_stats["Viewing statistics<br/>[stats.js]"]
end

node_viewer(("Viewer"))
node_lampa["Lampa app"]
node_tmdb["TMDB catalog"]
node_webos["LG media service"]
node_parser["Configured parser"]
node_jacred["Public JacRed"]

node_viewer -->|"uses"| node_lampa
node_lampa -->|"opens picks"| node_kids
node_kids -->|"queries catalog"| node_tmdb
node_kids -->|"opens results"| node_lampa
node_lampa -->|"loads interface"| node_neo
node_lampa -->|"opens picker"| node_tracks
node_tracks -->|"requests tracks"| node_webos
node_tracks -->|"shows choices"| node_lampa
node_lampa -->|"adds card control"| node_torrent
node_torrent -->|"searches releases"| node_parser
node_torrent -->|"searches optionally"| node_jacred
node_lampa -->|"loads plugin"| node_profiles
node_profiles -->|"syncs profile state"| node_localdata
node_profiles -->|"calls sync API"| node_syncserver
node_syncserver -->|"reads and writes"| node_jsonfiles
node_syncserver -->|"computes stats"| node_stats
node_stats -->|"returns summary"| node_syncserver

click node_kids "https://github.com/mvinkarklins/lampa/blob/main/kids_age.js"
click node_neo "https://github.com/mvinkarklins/lampa/blob/main/neo.js"
click node_tracks "https://github.com/mvinkarklins/lampa/blob/main/lg_tracks.js"
click node_torrent "https://github.com/mvinkarklins/lampa/blob/main/torrent_button.js"
click node_profiles "https://github.com/mvinkarklins/lampa/blob/main/profiles.js"
click node_localdata "https://github.com/mvinkarklins/lampa/blob/main/profiles.js"
click node_syncserver "https://github.com/mvinkarklins/lampa/blob/main/sync/server.js"
click node_jsonfiles "https://github.com/mvinkarklins/lampa/blob/main/sync/server.js"
click node_stats "https://github.com/mvinkarklins/lampa/blob/main/sync/stats.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_kids,node_neo,node_tracks,node_torrent,node_profiles,node_localdata,node_viewer toneBlue
class node_syncserver toneAmber
class node_jsonfiles,node_stats toneMint
class node_lampa,node_tmdb,node_webos,node_parser,node_jacred toneIndigo
```

## Components

### Lampa plugins

- [Kids picks](https://github.com/mvinkarklins/lampa/blob/main/kids_age.js): `kids_age.js`
- [Neo interface](https://github.com/mvinkarklins/lampa/blob/main/neo.js): `neo.js`
- [LG track picker](https://github.com/mvinkarklins/lampa/blob/main/lg_tracks.js): `lg_tracks.js`
- [Torrent search button](https://github.com/mvinkarklins/lampa/blob/main/torrent_button.js): `torrent_button.js`
- [Profiles plugin](https://github.com/mvinkarklins/lampa/blob/main/profiles.js): `profiles.js`
- [Device profile data](https://github.com/mvinkarklins/lampa/blob/main/profiles.js): `profiles.js`

### Profile sync service

- [Sync HTTP API](https://github.com/mvinkarklins/lampa/blob/main/sync/server.js): `sync/server.js`

### Sync storage and stats

- [JSON data files](https://github.com/mvinkarklins/lampa/blob/main/sync/server.js): `sync/server.js`
- [Viewing statistics](https://github.com/mvinkarklins/lampa/blob/main/sync/stats.js): `sync/stats.js`

### Other components

- **Viewer**
- **Lampa app**
- **TMDB catalog**
- **LG media service**
- **Configured parser**
- **Public JacRed**

## Connections

- Viewer → Lampa app: uses (evidence: `README.md`)
- Lampa app → Kids picks: opens picks (evidence: `kids_age.js`)
- Kids picks → TMDB catalog: queries catalog (evidence: `kids_age.js`)
- Kids picks → Lampa app: opens results (evidence: `kids_age.js`)
- Lampa app → Neo interface: loads interface (evidence: `neo.js`)
- Lampa app → LG track picker: opens picker (evidence: `lg_tracks.js`)
- LG track picker → LG media service: requests tracks (evidence: `lg_tracks.js`)
- LG track picker → Lampa app: shows choices (evidence: `lg_tracks.js`)
- Lampa app → Torrent search button: adds card control (evidence: `torrent_button.js`)
- Torrent search button → Configured parser: searches releases (evidence: `torrent_button.js`)
- Torrent search button → Public JacRed: searches optionally (evidence: `torrent_button.js`)
- Lampa app → Profiles plugin: loads plugin (evidence: `README.md`)
- Profiles plugin → Device profile data: syncs profile state (evidence: `profiles.js`)
- Profiles plugin → Sync HTTP API: calls sync API (evidence: `profiles.js`)
- Sync HTTP API → JSON data files: reads and writes (evidence: `sync/server.js`)
- Sync HTTP API → Viewing statistics: computes stats (evidence: `sync/server.js`)
- Viewing statistics → Sync HTTP API: returns summary (evidence: `sync/server.js`)
