# prmgr-org/prmgr-observatory-starter architecture

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

- Interactive diagram: https://gitdiagram.com/prmgr-org/prmgr-observatory-starter
- Repository: https://github.com/prmgr-org/prmgr-observatory-starter

## Overview

PRMGR Observatory Starter is a local-first home-energy dashboard with an optional file-based recorder. A user views synthetic readings or imports JSON in the browser; the dashboard validates and presents energy, heating, and historical measurements, with JSON export. For recording, an external adapter supplies a local JSON file, the collector appends new timestamped samples to history, and the dashboard can request a snapshot from the local server. The sampled code supports these links; other README-described capabilities are retained as dashboard responsibilities without implying separate unsampled implementations.

Main entry points: [`public/app.js`](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/public/app.js) (Dashboard views and controls), [`history.mjs`](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/history.mjs) (History persistence), [`server.mjs`](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/server.mjs) (Local web and history server), [`collector.mjs`](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/collector.mjs) (History collector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Browser dashboard"]
  node_dashboard_app["Dashboard views and controls<br/>[app.js]"]
  node_personalization["Labels and artwork settings<br/>[config.js]"]
end

subgraph group_domain["Reading model"]
  node_reading_model["Validation and reading logic<br/>[model.js]"]
end

subgraph group_recording["Local recording"]
  node_collector["History collector<br/>[collector.mjs]"]
  node_history_logic["History persistence<br/>[history.mjs]"]
  node_local_server["Local web and history server<br/>[server.mjs]"]
  node_history_store[("Recorded history file")]
end

node_user(("Home observer"))
node_adapter["Adapter-produced file"]

node_user -->|"views and imports"| node_dashboard_app
node_dashboard_app -->|"validates and displays"| node_reading_model
node_dashboard_app -->|"reads settings"| node_personalization
node_dashboard_app -->|"requests snapshot"| node_local_server
node_local_server -->|"serves app files"| node_dashboard_app
node_adapter -->|"provides JSON input"| node_collector
node_collector -->|"records samples"| node_history_logic
node_history_logic -->|"validates readings"| node_reading_model
node_history_logic -->|"reads and writes"| node_history_store
node_local_server -->|"loads history"| node_history_logic

click node_dashboard_app "https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/public/app.js"
click node_personalization "https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/public/config.js"
click node_reading_model "https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/public/model.js"
click node_collector "https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/collector.mjs"
click node_history_logic "https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/history.mjs"
click node_local_server "https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/server.mjs"

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_dashboard_app,node_personalization toneBlue
class node_reading_model toneAmber
class node_collector,node_history_logic,node_local_server,node_history_store,node_user toneMint
class node_adapter toneIndigo
```

## Components

### Browser dashboard

- [Dashboard views and controls](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/public/app.js): `public/app.js`
- [Labels and artwork settings](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/public/config.js): `public/config.js`

### Reading model

- [Validation and reading logic](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/public/model.js): `public/model.js`

### Local recording

- [History collector](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/collector.mjs): `collector.mjs`
- [History persistence](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/history.mjs): `history.mjs`
- [Local web and history server](https://github.com/prmgr-org/prmgr-observatory-starter/blob/main/server.mjs): `server.mjs`
- **Recorded history file**

### Other components

- **Home observer**
- **Adapter-produced file**

## Connections

- Home observer → Dashboard views and controls: views and imports (evidence: `README.md`)
- Dashboard views and controls → Validation and reading logic: validates and displays (evidence: `public/app.js`)
- Dashboard views and controls → Labels and artwork settings: reads settings (evidence: `public/app.js`)
- Dashboard views and controls → Local web and history server: requests snapshot (evidence: `public/app.js`)
- Local web and history server → Dashboard views and controls: serves app files (evidence: `server.mjs`)
- Adapter-produced file → History collector: provides JSON input (evidence: `README.md`)
- History collector → History persistence: records samples (evidence: `collector.mjs`)
- History persistence → Validation and reading logic: validates readings (evidence: `history.mjs`)
- History persistence → Recorded history file: reads and writes (evidence: `history.mjs`)
- Local web and history server → History persistence: loads history (evidence: `server.mjs`)
