# tcullum/govee-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/tcullum/govee-dashboard
- Repository: https://github.com/tcullum/govee-dashboard

## Overview

Govee Dashboard is a local-first Flask service with a static browser interface. A user opens the dashboard to view indoor sensor readings alongside local forecasts, alerts, pollen, and historical almanac comparisons; optional AI features provide insights and answer weather questions. The server gathers and caches data, while browser code presents overview and detail views. Security checks protect origin requests and can require Cloudflare Access assertions. The README documents additional capabilities beyond the sampled excerpts; those are represented without guessing at unsampled implementation details.

Main entry points: [`govee_server.py`](https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py) (Flask API), [`weather_questions.py`](https://github.com/tcullum/govee-dashboard/blob/main/weather_questions.py) (Almanac questions), [`weather_context.py`](https://github.com/tcullum/govee-dashboard/blob/main/weather_context.py) (Historical almanac), [`app.js`](https://github.com/tcullum/govee-dashboard/blob/main/app.js) (Dashboard UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Dashboard interface"]
  node_browser["Dashboard UI<br/>[app.js]"]
  node_offline["Offline shell<br/>[service-worker.js]"]
end

subgraph group_server["Application services"]
  node_server_app["Flask API<br/>[govee_server.py]"]
  node_sensor["Sensor readings<br/>[govee_server.py]"]
end

subgraph group_weather["Weather and almanac"]
  node_forecast["Local forecast<br/>[govee_server.py]"]
  node_weather_context["Historical almanac<br/>[weather_context.py]"]
  node_questions["Almanac questions"]
  node_insights["AI insights<br/>[govee_server.py]"]
end

subgraph group_security["Access and persistence"]
  node_access["Cloudflare assertion"]
  node_request_security["Origin checks"]
  node_storage[("Runtime persistence<br/>[runtime_storage.py]")]
end

node_user(("Dashboard user"))
node_openmeteo{{"Open-Meteo"}}
node_govee{{"Govee API"}}
node_nws{{"National Weather Service"}}
node_pollen{{"Google Pollen API"}}
node_ai_provider{{"AI provider"}}

node_user -->|"uses"| node_browser
node_browser -->|"requests data"| node_server_app
node_offline -->|"caches shell"| node_browser
node_server_app -->|"serves readings"| node_sensor
node_sensor -->|"fetches readings"| node_govee
node_server_app -->|"serves forecast"| node_forecast
node_forecast -->|"fetches forecast"| node_openmeteo
node_server_app -->|"gets almanac"| node_weather_context
node_weather_context -->|"fetches history"| node_openmeteo
node_weather_context -->|"reads and writes"| node_storage
node_server_app -->|"registers questions"| node_questions
node_questions -->|"fetches weather"| node_openmeteo
node_questions -->|"generates answers"| node_ai_provider
node_questions -->|"uses cache"| node_storage
node_server_app -->|"generates insights"| node_insights
node_server_app -->|"registers protection"| node_access
node_server_app -->|"uses checks"| node_request_security
node_server_app -->|"uses persistence"| node_storage
node_server_app -.->|"provides alerts"| node_nws
node_server_app -.->|"provides pollen"| node_pollen
node_insights -.->|"generates insights"| node_ai_provider

click node_browser "https://github.com/tcullum/govee-dashboard/blob/main/app.js"
click node_offline "https://github.com/tcullum/govee-dashboard/blob/main/service-worker.js"
click node_server_app "https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py"
click node_sensor "https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py"
click node_forecast "https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py"
click node_weather_context "https://github.com/tcullum/govee-dashboard/blob/main/weather_context.py"
click node_questions "https://github.com/tcullum/govee-dashboard/blob/main/weather_questions.py"
click node_insights "https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py"
click node_access "https://github.com/tcullum/govee-dashboard/blob/main/cloudflare_access.py"
click node_request_security "https://github.com/tcullum/govee-dashboard/blob/main/request_security.py"
click node_storage "https://github.com/tcullum/govee-dashboard/blob/main/runtime_storage.py"

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_browser,node_offline,node_user toneBlue
class node_server_app,node_sensor toneAmber
class node_forecast,node_weather_context,node_questions,node_insights,node_govee,node_pollen toneMint
class node_access,node_request_security,node_storage toneRose
class node_openmeteo,node_nws,node_ai_provider toneIndigo
```

## Components

### Dashboard interface

- [Dashboard UI](https://github.com/tcullum/govee-dashboard/blob/main/app.js): `app.js`
- [Offline shell](https://github.com/tcullum/govee-dashboard/blob/main/service-worker.js): `service-worker.js`

### Application services

- [Flask API](https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py): `govee_server.py`
- [Sensor readings](https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py): `govee_server.py`

### Weather and almanac

- [Local forecast](https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py): `govee_server.py`
- [Historical almanac](https://github.com/tcullum/govee-dashboard/blob/main/weather_context.py): `weather_context.py`
- [Almanac questions](https://github.com/tcullum/govee-dashboard/blob/main/weather_questions.py): `weather_questions.py`
- [AI insights](https://github.com/tcullum/govee-dashboard/blob/main/govee_server.py): `govee_server.py`

### Access and persistence

- [Cloudflare assertion](https://github.com/tcullum/govee-dashboard/blob/main/cloudflare_access.py): `cloudflare_access.py`
- [Origin checks](https://github.com/tcullum/govee-dashboard/blob/main/request_security.py): `request_security.py`
- [Runtime persistence](https://github.com/tcullum/govee-dashboard/blob/main/runtime_storage.py): `runtime_storage.py`

### Other components

- **Dashboard user**
- **Open-Meteo**
- **Govee API**
- **National Weather Service**
- **Google Pollen API**
- **AI provider**

## Connections

- Dashboard user → Dashboard UI: uses (evidence: `README.md`)
- Dashboard UI → Flask API: requests data (evidence: `app.js`)
- Offline shell → Dashboard UI: caches shell (evidence: `service-worker.js`)
- Flask API → Sensor readings: serves readings (evidence: `govee_server.py`)
- Sensor readings → Govee API: fetches readings (evidence: `govee_server.py`)
- Flask API → Local forecast: serves forecast (evidence: `govee_server.py`)
- Local forecast → Open-Meteo: fetches forecast (evidence: `govee_server.py`)
- Flask API → Historical almanac: gets almanac (evidence: `govee_server.py`)
- Historical almanac → Open-Meteo: fetches history (evidence: `weather_context.py`)
- Historical almanac → Runtime persistence: reads and writes (evidence: `weather_context.py`)
- Flask API → Almanac questions: registers questions (evidence: `govee_server.py`)
- Almanac questions → Open-Meteo: fetches weather (evidence: `weather_questions.py`)
- Almanac questions → AI provider: generates answers (evidence: `weather_questions.py`)
- Almanac questions → Runtime persistence: uses cache (evidence: `weather_questions.py`)
- Flask API → AI insights: generates insights (evidence: `govee_server.py`)
- Flask API → Cloudflare assertion: registers protection (evidence: `govee_server.py`)
- Flask API → Origin checks: uses checks (evidence: `govee_server.py`)
- Flask API → Runtime persistence: uses persistence (evidence: `govee_server.py`)
- Flask API → National Weather Service: provides alerts (evidence: `README.md`)
- Flask API → Google Pollen API: provides pollen (evidence: `README.md`)
- AI insights → AI provider: generates insights
