# pedrocasaburi/neow architecture

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

- Interactive diagram: https://gitdiagram.com/pedrocasaburi/neow
- Repository: https://github.com/pedrocasaburi/neow

## Overview

Industrial Safety Monitor combines ESP32 helmet telemetry and a web operations console. The principal flow is sensor readings from the helmet to the backend, then live WebSocket telemetry to the dashboard and GPS map; the console also manages users, employees, helmets, safety analytics, and password recovery. Frontend dataService synchronizes application records with Supabase Realtime or local storage, while server.ts provides backend APIs and WebSocket service. README documents Resend OTP and regulatory analytics; sampled excerpts do not expose all route and component wiring, so uncertain links are omitted.

Main entry points: [`src/App.tsx`](https://github.com/pedrocasaburi/neow/blob/main/src/App.tsx) (Application shell), [`src/services/dataService.ts`](https://github.com/pedrocasaburi/neow/blob/main/src/services/dataService.ts) (Application data service), [`server.ts`](https://github.com/pedrocasaburi/neow/blob/main/server.ts) (API and WebSocket), [`esp32/ESP_Melhorado.ino`](https://github.com/pedrocasaburi/neow/blob/main/esp32/ESP_Melhorado.ino) (ESP32 helmet)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_device["Helmet telemetry"]
  node_helmet["ESP32 helmet<br/>[ESP_Melhorado.ino]"]
end

subgraph group_backend["Backend services"]
  node_server["API and WebSocket<br/>[server.ts]"]
  node_resend["Resend email"]
end

subgraph group_frontend["Operations console"]
  node_app["Application shell<br/>[App.tsx]"]
  node_dashboard["Live dashboard<br/>[Dashboard.tsx]"]
  node_map["GPS map<br/>[Map.tsx]"]
  node_login["Login and registration<br/>[Login.tsx]"]
  node_register["Registration form<br/>[Register.tsx]"]
  node_forgot["Password recovery"]
  node_useradmin["User and role management"]
  node_employees["Employee management"]
  node_helmets["Helmet management"]
  node_analytics["Safety analytics"]
  node_profile["Profile management<br/>[ProfileModal.tsx]"]
  node_privacy["Privacy consent"]
end

subgraph group_data["Persistence and security"]
  node_dataservice["Application data service<br/>[dataService.ts]"]
  node_supabaseclient["Supabase client<br/>[supabaseClient.ts]"]
  node_supabase[("Supabase database")]
  node_localstorage[("Local storage fallback<br/>[dataService.ts]")]
  node_security["Privacy and security<br/>[security.ts]"]
end

node_operator(("Operator"))

node_operator -->|"wears"| node_helmet
node_helmet -->|"posts telemetry"| node_server
node_server -->|"streams telemetry"| node_app
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_map
node_app -->|"renders"| node_login
node_app -->|"renders"| node_register
node_app -->|"renders"| node_forgot
node_app -->|"renders"| node_useradmin
node_app -->|"renders"| node_employees
node_app -->|"renders"| node_helmets
node_app -->|"renders"| node_analytics
node_app -->|"renders"| node_profile
node_app -->|"renders"| node_privacy
node_app -->|"subscribes to"| node_dataservice
node_app -->|"saves users"| node_dataservice
node_useradmin -->|"manages users"| node_dataservice
node_employees -->|"saves employees"| node_dataservice
node_dataservice -->|"uses"| node_supabaseclient
node_supabaseclient -->|"connects"| node_supabase
node_dataservice -.->|"falls back to"| node_localstorage
node_dataservice -->|"protects personal data"| node_security
node_server -->|"reads and writes"| node_supabase
node_server -.->|"sends recovery email"| node_resend

click node_helmet "https://github.com/pedrocasaburi/neow/blob/main/esp32/ESP_Melhorado.ino"
click node_server "https://github.com/pedrocasaburi/neow/blob/main/server.ts"
click node_app "https://github.com/pedrocasaburi/neow/blob/main/src/App.tsx"
click node_dashboard "https://github.com/pedrocasaburi/neow/blob/main/src/components/Dashboard.tsx"
click node_map "https://github.com/pedrocasaburi/neow/blob/main/src/components/Map.tsx"
click node_login "https://github.com/pedrocasaburi/neow/blob/main/src/components/Login.tsx"
click node_register "https://github.com/pedrocasaburi/neow/blob/main/src/components/Register.tsx"
click node_forgot "https://github.com/pedrocasaburi/neow/blob/main/src/components/ForgotPasswordModal.tsx"
click node_useradmin "https://github.com/pedrocasaburi/neow/blob/main/src/components/UserManagementModal.tsx"
click node_employees "https://github.com/pedrocasaburi/neow/blob/main/src/components/EmployeeManagementModal.tsx"
click node_helmets "https://github.com/pedrocasaburi/neow/blob/main/src/components/HelmetManagementModal.tsx"
click node_analytics "https://github.com/pedrocasaburi/neow/blob/main/src/components/SafetyAnalyticsModal.tsx"
click node_profile "https://github.com/pedrocasaburi/neow/blob/main/src/components/ProfileModal.tsx"
click node_privacy "https://github.com/pedrocasaburi/neow/blob/main/src/components/CookieConsentBanner.tsx"
click node_dataservice "https://github.com/pedrocasaburi/neow/blob/main/src/services/dataService.ts"
click node_supabaseclient "https://github.com/pedrocasaburi/neow/blob/main/src/services/supabaseClient.ts"
click node_localstorage "https://github.com/pedrocasaburi/neow/blob/main/src/services/dataService.ts"
click node_security "https://github.com/pedrocasaburi/neow/blob/main/src/utils/security.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_helmet toneBlue
class node_server,node_resend toneAmber
class node_app,node_dashboard,node_map,node_login,node_register,node_forgot,node_useradmin,node_employees,node_helmets,node_analytics,node_profile,node_privacy toneMint
class node_dataservice,node_supabaseclient,node_supabase,node_localstorage,node_security toneRose
class node_operator toneIndigo
```

## Components

### Helmet telemetry

- [ESP32 helmet](https://github.com/pedrocasaburi/neow/blob/main/esp32/ESP_Melhorado.ino): `esp32/ESP_Melhorado.ino`

### Backend services

- [API and WebSocket](https://github.com/pedrocasaburi/neow/blob/main/server.ts): `server.ts`
- **Resend email**

### Operations console

- [Application shell](https://github.com/pedrocasaburi/neow/blob/main/src/App.tsx): `src/App.tsx`
- [Live dashboard](https://github.com/pedrocasaburi/neow/blob/main/src/components/Dashboard.tsx): `src/components/Dashboard.tsx`
- [GPS map](https://github.com/pedrocasaburi/neow/blob/main/src/components/Map.tsx): `src/components/Map.tsx`
- [Login and registration](https://github.com/pedrocasaburi/neow/blob/main/src/components/Login.tsx): `src/components/Login.tsx`
- [Registration form](https://github.com/pedrocasaburi/neow/blob/main/src/components/Register.tsx): `src/components/Register.tsx`
- [Password recovery](https://github.com/pedrocasaburi/neow/blob/main/src/components/ForgotPasswordModal.tsx): `src/components/ForgotPasswordModal.tsx`
- [User and role management](https://github.com/pedrocasaburi/neow/blob/main/src/components/UserManagementModal.tsx): `src/components/UserManagementModal.tsx`
- [Employee management](https://github.com/pedrocasaburi/neow/blob/main/src/components/EmployeeManagementModal.tsx): `src/components/EmployeeManagementModal.tsx`
- [Helmet management](https://github.com/pedrocasaburi/neow/blob/main/src/components/HelmetManagementModal.tsx): `src/components/HelmetManagementModal.tsx`
- [Safety analytics](https://github.com/pedrocasaburi/neow/blob/main/src/components/SafetyAnalyticsModal.tsx): `src/components/SafetyAnalyticsModal.tsx`
- [Profile management](https://github.com/pedrocasaburi/neow/blob/main/src/components/ProfileModal.tsx): `src/components/ProfileModal.tsx`
- [Privacy consent](https://github.com/pedrocasaburi/neow/blob/main/src/components/CookieConsentBanner.tsx): `src/components/CookieConsentBanner.tsx`

### Persistence and security

- [Application data service](https://github.com/pedrocasaburi/neow/blob/main/src/services/dataService.ts): `src/services/dataService.ts`
- [Supabase client](https://github.com/pedrocasaburi/neow/blob/main/src/services/supabaseClient.ts): `src/services/supabaseClient.ts`
- **Supabase database**
- [Local storage fallback](https://github.com/pedrocasaburi/neow/blob/main/src/services/dataService.ts): `src/services/dataService.ts`
- [Privacy and security](https://github.com/pedrocasaburi/neow/blob/main/src/utils/security.ts): `src/utils/security.ts`

### Other components

- **Operator**

## Connections

- Operator → ESP32 helmet: wears
- ESP32 helmet → API and WebSocket: posts telemetry
- API and WebSocket → Application shell: streams telemetry
- Application shell → Live dashboard: renders
- Application shell → GPS map: renders
- Application shell → Login and registration: renders
- Application shell → Registration form: renders
- Application shell → Password recovery: renders
- Application shell → User and role management: renders
- Application shell → Employee management: renders
- Application shell → Helmet management: renders
- Application shell → Safety analytics: renders
- Application shell → Profile management: renders
- Application shell → Privacy consent: renders
- Application shell → Application data service: subscribes to
- Application shell → Application data service: saves users
- User and role management → Application data service: manages users
- Employee management → Application data service: saves employees
- Application data service → Supabase client: uses
- Supabase client → Supabase database: connects
- Application data service → Local storage fallback: falls back to
- Application data service → Privacy and security: protects personal data
- API and WebSocket → Supabase database: reads and writes
- API and WebSocket → Resend email: sends recovery email
