# tenmeneat/techno architecture

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

- Interactive diagram: https://gitdiagram.com/tenmeneat/techno
- Repository: https://github.com/tenmeneat/techno

## Overview

This is a room-level condensation and mould-risk monitoring product: sensor telemetry is ingested, calibrated and evaluated into risk states and forecasts, then exposed through APIs and a live dashboard. Separate branches provide outdoor-weather enrichment, daily insulation/exposure diagnostics, reports and push notifications. The README documents these capabilities; unsampled routes and UI internals are represented at their exact directories where appropriate. Edges are limited to relationships shown in excerpts, the source index, or README; links from app startup to workers/routes follow the documented wiring.

Main entry points: [`backend/app/main.py`](https://github.com/tenmeneat/techno/blob/main/backend/app/main.py) (API application), [`backend/app/mqtt/ingest.py`](https://github.com/tenmeneat/techno/blob/main/backend/app/mqtt/ingest.py) (Telemetry pipeline), [`backend/app/db/pool.py`](https://github.com/tenmeneat/techno/blob/main/backend/app/db/pool.py) (Database pool), [`backend/app/api/v1/devices.py`](https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/devices.py) (Device API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Telemetry ingestion"]
  node_ingest["Telemetry pipeline<br/>[ingest.py]"]
  node_simulator["Scenario publisher<br/>[simulator.py]"]
end

subgraph group_analysis["Risk analysis"]
  node_psychrometrics["Psychrometrics<br/>[psychrometrics.py]"]
  node_risk["Risk state machine<br/>[risk_state.py]"]
  node_forecast["Risk forecast<br/>[forecast.py]"]
end

subgraph group_service["API and persistence"]
  node_pool["Database pool<br/>[pool.py]"]
  node_schema[("Time-series schema<br/>[schema.sql]")]
  node_main["API application<br/>[main.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_device_api["Device API<br/>[devices.py]"]
  node_reading_api["Readings API<br/>[readings.py]"]
  node_event_api["Events API<br/>[events.py]"]
  node_report_api["Reports API<br/>[reports.py]"]
  node_push_api["Push API<br/>[push.py]"]
  node_ws["Live WebSocket<br/>[ws.py]"]
  node_schemas["API contracts<br/>[schemas.py]"]
end

subgraph group_insights["Diagnostics and alerts"]
  node_weather["Weather sync<br/>[weather_sync.py]"]
  node_diagnostics["Daily diagnostics<br/>[diagnostics.py]"]
  node_notifier["Push notifier<br/>[notifier.py]"]
end

subgraph group_experience["Dashboard experience"]
  node_frontend_api["Frontend API client<br/>[api.ts]"]
  node_live_client["Live cache client<br/>[live.ts]"]
  node_dashboard["Dashboard screens"]
  node_risk_chart["Risk chart<br/>[RiskChart.tsx]"]
  node_notifications["PWA notifications<br/>[notifications.ts]"]
end

node_sensor(("ESP32 sensors"))
node_mqtt["MQTT broker"]
node_weather_service["KMA / Open-Meteo"]
node_push_service["Web Push service"]
node_user(("Resident"))

node_sensor -->|"publishes telemetry"| node_mqtt
node_mqtt -->|"delivers messages"| node_ingest
node_simulator -->|"publishes scenarios"| node_mqtt
node_ingest -->|"calculates readings"| node_psychrometrics
node_ingest -->|"updates state"| node_risk
node_ingest -->|"estimates risk"| node_forecast
node_ingest -->|"stores readings"| node_pool
node_ingest -->|"broadcasts updates"| node_ws
node_ingest -->|"notifies risk"| node_notifier
node_pool -.->|"uses schema"| node_schema
node_main -->|"opens connection"| node_pool
node_main -->|"starts workers"| node_ingest
node_main -->|"starts worker"| node_weather
node_main -->|"starts worker"| node_diagnostics
node_main -->|"registers routes"| node_device_api
node_main -->|"registers routes"| node_reading_api
node_main -->|"registers routes"| node_event_api
node_main -->|"registers routes"| node_report_api
node_main -->|"registers routes"| node_push_api
node_main -->|"registers route"| node_ws
node_main -->|"configures service"| node_config
node_device_api -->|"queries devices"| node_pool
node_device_api -->|"reads runtime state"| node_ingest
node_device_api -->|"computes threshold"| node_psychrometrics
node_reading_api -->|"queries readings"| node_pool
node_reading_api -->|"computes metrics"| node_psychrometrics
node_event_api -->|"queries events"| node_pool
node_report_api -->|"queries report data"| node_pool
node_report_api -->|"loads device"| node_device_api
node_weather -->|"fetches observations"| node_weather_service
node_weather -->|"stores weather"| node_pool
node_diagnostics -->|"reads and stores"| node_pool
node_diagnostics -->|"calculates insulation"| node_psychrometrics
node_notifier -->|"sends notifications"| node_push_service
node_push_api -->|"stores subscriptions"| node_pool
node_frontend_api -->|"requests API"| node_main
node_live_client -->|"uses API contract"| node_frontend_api
node_live_client -->|"opens live stream"| node_ws
node_dashboard -->|"loads product data"| node_frontend_api
node_dashboard -->|"renders risk chart"| node_risk_chart
node_dashboard -->|"refreshes live data"| node_live_client
node_notifications -->|"subscribes device"| node_push_api
node_user -->|"views dashboard"| node_dashboard

click node_ingest "https://github.com/tenmeneat/techno/blob/main/backend/app/mqtt/ingest.py"
click node_simulator "https://github.com/tenmeneat/techno/blob/main/backend/tools/simulator.py"
click node_psychrometrics "https://github.com/tenmeneat/techno/blob/main/backend/app/domain/psychrometrics.py"
click node_risk "https://github.com/tenmeneat/techno/blob/main/backend/app/domain/risk_state.py"
click node_forecast "https://github.com/tenmeneat/techno/blob/main/backend/app/domain/forecast.py"
click node_pool "https://github.com/tenmeneat/techno/blob/main/backend/app/db/pool.py"
click node_schema "https://github.com/tenmeneat/techno/blob/main/backend/app/db/schema.sql"
click node_main "https://github.com/tenmeneat/techno/blob/main/backend/app/main.py"
click node_config "https://github.com/tenmeneat/techno/blob/main/backend/app/core/config.py"
click node_device_api "https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/devices.py"
click node_reading_api "https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/readings.py"
click node_event_api "https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/events.py"
click node_report_api "https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/reports.py"
click node_push_api "https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/push.py"
click node_ws "https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/ws.py"
click node_schemas "https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/schemas.py"
click node_weather "https://github.com/tenmeneat/techno/blob/main/backend/app/workers/weather_sync.py"
click node_diagnostics "https://github.com/tenmeneat/techno/blob/main/backend/app/workers/diagnostics.py"
click node_notifier "https://github.com/tenmeneat/techno/blob/main/backend/app/workers/notifier.py"
click node_frontend_api "https://github.com/tenmeneat/techno/blob/main/frontend/src/lib/api.ts"
click node_live_client "https://github.com/tenmeneat/techno/blob/main/frontend/src/lib/live.ts"
click node_dashboard "https://github.com/tenmeneat/techno/tree/main/frontend/src/app"
click node_risk_chart "https://github.com/tenmeneat/techno/blob/main/frontend/src/components/RiskChart.tsx"
click node_notifications "https://github.com/tenmeneat/techno/blob/main/frontend/src/lib/notifications.ts"

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_ingest,node_simulator toneBlue
class node_psychrometrics,node_risk,node_forecast toneAmber
class node_pool,node_schema,node_main,node_config,node_device_api,node_reading_api,node_event_api,node_report_api,node_push_api,node_ws,node_schemas toneMint
class node_weather,node_diagnostics,node_notifier toneRose
class node_frontend_api,node_live_client,node_dashboard,node_risk_chart,node_notifications,node_sensor,node_mqtt,node_weather_service,node_push_service,node_user toneIndigo
```

## Components

### Telemetry ingestion

- [Telemetry pipeline](https://github.com/tenmeneat/techno/blob/main/backend/app/mqtt/ingest.py): `backend/app/mqtt/ingest.py`
- [Scenario publisher](https://github.com/tenmeneat/techno/blob/main/backend/tools/simulator.py): `backend/tools/simulator.py`

### Risk analysis

- [Psychrometrics](https://github.com/tenmeneat/techno/blob/main/backend/app/domain/psychrometrics.py): `backend/app/domain/psychrometrics.py`
- [Risk state machine](https://github.com/tenmeneat/techno/blob/main/backend/app/domain/risk_state.py): `backend/app/domain/risk_state.py`
- [Risk forecast](https://github.com/tenmeneat/techno/blob/main/backend/app/domain/forecast.py): `backend/app/domain/forecast.py`

### API and persistence

- [Database pool](https://github.com/tenmeneat/techno/blob/main/backend/app/db/pool.py): `backend/app/db/pool.py`
- [Time-series schema](https://github.com/tenmeneat/techno/blob/main/backend/app/db/schema.sql): `backend/app/db/schema.sql`
- [API application](https://github.com/tenmeneat/techno/blob/main/backend/app/main.py): `backend/app/main.py`
- [Runtime configuration](https://github.com/tenmeneat/techno/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [Device API](https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/devices.py): `backend/app/api/v1/devices.py`
- [Readings API](https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/readings.py): `backend/app/api/v1/readings.py`
- [Events API](https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/events.py): `backend/app/api/v1/events.py`
- [Reports API](https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/reports.py): `backend/app/api/v1/reports.py`
- [Push API](https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/push.py): `backend/app/api/v1/push.py`
- [Live WebSocket](https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/ws.py): `backend/app/api/v1/ws.py`
- [API contracts](https://github.com/tenmeneat/techno/blob/main/backend/app/api/v1/schemas.py): `backend/app/api/v1/schemas.py`

### Diagnostics and alerts

- [Weather sync](https://github.com/tenmeneat/techno/blob/main/backend/app/workers/weather_sync.py): `backend/app/workers/weather_sync.py`
- [Daily diagnostics](https://github.com/tenmeneat/techno/blob/main/backend/app/workers/diagnostics.py): `backend/app/workers/diagnostics.py`
- [Push notifier](https://github.com/tenmeneat/techno/blob/main/backend/app/workers/notifier.py): `backend/app/workers/notifier.py`

### Dashboard experience

- [Frontend API client](https://github.com/tenmeneat/techno/blob/main/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`
- [Live cache client](https://github.com/tenmeneat/techno/blob/main/frontend/src/lib/live.ts): `frontend/src/lib/live.ts`
- [Dashboard screens](https://github.com/tenmeneat/techno/tree/main/frontend/src/app): `frontend/src/app`
- [Risk chart](https://github.com/tenmeneat/techno/blob/main/frontend/src/components/RiskChart.tsx): `frontend/src/components/RiskChart.tsx`
- [PWA notifications](https://github.com/tenmeneat/techno/blob/main/frontend/src/lib/notifications.ts): `frontend/src/lib/notifications.ts`

### Other components

- **ESP32 sensors**
- **MQTT broker**
- **KMA / Open-Meteo**
- **Web Push service**
- **Resident**

## Connections

- ESP32 sensors → MQTT broker: publishes telemetry (evidence: `README.md`)
- MQTT broker → Telemetry pipeline: delivers messages (evidence: `README.md`)
- Scenario publisher → MQTT broker: publishes scenarios (evidence: `README.md`)
- Telemetry pipeline → Psychrometrics: calculates readings (evidence: `backend/app/mqtt/ingest.py`)
- Telemetry pipeline → Risk state machine: updates state (evidence: `backend/app/mqtt/ingest.py`)
- Telemetry pipeline → Risk forecast: estimates risk (evidence: `backend/app/mqtt/ingest.py`)
- Telemetry pipeline → Database pool: stores readings (evidence: `backend/app/mqtt/ingest.py`)
- Telemetry pipeline → Live WebSocket: broadcasts updates (evidence: `backend/app/mqtt/ingest.py`)
- Telemetry pipeline → Push notifier: notifies risk (evidence: `backend/app/mqtt/ingest.py`)
- Database pool → Time-series schema: uses schema
- API application → Database pool: opens connection (evidence: `backend/app/main.py`)
- API application → Telemetry pipeline: starts workers (evidence: `backend/app/main.py`)
- API application → Weather sync: starts worker (evidence: `backend/app/main.py`)
- API application → Daily diagnostics: starts worker (evidence: `backend/app/main.py`)
- API application → Device API: registers routes (evidence: `backend/app/main.py`)
- API application → Readings API: registers routes (evidence: `backend/app/main.py`)
- API application → Events API: registers routes (evidence: `backend/app/main.py`)
- API application → Reports API: registers routes (evidence: `backend/app/main.py`)
- API application → Push API: registers routes (evidence: `backend/app/main.py`)
- API application → Live WebSocket: registers route (evidence: `backend/app/main.py`)
- API application → Runtime configuration: configures service (evidence: `backend/app/main.py`)
- Device API → Database pool: queries devices (evidence: `backend/app/api/v1/devices.py`)
- Device API → Telemetry pipeline: reads runtime state (evidence: `backend/app/api/v1/devices.py`)
- Device API → Psychrometrics: computes threshold (evidence: `backend/app/api/v1/devices.py`)
- Readings API → Database pool: queries readings (evidence: `backend/app/api/v1/readings.py`)
- Readings API → Psychrometrics: computes metrics (evidence: `backend/app/api/v1/readings.py`)
- Events API → Database pool: queries events (evidence: `backend/app/api/v1/events.py`)
- Reports API → Database pool: queries report data (evidence: `backend/app/api/v1/reports.py`)
- Reports API → Device API: loads device (evidence: `backend/app/api/v1/reports.py`)
- Weather sync → KMA / Open-Meteo: fetches observations (evidence: `backend/app/workers/weather_sync.py`)
- Weather sync → Database pool: stores weather (evidence: `backend/app/workers/weather_sync.py`)
- Daily diagnostics → Database pool: reads and stores (evidence: `backend/app/workers/diagnostics.py`)
- Daily diagnostics → Psychrometrics: calculates insulation (evidence: `backend/app/workers/diagnostics.py`)
- Push notifier → Web Push service: sends notifications (evidence: `README.md`)
- Push API → Database pool: stores subscriptions (evidence: `backend/app/api/v1/push.py`)
- Frontend API client → API application: requests API (evidence: `README.md`)
- Live cache client → Frontend API client: uses API contract (evidence: `frontend/src/lib/live.ts`)
- Live cache client → Live WebSocket: opens live stream (evidence: `README.md`)
- Dashboard screens → Frontend API client: loads product data (evidence: `README.md`)
- Dashboard screens → Risk chart: renders risk chart (evidence: `README.md`)
- Dashboard screens → Live cache client: refreshes live data (evidence: `README.md`)
- PWA notifications → Push API: subscribes device (evidence: `README.md`)
- Resident → Dashboard screens: views dashboard (evidence: `README.md`)
