# rhein05-21/h-fireadminside architecture

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

- Interactive diagram: https://gitdiagram.com/rhein05-21/h-fireadminside
- Repository: https://github.com/rhein05-21/h-fireadminside

## Overview

H-FIRE is a community fire and gas monitoring system: sensor nodes report telemetry, the app presents household and community safety status, and users can review incidents, manage devices, and configure emergency response. The sampled code shows app-level status calculation, authentication, incident/admin state, and Supabase client setup. The tree also identifies ESP32 firmware and a HiveMQ bridge, but their runtime connections are not established by the available excerpts; those links are therefore omitted. There is no README content to verify additional capabilities.

Main entry points: [`context/AdminContext.tsx`](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/context/AdminContext.tsx) (Monitoring state), [`app/(tabs)/settings.tsx`](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/settings.tsx) (Settings and registration), [`context/AuthContext.tsx`](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/context/AuthContext.tsx) (Authentication), [`utils/supabase.ts`](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/utils/supabase.ts) (Supabase client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_field["Sensor and bridge"]
  node_esp32["ESP32 sensor firmware"]
  node_bridge["HiveMQ bridge<br/>[hivemq-bridge.js]"]
end

subgraph group_data["Monitoring data"]
  node_supabase[("Supabase service")]
  node_client["Supabase client<br/>[supabase.ts]"]
end

subgraph group_app["Safety application"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_adminstate["Monitoring state<br/>[AdminContext.tsx]"]
  node_thresholds["Hazard classification<br/>[thresholds.ts]"]
  node_dashboard["Safety dashboard<br/>[index.tsx]"]
  node_incidents["Incident review<br/>[incidents.tsx]"]
  node_maproute["Community map route<br/>[map.tsx]"]
  node_map["Hazard map<br/>[CommunityMap.tsx]"]
  node_deviceview["Device details<br/>[&#91;mac&#93;.tsx]"]
  node_alerts["Emergency alerts<br/>[EmergencyModal.tsx]"]
  node_offline["Offline status banner<br/>[OfflineBanner.tsx]"]
  node_theme["Shared visual theme<br/>[theme.ts]"]
end

subgraph group_admin["Administration"]
  node_settings["Settings and registration<br/>[settings.tsx]"]
  node_directory["User directory"]
  node_editdevice["Device assignment"]
  node_hotlines["Hotline configuration"]
  node_simulator["Telemetry simulator"]
end

node_resident(("Community users"))

node_client -->|"creates client"| node_supabase
node_auth -->|"authenticates"| node_client
node_auth -->|"reads profiles"| node_supabase
node_adminstate -->|"loads monitoring data"| node_client
node_adminstate -->|"classifies readings"| node_thresholds
node_dashboard -->|"displays status"| node_adminstate
node_dashboard -->|"uses thresholds"| node_thresholds
node_incidents -->|"uses admin state"| node_adminstate
node_maproute -->|"renders map"| node_map
node_maproute -->|"uses admin state"| node_adminstate
node_map -->|"accesses data"| node_client
node_map -->|"opens editor"| node_editdevice
node_deviceview -->|"uses admin state"| node_adminstate
node_settings -->|"uses account state"| node_auth
node_settings -->|"uses admin state"| node_adminstate
node_settings -->|"opens directory"| node_directory
node_settings -->|"opens hotline editor"| node_hotlines
node_directory -->|"opens device editor"| node_editdevice
node_editdevice -->|"updates device config"| node_adminstate
node_alerts -->|"uses emergency state"| node_adminstate
node_offline -->|"uses styling"| node_theme
node_simulator -->|"uses simulator state"| node_adminstate
node_resident -->|"signs in"| node_auth
node_resident -->|"views safety status"| node_dashboard

click node_esp32 "https://github.com/rhein05-21/h-fireadminside/tree/feature/pwa-support/esp32/firmware_v2"
click node_bridge "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/utils/hivemq-bridge.js"
click node_client "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/utils/supabase.ts"
click node_auth "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/context/AuthContext.tsx"
click node_adminstate "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/context/AdminContext.tsx"
click node_thresholds "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/constants/thresholds.ts"
click node_dashboard "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/index.tsx"
click node_incidents "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/incidents.tsx"
click node_maproute "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/map.tsx"
click node_map "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/CommunityMap.tsx"
click node_deviceview "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/device/%5Bmac%5D.tsx"
click node_alerts "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/EmergencyModal.tsx"
click node_offline "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/OfflineBanner.tsx"
click node_settings "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/settings.tsx"
click node_directory "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/UserDirectoryModal.tsx"
click node_editdevice "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/EditDeviceModal.tsx"
click node_hotlines "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/EditHotlineModal.tsx"
click node_simulator "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/TestSimulatorModal.tsx"
click node_theme "https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/constants/theme.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_esp32,node_bridge,node_resident toneBlue
class node_supabase,node_client toneAmber
class node_auth,node_adminstate,node_thresholds,node_dashboard,node_incidents,node_maproute,node_map,node_deviceview,node_alerts,node_offline,node_theme toneMint
class node_settings,node_directory,node_editdevice,node_hotlines,node_simulator toneRose
```

## Components

### Sensor and bridge

- [ESP32 sensor firmware](https://github.com/rhein05-21/h-fireadminside/tree/feature/pwa-support/esp32/firmware_v2): `esp32/firmware_v2`
- [HiveMQ bridge](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/utils/hivemq-bridge.js): `utils/hivemq-bridge.js`

### Monitoring data

- **Supabase service**
- [Supabase client](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/utils/supabase.ts): `utils/supabase.ts`

### Safety application

- [Authentication](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/context/AuthContext.tsx): `context/AuthContext.tsx`
- [Monitoring state](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/context/AdminContext.tsx): `context/AdminContext.tsx`
- [Hazard classification](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/constants/thresholds.ts): `constants/thresholds.ts`
- [Safety dashboard](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/index.tsx): `app/(tabs)/index.tsx`
- [Incident review](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/incidents.tsx): `app/(tabs)/incidents.tsx`
- [Community map route](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/map.tsx): `app/(tabs)/map.tsx`
- [Hazard map](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/CommunityMap.tsx): `components/CommunityMap.tsx`
- [Device details](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/device/%5Bmac%5D.tsx): `app/device/[mac].tsx`
- [Emergency alerts](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/EmergencyModal.tsx): `components/EmergencyModal.tsx`
- [Offline status banner](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/OfflineBanner.tsx): `components/OfflineBanner.tsx`
- [Shared visual theme](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/constants/theme.ts): `constants/theme.ts`

### Administration

- [Settings and registration](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/app/(tabs)/settings.tsx): `app/(tabs)/settings.tsx`
- [User directory](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/UserDirectoryModal.tsx): `components/UserDirectoryModal.tsx`
- [Device assignment](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/EditDeviceModal.tsx): `components/EditDeviceModal.tsx`
- [Hotline configuration](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/EditHotlineModal.tsx): `components/EditHotlineModal.tsx`
- [Telemetry simulator](https://github.com/rhein05-21/h-fireadminside/blob/feature/pwa-support/components/TestSimulatorModal.tsx): `components/TestSimulatorModal.tsx`

### Other components

- **Community users**

## Connections

- Supabase client → Supabase service: creates client (evidence: `utils/supabase.ts`)
- Authentication → Supabase client: authenticates (evidence: `context/AuthContext.tsx`)
- Authentication → Supabase service: reads profiles (evidence: `context/AuthContext.tsx`)
- Monitoring state → Supabase client: loads monitoring data (evidence: `context/AdminContext.tsx`)
- Monitoring state → Hazard classification: classifies readings (evidence: `context/AdminContext.tsx`)
- Safety dashboard → Monitoring state: displays status (evidence: `app/(tabs)/index.tsx`)
- Safety dashboard → Hazard classification: uses thresholds (evidence: `app/(tabs)/index.tsx`)
- Incident review → Monitoring state: uses admin state (evidence: `app/(tabs)/incidents.tsx`)
- Community map route → Hazard map: renders map (evidence: `app/(tabs)/map.tsx`)
- Community map route → Monitoring state: uses admin state (evidence: `app/(tabs)/map.tsx`)
- Hazard map → Supabase client: accesses data (evidence: `components/CommunityMap.tsx`)
- Hazard map → Device assignment: opens editor (evidence: `components/CommunityMap.tsx`)
- Device details → Monitoring state: uses admin state (evidence: `app/device/[mac].tsx`)
- Settings and registration → Authentication: uses account state (evidence: `app/(tabs)/settings.tsx`)
- Settings and registration → Monitoring state: uses admin state (evidence: `app/(tabs)/settings.tsx`)
- Settings and registration → User directory: opens directory (evidence: `app/(tabs)/settings.tsx`)
- Settings and registration → Hotline configuration: opens hotline editor (evidence: `app/(tabs)/settings.tsx`)
- User directory → Device assignment: opens device editor (evidence: `components/UserDirectoryModal.tsx`)
- Device assignment → Monitoring state: updates device config (evidence: `components/EditDeviceModal.tsx`)
- Emergency alerts → Monitoring state: uses emergency state (evidence: `components/EmergencyModal.tsx`)
- Offline status banner → Shared visual theme: uses styling (evidence: `components/OfflineBanner.tsx`)
- Telemetry simulator → Monitoring state: uses simulator state (evidence: `components/TestSimulatorModal.tsx`)
- Community users → Authentication: signs in
- Community users → Safety dashboard: views safety status (evidence: `app/(tabs)/index.tsx`)
