# phongsathonja-john/smart-building-dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/phongsathonja-john/smart-building-dashboard
- Repository: https://github.com/phongsathonja-john/smart-building-dashboard

## Overview

This is a React smart-building dashboard for viewing building energy and equipment status and controlling AHUs. The main dashboard maintains simulated energy and AHU readings; the equipment workflow initializes mock equipment, filters and summarizes it, opens a detail view, and applies mock control commands. A separate realtime service can generate equipment updates, but the sampled code does not show it wired into the UI. The README describes only the Vite template, so product capabilities are inferred from sampled source; unsampled API modules are not mapped.

Main entry points: [`src/components/EquipmentPage.tsx`](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/components/EquipmentPage.tsx) (Equipment Overview), [`src/models/equipment.ts`](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/models/equipment.ts) (Equipment Model), [`src/components/EquipmentDetail.tsx`](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/components/EquipmentDetail.tsx) (Equipment Detail), [`src/hooks/useEquipment.ts`](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/hooks/useEquipment.ts) (Equipment State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dashboard["Building Dashboard"]
  node_browser_entry["React Mount<br/>[main.tsx]"]
  node_building_dashboard["Energy Dashboard<br/>[App.tsx]"]
end

subgraph group_equipment["Equipment Monitoring"]
  node_equipment_page["Equipment Overview<br/>[EquipmentPage.tsx]"]
  node_equipment_detail["Equipment Detail"]
  node_equipment_card["Equipment Card<br/>[EquipmentCard.tsx]"]
  node_equipment_state["Equipment State<br/>[useEquipment.ts]"]
  node_mock_equipment["Sample Equipment<br/>[mockEquipment.ts]"]
  node_equipment_model["Equipment Model<br/>[equipment.ts]"]
end

subgraph group_services["Control And Realtime"]
  node_control_service["AHU Commands<br/>[controlService.ts]"]
  node_realtime_service["Realtime Updates"]
  node_realtime_generator["Mock Telemetry<br/>[mockRealtime.ts]"]
end

node_browser_entry -->|"renders"| node_building_dashboard
node_building_dashboard -->|"imports"| node_equipment_page
node_equipment_page -->|"uses"| node_equipment_state
node_equipment_page -->|"renders"| node_equipment_detail
node_equipment_page -->|"updates"| node_equipment_state
node_equipment_detail -->|"sends updates"| node_equipment_page
node_equipment_state -->|"initializes from"| node_mock_equipment
node_equipment_page -->|"uses types"| node_equipment_model
node_equipment_detail -->|"uses type"| node_equipment_model
node_mock_equipment -->|"uses type"| node_equipment_model
node_equipment_detail -->|"calls commands"| node_control_service
node_realtime_service -->|"generates updates with"| node_realtime_generator
node_realtime_service -->|"uses type"| node_equipment_model
node_realtime_generator -->|"uses type"| node_equipment_model

click node_browser_entry "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/main.tsx"
click node_building_dashboard "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/App.tsx"
click node_equipment_page "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/components/EquipmentPage.tsx"
click node_equipment_detail "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/components/EquipmentDetail.tsx"
click node_equipment_card "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/components/EquipmentCard.tsx"
click node_equipment_state "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/hooks/useEquipment.ts"
click node_mock_equipment "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/data/mockEquipment.ts"
click node_equipment_model "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/models/equipment.ts"
click node_control_service "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/services/controlService.ts"
click node_realtime_service "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/services/websocketService.ts"
click node_realtime_generator "https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/services/mockRealtime.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_browser_entry,node_building_dashboard toneBlue
class node_equipment_page,node_equipment_detail,node_equipment_card,node_equipment_state,node_mock_equipment,node_equipment_model toneAmber
class node_control_service,node_realtime_service,node_realtime_generator toneMint
```

## Components

### Building Dashboard

- [React Mount](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/main.tsx): `src/main.tsx`
- [Energy Dashboard](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/App.tsx): `src/App.tsx`

### Equipment Monitoring

- [Equipment Overview](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/components/EquipmentPage.tsx): `src/components/EquipmentPage.tsx`
- [Equipment Detail](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/components/EquipmentDetail.tsx): `src/components/EquipmentDetail.tsx`
- [Equipment Card](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/components/EquipmentCard.tsx): `src/components/EquipmentCard.tsx`
- [Equipment State](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/hooks/useEquipment.ts): `src/hooks/useEquipment.ts`
- [Sample Equipment](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/data/mockEquipment.ts): `src/data/mockEquipment.ts`
- [Equipment Model](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/models/equipment.ts): `src/models/equipment.ts`

### Control And Realtime

- [AHU Commands](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/services/controlService.ts): `src/services/controlService.ts`
- [Realtime Updates](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/services/websocketService.ts): `src/services/websocketService.ts`
- [Mock Telemetry](https://github.com/phongsathonja-john/smart-building-dashboard/blob/main/src/services/mockRealtime.ts): `src/services/mockRealtime.ts`

## Connections

- React Mount → Energy Dashboard: renders (evidence: `src/main.tsx`)
- Energy Dashboard → Equipment Overview: imports (evidence: `src/App.tsx`)
- Equipment Overview → Equipment State: uses (evidence: `src/components/EquipmentPage.tsx`)
- Equipment Overview → Equipment Detail: renders (evidence: `src/components/EquipmentPage.tsx`)
- Equipment Overview → Equipment State: updates (evidence: `src/components/EquipmentPage.tsx`)
- Equipment Detail → Equipment Overview: sends updates (evidence: `src/components/EquipmentDetail.tsx`)
- Equipment State → Sample Equipment: initializes from (evidence: `src/hooks/useEquipment.ts`)
- Equipment Overview → Equipment Model: uses types (evidence: `src/components/EquipmentPage.tsx`)
- Equipment Detail → Equipment Model: uses type (evidence: `src/components/EquipmentDetail.tsx`)
- Sample Equipment → Equipment Model: uses type (evidence: `src/data/mockEquipment.ts`)
- Equipment Detail → AHU Commands: calls commands (evidence: `src/components/EquipmentDetail.tsx`)
- Realtime Updates → Mock Telemetry: generates updates with (evidence: `src/services/websocketService.ts`)
- Realtime Updates → Equipment Model: uses type (evidence: `src/services/websocketService.ts`)
- Mock Telemetry → Equipment Model: uses type (evidence: `src/services/mockRealtime.ts`)
