# jake-herrera/weather-station-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/jake-herrera/weather-station-dashboard
- Repository: https://github.com/jake-herrera/weather-station-dashboard

## Overview

Weather Station Dashboard is a React interface for viewing live ESP32/BME280 readings stored in Firebase. Users select a time window; the dashboard fetches that device’s readings, calculates metric summaries, downsamples chart data for longer windows, and renders metric cards and trend charts alongside device metadata and a live clock. The graph follows the documented and excerpted runtime wiring. Some UI and service implementations were not excerpted, so their relationships are included only where the source index or README supports them.

Main entry points: [`src/App.tsx`](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/App.tsx) (Dashboard orchestration), [`src/types/reading.ts`](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/types/reading.ts) (Reading and range types), [`src/hooks/useReadings.ts`](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/hooks/useReadings.ts) (Live readings query), [`src/lib/firebase.ts`](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/lib/firebase.ts) (Firebase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Dashboard UI"]
  node_app["Dashboard orchestration<br/>[App.tsx]"]
end

subgraph group_data["Firebase Data"]
  node_readings_hook["Live readings query<br/>[useReadings.ts]"]
  node_device_meta_hook["Device metadata query<br/>[useDeviceMeta.ts]"]
  node_firebase_client["Firebase client<br/>[firebase.ts]"]
  node_firebase_db[("Realtime Database")]
end

subgraph group_processing["Reading Processing"]
  node_compute_stats["Metric statistics<br/>[compute-stats.ts]"]
  node_downsample["Chart downsampling"]
  node_format_chart["Chart formatting"]
  node_filter_readings["Reading filtering<br/>[filter-readings.ts]"]
end

subgraph group_presentation["Display Components"]
  node_range_filter["Range selector<br/>[RangeFilter.tsx]"]
  node_metric_card["Metric cards<br/>[MetricCard.tsx]"]
  node_trend_chart["Trend charts<br/>[TrendChart.tsx]"]
  node_dashboard_skeleton["Loading skeleton"]
  node_device_meta_view["Device metadata panel<br/>[DeviceMeta.tsx]"]
  node_real_timer["Real-time clock<br/>[RealTimer.tsx]"]
end

subgraph group_config["Domain Configuration"]
  node_range_config["Time range definitions<br/>[ranges.ts]"]
  node_metric_config["Chart metric definitions<br/>[metrics.ts]"]
  node_metric_types["Metric definitions<br/>[metrics.ts]"]
  node_chart_types["Chart metadata types<br/>[metricChart.ts]"]
  node_reading_types["Reading and range types<br/>[reading.ts]"]
end

node_user(("Dashboard user"))
node_esp32(("ESP32 weather station"))

node_user -->|"views dashboard"| node_app
node_esp32 -->|"writes readings"| node_firebase_db
node_app -->|"requests readings"| node_readings_hook
node_readings_hook -->|"queries client"| node_firebase_client
node_firebase_client -->|"initializes connection"| node_firebase_db
node_readings_hook -->|"uses range window"| node_range_config
node_range_filter -->|"uses range options"| node_range_config
node_app -->|"renders selector"| node_range_filter
node_app -->|"computes summaries"| node_compute_stats
node_app -->|"reduces chart readings"| node_downsample
node_app -->|"renders summaries"| node_metric_card
node_app -->|"renders chart series"| node_trend_chart
node_app -->|"supplies chart metadata"| node_metric_config
node_app -->|"shows while loading"| node_dashboard_skeleton
node_app -->|"renders device panel"| node_device_meta_view
node_app -->|"renders clock"| node_real_timer
node_device_meta_view -->|"uses metadata query"| node_device_meta_hook
node_device_meta_hook -->|"fetches through client"| node_firebase_client
node_trend_chart -->|"formats readings"| node_format_chart
node_metric_card -->|"uses statistics"| node_compute_stats
node_metric_config -->|"defines chart metadata"| node_chart_types
node_chart_types -->|"uses metric keys"| node_metric_types
node_metric_types -->|"derives metric keys"| node_reading_types
node_range_config -->|"uses time range type"| node_reading_types
node_compute_stats -->|"accepts readings"| node_reading_types
node_downsample -->|"accepts readings"| node_reading_types
node_format_chart -->|"formats readings"| node_reading_types

click node_app "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/App.tsx"
click node_range_filter "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/RangeFilter.tsx"
click node_metric_card "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/MetricCard.tsx"
click node_trend_chart "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/TrendChart.tsx"
click node_dashboard_skeleton "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/DashboardSkeleton.tsx"
click node_device_meta_view "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/DeviceMeta.tsx"
click node_real_timer "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/RealTimer.tsx"
click node_readings_hook "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/hooks/useReadings.ts"
click node_device_meta_hook "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/hooks/useDeviceMeta.ts"
click node_firebase_client "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/lib/firebase.ts"
click node_compute_stats "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/services/compute-stats.ts"
click node_downsample "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/services/downsample-readings.ts"
click node_format_chart "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/services/format-chart-data.ts"
click node_filter_readings "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/services/filter-readings.ts"
click node_range_config "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/constants/ranges.ts"
click node_metric_config "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/constants/metrics.ts"
click node_metric_types "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/types/metrics.ts"
click node_chart_types "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/types/metricChart.ts"
click node_reading_types "https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/types/reading.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_user toneBlue
class node_readings_hook,node_device_meta_hook,node_firebase_client,node_firebase_db toneAmber
class node_compute_stats,node_downsample,node_format_chart,node_filter_readings toneMint
class node_range_filter,node_metric_card,node_trend_chart,node_dashboard_skeleton,node_device_meta_view,node_real_timer toneRose
class node_range_config,node_metric_config,node_metric_types,node_chart_types,node_reading_types,node_esp32 toneIndigo
```

## Components

### Dashboard UI

- [Dashboard orchestration](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/App.tsx): `src/App.tsx`

### Firebase Data

- [Live readings query](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/hooks/useReadings.ts): `src/hooks/useReadings.ts`
- [Device metadata query](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/hooks/useDeviceMeta.ts): `src/hooks/useDeviceMeta.ts`
- [Firebase client](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- **Realtime Database**

### Reading Processing

- [Metric statistics](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/services/compute-stats.ts): `src/services/compute-stats.ts`
- [Chart downsampling](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/services/downsample-readings.ts): `src/services/downsample-readings.ts`
- [Chart formatting](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/services/format-chart-data.ts): `src/services/format-chart-data.ts`
- [Reading filtering](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/services/filter-readings.ts): `src/services/filter-readings.ts`

### Display Components

- [Range selector](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/RangeFilter.tsx): `src/components/features/RangeFilter.tsx`
- [Metric cards](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/MetricCard.tsx): `src/components/features/MetricCard.tsx`
- [Trend charts](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/TrendChart.tsx): `src/components/features/TrendChart.tsx`
- [Loading skeleton](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/DashboardSkeleton.tsx): `src/components/features/DashboardSkeleton.tsx`
- [Device metadata panel](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/DeviceMeta.tsx): `src/components/features/DeviceMeta.tsx`
- [Real-time clock](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/components/features/RealTimer.tsx): `src/components/features/RealTimer.tsx`

### Domain Configuration

- [Time range definitions](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/constants/ranges.ts): `src/constants/ranges.ts`
- [Chart metric definitions](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/constants/metrics.ts): `src/constants/metrics.ts`
- [Metric definitions](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/types/metrics.ts): `src/types/metrics.ts`
- [Chart metadata types](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/types/metricChart.ts): `src/types/metricChart.ts`
- [Reading and range types](https://github.com/jake-herrera/weather-station-dashboard/blob/main/src/types/reading.ts): `src/types/reading.ts`

### Other components

- **Dashboard user**
- **ESP32 weather station**

## Connections

- Dashboard user → Dashboard orchestration: views dashboard (evidence: `README.md`)
- ESP32 weather station → Realtime Database: writes readings (evidence: `README.md`)
- Dashboard orchestration → Live readings query: requests readings (evidence: `src/App.tsx`)
- Live readings query → Firebase client: queries client (evidence: `src/hooks/useReadings.ts`)
- Firebase client → Realtime Database: initializes connection (evidence: `src/lib/firebase.ts`)
- Live readings query → Time range definitions: uses range window (evidence: `src/hooks/useReadings.ts`)
- Range selector → Time range definitions: uses range options (evidence: `src/components/features/RangeFilter.tsx`)
- Dashboard orchestration → Range selector: renders selector (evidence: `src/App.tsx`)
- Dashboard orchestration → Metric statistics: computes summaries (evidence: `src/App.tsx`)
- Dashboard orchestration → Chart downsampling: reduces chart readings (evidence: `src/App.tsx`)
- Dashboard orchestration → Metric cards: renders summaries (evidence: `src/App.tsx`)
- Dashboard orchestration → Trend charts: renders chart series (evidence: `src/App.tsx`)
- Dashboard orchestration → Chart metric definitions: supplies chart metadata (evidence: `src/App.tsx`)
- Dashboard orchestration → Loading skeleton: shows while loading (evidence: `src/App.tsx`)
- Dashboard orchestration → Device metadata panel: renders device panel (evidence: `src/App.tsx`)
- Dashboard orchestration → Real-time clock: renders clock (evidence: `src/App.tsx`)
- Device metadata panel → Device metadata query: uses metadata query (evidence: `src/components/features/DeviceMeta.tsx`)
- Device metadata query → Firebase client: fetches through client (evidence: `src/hooks/useDeviceMeta.ts`)
- Trend charts → Chart formatting: formats readings (evidence: `src/components/features/TrendChart.tsx`)
- Metric cards → Metric statistics: uses statistics (evidence: `src/components/features/MetricCard.tsx`)
- Chart metric definitions → Chart metadata types: defines chart metadata (evidence: `src/constants/metrics.ts`)
- Chart metadata types → Metric definitions: uses metric keys (evidence: `src/types/metricChart.ts`)
- Metric definitions → Reading and range types: derives metric keys (evidence: `src/types/metrics.ts`)
- Time range definitions → Reading and range types: uses time range type (evidence: `src/constants/ranges.ts`)
- Metric statistics → Reading and range types: accepts readings (evidence: `src/services/compute-stats.ts`)
- Chart downsampling → Reading and range types: accepts readings (evidence: `src/services/downsample-readings.ts`)
- Chart formatting → Reading and range types: formats readings (evidence: `src/services/format-chart-data.ts`)
