# swarup-321/smart-helmet architecture

> Architecture diagram of the GitHub repository swarup-321/smart-helmet, 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/swarup-321/smart-helmet
- Repository: https://github.com/swarup-321/smart-helmet

## Overview

MineGuard is a browser dashboard for mine-worker safety telemetry. Safety staff move from a live overview into worker records, alert review, analytics, and device or system settings; critical SOS incidents surface as an acknowledgement overlay. AppContext coordinates shared state, polling, and live socket events through the API service. The shown code supports the client-side workflow and API boundary, not backend processing or persistence. README is empty, so product capabilities are inferred from the supplied UI excerpts and source index.

Main entry points: [`src/App.jsx`](https://github.com/swarup-321/smart-helmet/blob/main/src/App.jsx) (App router), [`src/context/AppContext.jsx`](https://github.com/swarup-321/smart-helmet/blob/main/src/context/AppContext.jsx) (Shared app state), [`src/services/api.js`](https://github.com/swarup-321/smart-helmet/blob/main/src/services/api.js) (HTTP and socket API), [`src/components/Overview.jsx`](https://github.com/swarup-321/smart-helmet/blob/main/src/components/Overview.jsx) (Live overview)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Dashboard shell"]
  node_app["App router<br/>[App.jsx]"]
  node_header["Navigation header<br/>[Header.jsx]"]
  node_palette["Command palette<br/>[CommandPalette.jsx]"]
  node_toast["Toast notifications<br/>[ToastContainer.jsx]"]
end

subgraph group_monitoring["Safety monitoring"]
  node_overview["Live overview<br/>[Overview.jsx]"]
  node_detail["Worker detail<br/>[WorkerDetail.jsx]"]
  node_alerts["Alert review<br/>[AlertsView.jsx]"]
  node_analytics["Safety analytics<br/>[AnalyticsView.jsx]"]
  node_sos["SOS overlay"]
end

subgraph group_operations["Mine operations"]
  node_workers["Workers and devices"]
  node_settings["Safety settings<br/>[SettingsView.jsx]"]
end

subgraph group_runtime["Client runtime"]
  node_context["Shared app state<br/>[AppContext.jsx]"]
  node_api["HTTP and socket API<br/>[api.js]"]
end

node_officer(("Safety staff"))
node_server{{"MineGuard API server"}}

node_officer -.->|"uses dashboard"| node_app
node_app -->|"renders"| node_header
node_app -->|"routes to"| node_overview
node_app -->|"routes to"| node_detail
node_app -->|"routes to"| node_alerts
node_app -->|"routes to"| node_analytics
node_app -->|"routes to"| node_workers
node_app -->|"routes to"| node_settings
node_app -->|"renders"| node_palette
node_app -->|"renders"| node_sos
node_app -->|"renders"| node_toast
node_app -->|"reads state"| node_context
node_header -->|"reads state"| node_context
node_palette -->|"reads state"| node_context
node_toast -->|"reads state"| node_context
node_overview -->|"reads telemetry"| node_context
node_detail -->|"reads state"| node_context
node_alerts -->|"reads state"| node_context
node_analytics -->|"reads state"| node_context
node_sos -->|"reads incident"| node_context
node_workers -->|"reads state"| node_context
node_settings -->|"reads preferences"| node_context
node_context -->|"polls and subscribes"| node_api
node_alerts -->|"requests alerts"| node_api
node_overview -->|"requests data"| node_api
node_detail -->|"requests worker data"| node_api
node_sos -->|"acknowledges incident"| node_api
node_workers -->|"manages workers"| node_api
node_settings -->|"updates settings"| node_api
node_api -->|"sends HTTP and socket traffic"| node_server

click node_app "https://github.com/swarup-321/smart-helmet/blob/main/src/App.jsx"
click node_header "https://github.com/swarup-321/smart-helmet/blob/main/src/components/Header.jsx"
click node_palette "https://github.com/swarup-321/smart-helmet/blob/main/src/components/CommandPalette.jsx"
click node_toast "https://github.com/swarup-321/smart-helmet/blob/main/src/components/ToastContainer.jsx"
click node_overview "https://github.com/swarup-321/smart-helmet/blob/main/src/components/Overview.jsx"
click node_detail "https://github.com/swarup-321/smart-helmet/blob/main/src/components/WorkerDetail.jsx"
click node_alerts "https://github.com/swarup-321/smart-helmet/blob/main/src/components/AlertsView.jsx"
click node_analytics "https://github.com/swarup-321/smart-helmet/blob/main/src/components/AnalyticsView.jsx"
click node_sos "https://github.com/swarup-321/smart-helmet/blob/main/src/components/FullscreenSosOverlay.jsx"
click node_workers "https://github.com/swarup-321/smart-helmet/blob/main/src/components/WorkersDevicesView.jsx"
click node_settings "https://github.com/swarup-321/smart-helmet/blob/main/src/components/SettingsView.jsx"
click node_context "https://github.com/swarup-321/smart-helmet/blob/main/src/context/AppContext.jsx"
click node_api "https://github.com/swarup-321/smart-helmet/blob/main/src/services/api.js"

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_header,node_palette,node_toast toneBlue
class node_overview,node_detail,node_alerts,node_analytics,node_sos toneAmber
class node_workers,node_settings,node_server toneMint
class node_context,node_api toneRose
class node_officer toneIndigo
```

## Components

### Dashboard shell

- [App router](https://github.com/swarup-321/smart-helmet/blob/main/src/App.jsx): `src/App.jsx`
- [Navigation header](https://github.com/swarup-321/smart-helmet/blob/main/src/components/Header.jsx): `src/components/Header.jsx`
- [Command palette](https://github.com/swarup-321/smart-helmet/blob/main/src/components/CommandPalette.jsx): `src/components/CommandPalette.jsx`
- [Toast notifications](https://github.com/swarup-321/smart-helmet/blob/main/src/components/ToastContainer.jsx): `src/components/ToastContainer.jsx`

### Safety monitoring

- [Live overview](https://github.com/swarup-321/smart-helmet/blob/main/src/components/Overview.jsx): `src/components/Overview.jsx`
- [Worker detail](https://github.com/swarup-321/smart-helmet/blob/main/src/components/WorkerDetail.jsx): `src/components/WorkerDetail.jsx`
- [Alert review](https://github.com/swarup-321/smart-helmet/blob/main/src/components/AlertsView.jsx): `src/components/AlertsView.jsx`
- [Safety analytics](https://github.com/swarup-321/smart-helmet/blob/main/src/components/AnalyticsView.jsx): `src/components/AnalyticsView.jsx`
- [SOS overlay](https://github.com/swarup-321/smart-helmet/blob/main/src/components/FullscreenSosOverlay.jsx): `src/components/FullscreenSosOverlay.jsx`

### Mine operations

- [Workers and devices](https://github.com/swarup-321/smart-helmet/blob/main/src/components/WorkersDevicesView.jsx): `src/components/WorkersDevicesView.jsx`
- [Safety settings](https://github.com/swarup-321/smart-helmet/blob/main/src/components/SettingsView.jsx): `src/components/SettingsView.jsx`

### Client runtime

- [Shared app state](https://github.com/swarup-321/smart-helmet/blob/main/src/context/AppContext.jsx): `src/context/AppContext.jsx`
- [HTTP and socket API](https://github.com/swarup-321/smart-helmet/blob/main/src/services/api.js): `src/services/api.js`

### Other components

- **Safety staff**
- **MineGuard API server**

## Connections

- Safety staff → App router: uses dashboard
- App router → Navigation header: renders (evidence: `src/App.jsx`)
- App router → Live overview: routes to (evidence: `src/App.jsx`)
- App router → Worker detail: routes to (evidence: `src/App.jsx`)
- App router → Alert review: routes to (evidence: `src/App.jsx`)
- App router → Safety analytics: routes to (evidence: `src/App.jsx`)
- App router → Workers and devices: routes to (evidence: `src/App.jsx`)
- App router → Safety settings: routes to (evidence: `src/App.jsx`)
- App router → Command palette: renders (evidence: `src/App.jsx`)
- App router → SOS overlay: renders (evidence: `src/App.jsx`)
- App router → Toast notifications: renders (evidence: `src/App.jsx`)
- App router → Shared app state: reads state (evidence: `src/App.jsx`)
- Navigation header → Shared app state: reads state (evidence: `src/components/Header.jsx`)
- Command palette → Shared app state: reads state (evidence: `src/components/CommandPalette.jsx`)
- Toast notifications → Shared app state: reads state (evidence: `src/components/ToastContainer.jsx`)
- Live overview → Shared app state: reads telemetry (evidence: `src/components/Overview.jsx`)
- Worker detail → Shared app state: reads state (evidence: `src/components/WorkerDetail.jsx`)
- Alert review → Shared app state: reads state (evidence: `src/components/AlertsView.jsx`)
- Safety analytics → Shared app state: reads state (evidence: `src/components/AnalyticsView.jsx`)
- SOS overlay → Shared app state: reads incident (evidence: `src/components/FullscreenSosOverlay.jsx`)
- Workers and devices → Shared app state: reads state (evidence: `src/components/WorkersDevicesView.jsx`)
- Safety settings → Shared app state: reads preferences (evidence: `src/components/SettingsView.jsx`)
- Shared app state → HTTP and socket API: polls and subscribes (evidence: `src/context/AppContext.jsx`)
- Alert review → HTTP and socket API: requests alerts (evidence: `src/components/AlertsView.jsx`)
- Live overview → HTTP and socket API: requests data (evidence: `src/components/Overview.jsx`)
- Worker detail → HTTP and socket API: requests worker data (evidence: `src/components/WorkerDetail.jsx`)
- SOS overlay → HTTP and socket API: acknowledges incident (evidence: `src/components/FullscreenSosOverlay.jsx`)
- Workers and devices → HTTP and socket API: manages workers (evidence: `src/components/WorkersDevicesView.jsx`)
- Safety settings → HTTP and socket API: updates settings (evidence: `src/components/SettingsView.jsx`)
- HTTP and socket API → MineGuard API server: sends HTTP and socket traffic (evidence: `src/services/api.js`)
