# reitsoft/dahoam architecture

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

- Interactive diagram: https://gitdiagram.com/reitsoft/dahoam
- Repository: https://github.com/reitsoft/dahoam

## Overview

This repository implements a SvelteKit household dashboard, not the generic project scaffold described by its README. Its visible domains cover home sensors, energy use, shutters, weather, and school schedules and appointments. The clearest evidenced runtime paths are server loaders and API handlers; the excerpts show energy data lookups, MQTT shutter commands and event streams, appointment CRUD, and an external weather request. Many UI-to-store and route-to-component connections are not visible in the supplied excerpts, so those links are omitted rather than assumed.

Main entry points: [`src/lib/server/mqtt.ts`](https://github.com/reitsoft/dahoam/blob/main/src/lib/server/mqtt.ts) (MQTT state and client), [`src/routes/api/shutter/command/+server.ts`](https://github.com/reitsoft/dahoam/blob/main/src/routes/api/shutter/command/%2Bserver.ts) (Shutter command API), [`src/routes/+layout.svelte`](https://github.com/reitsoft/dahoam/blob/main/src/routes/%2Blayout.svelte) (Dashboard shell), [`src/lib/server/stromzaehler.index.ts`](https://github.com/reitsoft/dahoam/blob/main/src/lib/server/stromzaehler.index.ts) (Meter query interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Dashboard experience"]
  node_app["Dashboard shell<br/>[+layout.svelte]"]
  node_homeview["Home dashboard<br/>[+page.svelte]"]
  node_homecards["Home status cards"]
  node_nav["App navigation<br/>[AppNav.svelte]"]
end

subgraph group_energy["Energy monitoring"]
  node_energyview["Energy page<br/>[+page.svelte]"]
  node_energyload["Energy data loader<br/>[+page.server.ts]"]
  node_meter["Meter and usage queries<br/>[stromzaehler.ts]"]
  node_meterindex["Meter query interface"]
  node_energycards["Energy visualizations"]
end

subgraph group_home["Home automation"]
  node_shutterview["Shutter controls<br/>[+page.svelte]"]
  node_shutterapi["Shutter command API<br/>[+server.ts]"]
  node_shutterstream["Shutter event stream<br/>[+server.ts]"]
  node_mqtt["MQTT state and client<br/>[mqtt.ts]"]
  node_shutterconfig["Shutter configuration<br/>[shutters.ts]"]
  node_sensorstream["Sensor event stream<br/>[+server.ts]"]
end

subgraph group_information["Weather and school"]
  node_weatherpage["Weather page<br/>[+page.svelte]"]
  node_weatherapi["Weather API and forecasts<br/>[+server.ts]"]
  node_weathercards["Weather cards"]
  node_weatherstore["Weather data store<br/>[weather.svelte.ts]"]
  node_schoolpage["School schedule<br/>[+page.svelte]"]
  node_schoolcards["Schedule and events cards"]
  node_scheduleconfig["Schedule configuration<br/>[stundenplan.ts]"]
  node_appointmentsapi["Appointment API<br/>[+server.ts]"]
  node_appointmentitemapi["Appointment deletion API<br/>[+server.ts]"]
  node_appointments["Appointment service<br/>[termine.ts]"]
  node_appointmentsstore["Appointment client store<br/>[termine.svelte.ts]"]
end

node_resident(("Household user"))
node_broker(("MQTT broker and devices"))
node_weatherprovider(("Open-Meteo"))

node_resident -->|"opens"| node_app
node_energyload -->|"queries"| node_meterindex
node_meterindex -.->|"delegates"| node_meter
node_shutterapi -->|"publishes commands"| node_mqtt
node_shutterapi -->|"looks up device"| node_shutterconfig
node_shutterstream -->|"streams updates"| node_mqtt
node_sensorstream -->|"streams updates"| node_mqtt
node_mqtt -.->|"communicates"| node_broker
node_weatherapi -->|"fetches forecast"| node_weatherprovider
node_appointmentsapi -->|"reads and adds"| node_appointments
node_appointmentitemapi -->|"deletes"| node_appointments
node_weatherpage -.->|"uses data"| node_weatherstore
node_weatherstore -.->|"requests data"| node_weatherapi
node_schoolpage -.->|"renders"| node_schoolcards
node_energyview -.->|"renders"| node_energycards
node_app -->|"renders"| node_nav

click node_app "https://github.com/reitsoft/dahoam/blob/main/src/routes/%2Blayout.svelte"
click node_homeview "https://github.com/reitsoft/dahoam/blob/main/src/routes/%2Bpage.svelte"
click node_homecards "https://github.com/reitsoft/dahoam/tree/main/src/lib/components/home"
click node_nav "https://github.com/reitsoft/dahoam/blob/main/src/lib/components/AppNav.svelte"
click node_energyview "https://github.com/reitsoft/dahoam/blob/main/src/routes/energy/%2Bpage.svelte"
click node_energyload "https://github.com/reitsoft/dahoam/blob/main/src/routes/energy/%2Bpage.server.ts"
click node_meter "https://github.com/reitsoft/dahoam/blob/main/src/lib/server/stromzaehler.ts"
click node_meterindex "https://github.com/reitsoft/dahoam/blob/main/src/lib/server/stromzaehler.index.ts"
click node_energycards "https://github.com/reitsoft/dahoam/tree/main/src/lib/components/energy"
click node_shutterview "https://github.com/reitsoft/dahoam/blob/main/src/routes/shutters/%2Bpage.svelte"
click node_shutterapi "https://github.com/reitsoft/dahoam/blob/main/src/routes/api/shutter/command/%2Bserver.ts"
click node_shutterstream "https://github.com/reitsoft/dahoam/blob/main/src/routes/api/shutter/stream/%2Bserver.ts"
click node_mqtt "https://github.com/reitsoft/dahoam/blob/main/src/lib/server/mqtt.ts"
click node_shutterconfig "https://github.com/reitsoft/dahoam/blob/main/src/lib/config/shutters.ts"
click node_sensorstream "https://github.com/reitsoft/dahoam/blob/main/src/routes/api/sensor/stream/%2Bserver.ts"
click node_weatherpage "https://github.com/reitsoft/dahoam/blob/main/src/routes/weather/%2Bpage.svelte"
click node_weatherapi "https://github.com/reitsoft/dahoam/blob/main/src/routes/api/weather/%2Bserver.ts"
click node_weathercards "https://github.com/reitsoft/dahoam/tree/main/src/lib/components/weather"
click node_weatherstore "https://github.com/reitsoft/dahoam/blob/main/src/lib/stores/weather.svelte.ts"
click node_schoolpage "https://github.com/reitsoft/dahoam/blob/main/src/routes/school/%2Bpage.svelte"
click node_schoolcards "https://github.com/reitsoft/dahoam/tree/main/src/lib/components/school"
click node_scheduleconfig "https://github.com/reitsoft/dahoam/blob/main/src/lib/config/stundenplan.ts"
click node_appointmentsapi "https://github.com/reitsoft/dahoam/blob/main/src/routes/api/termine/%2Bserver.ts"
click node_appointmentitemapi "https://github.com/reitsoft/dahoam/blob/main/src/routes/api/termine/%5Bid%5D/%2Bserver.ts"
click node_appointments "https://github.com/reitsoft/dahoam/blob/main/src/lib/server/termine.ts"
click node_appointmentsstore "https://github.com/reitsoft/dahoam/blob/main/src/lib/stores/termine.svelte.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_app,node_homeview,node_homecards,node_nav,node_resident toneBlue
class node_energyview,node_energyload,node_meter,node_meterindex,node_energycards toneAmber
class node_shutterview,node_shutterapi,node_shutterstream,node_mqtt,node_shutterconfig,node_sensorstream toneMint
class node_weatherpage,node_weatherapi,node_weathercards,node_weatherstore,node_schoolpage,node_schoolcards,node_scheduleconfig,node_appointmentsapi,node_appointmentitemapi,node_appointments,node_appointmentsstore toneRose
class node_broker,node_weatherprovider toneIndigo
```

## Components

### Dashboard experience

- [Dashboard shell](https://github.com/reitsoft/dahoam/blob/main/src/routes/%2Blayout.svelte): `src/routes/+layout.svelte`
- [Home dashboard](https://github.com/reitsoft/dahoam/blob/main/src/routes/%2Bpage.svelte): `src/routes/+page.svelte`
- [Home status cards](https://github.com/reitsoft/dahoam/tree/main/src/lib/components/home): `src/lib/components/home`
- [App navigation](https://github.com/reitsoft/dahoam/blob/main/src/lib/components/AppNav.svelte): `src/lib/components/AppNav.svelte`

### Energy monitoring

- [Energy page](https://github.com/reitsoft/dahoam/blob/main/src/routes/energy/%2Bpage.svelte): `src/routes/energy/+page.svelte`
- [Energy data loader](https://github.com/reitsoft/dahoam/blob/main/src/routes/energy/%2Bpage.server.ts): `src/routes/energy/+page.server.ts`
- [Meter and usage queries](https://github.com/reitsoft/dahoam/blob/main/src/lib/server/stromzaehler.ts): `src/lib/server/stromzaehler.ts`
- [Meter query interface](https://github.com/reitsoft/dahoam/blob/main/src/lib/server/stromzaehler.index.ts): `src/lib/server/stromzaehler.index.ts`
- [Energy visualizations](https://github.com/reitsoft/dahoam/tree/main/src/lib/components/energy): `src/lib/components/energy`

### Home automation

- [Shutter controls](https://github.com/reitsoft/dahoam/blob/main/src/routes/shutters/%2Bpage.svelte): `src/routes/shutters/+page.svelte`
- [Shutter command API](https://github.com/reitsoft/dahoam/blob/main/src/routes/api/shutter/command/%2Bserver.ts): `src/routes/api/shutter/command/+server.ts`
- [Shutter event stream](https://github.com/reitsoft/dahoam/blob/main/src/routes/api/shutter/stream/%2Bserver.ts): `src/routes/api/shutter/stream/+server.ts`
- [MQTT state and client](https://github.com/reitsoft/dahoam/blob/main/src/lib/server/mqtt.ts): `src/lib/server/mqtt.ts`
- [Shutter configuration](https://github.com/reitsoft/dahoam/blob/main/src/lib/config/shutters.ts): `src/lib/config/shutters.ts`
- [Sensor event stream](https://github.com/reitsoft/dahoam/blob/main/src/routes/api/sensor/stream/%2Bserver.ts): `src/routes/api/sensor/stream/+server.ts`

### Weather and school

- [Weather page](https://github.com/reitsoft/dahoam/blob/main/src/routes/weather/%2Bpage.svelte): `src/routes/weather/+page.svelte`
- [Weather API and forecasts](https://github.com/reitsoft/dahoam/blob/main/src/routes/api/weather/%2Bserver.ts): `src/routes/api/weather/+server.ts`
- [Weather cards](https://github.com/reitsoft/dahoam/tree/main/src/lib/components/weather): `src/lib/components/weather`
- [Weather data store](https://github.com/reitsoft/dahoam/blob/main/src/lib/stores/weather.svelte.ts): `src/lib/stores/weather.svelte.ts`
- [School schedule](https://github.com/reitsoft/dahoam/blob/main/src/routes/school/%2Bpage.svelte): `src/routes/school/+page.svelte`
- [Schedule and events cards](https://github.com/reitsoft/dahoam/tree/main/src/lib/components/school): `src/lib/components/school`
- [Schedule configuration](https://github.com/reitsoft/dahoam/blob/main/src/lib/config/stundenplan.ts): `src/lib/config/stundenplan.ts`
- [Appointment API](https://github.com/reitsoft/dahoam/blob/main/src/routes/api/termine/%2Bserver.ts): `src/routes/api/termine/+server.ts`
- [Appointment deletion API](https://github.com/reitsoft/dahoam/blob/main/src/routes/api/termine/%5Bid%5D/%2Bserver.ts): `src/routes/api/termine/[id]/+server.ts`
- [Appointment service](https://github.com/reitsoft/dahoam/blob/main/src/lib/server/termine.ts): `src/lib/server/termine.ts`
- [Appointment client store](https://github.com/reitsoft/dahoam/blob/main/src/lib/stores/termine.svelte.ts): `src/lib/stores/termine.svelte.ts`

### Other components

- **Household user**
- **MQTT broker and devices**
- **Open-Meteo**

## Connections

- Household user → Dashboard shell: opens (evidence: `src/routes/+layout.svelte`)
- Energy data loader → Meter query interface: queries (evidence: `src/routes/energy/+page.server.ts`)
- Meter query interface → Meter and usage queries: delegates
- Shutter command API → MQTT state and client: publishes commands (evidence: `src/routes/api/shutter/command/+server.ts`)
- Shutter command API → Shutter configuration: looks up device (evidence: `src/routes/api/shutter/command/+server.ts`)
- Shutter event stream → MQTT state and client: streams updates (evidence: `src/routes/api/shutter/stream/+server.ts`)
- Sensor event stream → MQTT state and client: streams updates (evidence: `src/routes/api/sensor/stream/+server.ts`)
- MQTT state and client → MQTT broker and devices: communicates
- Weather API and forecasts → Open-Meteo: fetches forecast (evidence: `src/routes/api/weather/+server.ts`)
- Appointment API → Appointment service: reads and adds (evidence: `src/routes/api/termine/+server.ts`)
- Appointment deletion API → Appointment service: deletes (evidence: `src/routes/api/termine/[id]/+server.ts`)
- Weather page → Weather data store: uses data
- Weather data store → Weather API and forecasts: requests data
- School schedule → Schedule and events cards: renders
- Energy page → Energy visualizations: renders
- Dashboard shell → App navigation: renders (evidence: `src/routes/+layout.svelte`)
