# sangamdevhare6-crypto/world-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/sangamdevhare6-crypto/world-monitor
- Repository: https://github.com/sangamdevhare6-crypto/world-monitor

## Overview

WORLD MONITOR is a disaster-intelligence and civil-protection command center serving citizens and authorities. Users reach dashboards, weather/radar, alerts, evacuation routes, infrastructure monitoring, incident reporting, and analytics through the web client and Express API. Backend controllers implement these domain workflows over PostgreSQL or the embedded fallback store; weather and emergency-alert services add external telemetry, while SSE distributes live updates. The graph preserves README-documented capabilities even where their frontend or controller implementations were not sampled; those connections are shown only when documented or indexed.

Main entry points: [`backend/server.js`](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/server.js) (Express API), [`frontend/js/app.js`](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/app.js) (Command Interface), [`backend/services/emergencyAlertService.js`](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/emergencyAlertService.js) (Emergency Alert Engine), [`backend/services/alertService.js`](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/alertService.js) (Alert Management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web Client"]
  node_web["Command Interface<br/>[app.js]"]
  node_webapi["REST Client<br/>[api.js]"]
  node_dashboardui["Dashboard View<br/>[dashboard.js]"]
  node_weatherui["Weather &amp; Radar<br/>[weather.js]"]
  node_radarui["Radar View<br/>[radar.js]"]
  node_routesui["Evacuation Map<br/>[routes.js]"]
  node_alertsui["Alerts View<br/>[alerts.js]"]
  node_reportsui["Reports View<br/>[reports.js]"]
  node_notifyui["Live Notifications<br/>[notifications.js]"]
end

subgraph group_api["API Workflows"]
  node_api["Express API<br/>[server.js]"]
  node_dashboard["Situation Dashboard"]
  node_evacuation["Safe Routing<br/>[routeController.js]"]
  node_infrastructure["Infrastructure Sensors"]
  node_stations["Monitoring Stations"]
  node_alerts["Alert Management<br/>[alertService.js]"]
  node_reports["Incident Reports &amp; Dossiers"]
end

subgraph group_intelligence["Monitoring &amp; Response"]
  node_weather["Weather Forecasts<br/>[weatherService.js]"]
  node_radar["Radar Telemetry<br/>[radarService.js]"]
  node_emergency["Emergency Alert Engine"]
  node_realtime["SSE Event Stream<br/>[realtimeService.js]"]
end

subgraph group_platform["Identity &amp; State"]
  node_auth["Authentication<br/>[authController.js]"]
  node_guard["JWT &amp; Role Guards<br/>[authMiddleware.js]"]
  node_store[("Database &amp; Fallback<br/>[db.js]")]
end

node_citizen(("Citizen"))
node_authority(("Authority"))
node_openmeteo["Open-Meteo"]
node_disasterfeeds["GDACS &amp; USGS"]

node_citizen -->|"uses"| node_web
node_authority -->|"uses"| node_web
node_web -.->|"requests data"| node_webapi
node_webapi -->|"calls REST"| node_api
node_web -.->|"renders"| node_dashboardui
node_web -.->|"renders"| node_weatherui
node_web -.->|"renders"| node_radarui
node_web -.->|"renders"| node_routesui
node_web -.->|"renders"| node_alertsui
node_web -.->|"renders"| node_reportsui
node_web -.->|"renders"| node_notifyui
node_api -->|"routes requests"| node_dashboard
node_api -->|"routes requests"| node_auth
node_api -->|"routes requests"| node_reports
node_api -->|"routes requests"| node_weather
node_api -->|"routes requests"| node_radar
node_api -->|"routes requests"| node_evacuation
node_api -->|"routes requests"| node_infrastructure
node_api -->|"routes requests"| node_stations
node_api -->|"routes requests"| node_alerts
node_api -->|"registers clients"| node_realtime
node_api -->|"starts engine"| node_emergency
node_dashboard -->|"reads forecasts"| node_weather
node_dashboard -->|"reads alerts"| node_alerts
node_weather -->|"fetches forecasts"| node_openmeteo
node_emergency -->|"fetches telemetry"| node_openmeteo
node_emergency -->|"checks events"| node_disasterfeeds
node_emergency -->|"broadcasts alerts"| node_realtime
node_reports -->|"broadcasts updates"| node_realtime
node_reports -->|"reads and writes"| node_store
node_alerts -->|"broadcasts alerts"| node_realtime
node_alerts -->|"reads and writes"| node_store
node_auth -->|"reads and writes"| node_store
node_auth -->|"issues tokens"| node_guard
node_guard -->|"loads user"| node_store
node_guard -->|"guards routes"| node_api

click node_web "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/app.js"
click node_webapi "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/api.js"
click node_dashboardui "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/dashboard.js"
click node_weatherui "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/weather.js"
click node_radarui "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/radar.js"
click node_routesui "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/routes.js"
click node_alertsui "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/alerts.js"
click node_reportsui "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/reports.js"
click node_notifyui "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/notifications.js"
click node_api "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/server.js"
click node_dashboard "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/dashboardController.js"
click node_weather "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/weatherService.js"
click node_radar "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/radarService.js"
click node_evacuation "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/routeController.js"
click node_infrastructure "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/infrastructureController.js"
click node_stations "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/stationController.js"
click node_alerts "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/alertService.js"
click node_emergency "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/emergencyAlertService.js"
click node_reports "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/reportController.js"
click node_realtime "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/realtimeService.js"
click node_auth "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/authController.js"
click node_guard "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/middleware/authMiddleware.js"
click node_store "https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/config/db.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_web,node_webapi,node_dashboardui,node_weatherui,node_radarui,node_routesui,node_alertsui,node_reportsui,node_notifyui toneBlue
class node_api,node_dashboard,node_evacuation,node_infrastructure,node_stations,node_alerts,node_reports toneAmber
class node_weather,node_radar,node_emergency,node_realtime toneMint
class node_auth,node_guard,node_store toneRose
class node_citizen,node_authority,node_openmeteo,node_disasterfeeds toneIndigo
```

## Components

### Web Client

- [Command Interface](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/app.js): `frontend/js/app.js`
- [REST Client](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/api.js): `frontend/js/api.js`
- [Dashboard View](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/dashboard.js): `frontend/js/dashboard.js`
- [Weather & Radar](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/weather.js): `frontend/js/weather.js`
- [Radar View](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/radar.js): `frontend/js/radar.js`
- [Evacuation Map](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/routes.js): `frontend/js/routes.js`
- [Alerts View](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/alerts.js): `frontend/js/alerts.js`
- [Reports View](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/reports.js): `frontend/js/reports.js`
- [Live Notifications](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/frontend/js/notifications.js): `frontend/js/notifications.js`

### API Workflows

- [Express API](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/server.js): `backend/server.js`
- [Situation Dashboard](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/dashboardController.js): `backend/controllers/dashboardController.js`
- [Safe Routing](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/routeController.js): `backend/controllers/routeController.js`
- [Infrastructure Sensors](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/infrastructureController.js): `backend/controllers/infrastructureController.js`
- [Monitoring Stations](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/stationController.js): `backend/controllers/stationController.js`
- [Alert Management](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/alertService.js): `backend/services/alertService.js`
- [Incident Reports & Dossiers](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/reportController.js): `backend/controllers/reportController.js`

### Monitoring & Response

- [Weather Forecasts](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/weatherService.js): `backend/services/weatherService.js`
- [Radar Telemetry](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/radarService.js): `backend/services/radarService.js`
- [Emergency Alert Engine](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/emergencyAlertService.js): `backend/services/emergencyAlertService.js`
- [SSE Event Stream](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/services/realtimeService.js): `backend/services/realtimeService.js`

### Identity & State

- [Authentication](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`
- [JWT & Role Guards](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/middleware/authMiddleware.js): `backend/middleware/authMiddleware.js`
- [Database & Fallback](https://github.com/sangamdevhare6-crypto/world-monitor/blob/main/backend/config/db.js): `backend/config/db.js`

### Other components

- **Citizen**
- **Authority**
- **Open-Meteo**
- **GDACS & USGS**

## Connections

- Citizen → Command Interface: uses
- Authority → Command Interface: uses
- Command Interface → REST Client: requests data
- REST Client → Express API: calls REST
- Command Interface → Dashboard View: renders
- Command Interface → Weather & Radar: renders
- Command Interface → Radar View: renders
- Command Interface → Evacuation Map: renders
- Command Interface → Alerts View: renders
- Command Interface → Reports View: renders
- Command Interface → Live Notifications: renders
- Express API → Situation Dashboard: routes requests (evidence: `backend/server.js`)
- Express API → Authentication: routes requests (evidence: `backend/server.js`)
- Express API → Incident Reports & Dossiers: routes requests (evidence: `backend/server.js`)
- Express API → Weather Forecasts: routes requests (evidence: `backend/server.js`)
- Express API → Radar Telemetry: routes requests (evidence: `backend/server.js`)
- Express API → Safe Routing: routes requests (evidence: `backend/server.js`)
- Express API → Infrastructure Sensors: routes requests (evidence: `backend/server.js`)
- Express API → Monitoring Stations: routes requests (evidence: `backend/server.js`)
- Express API → Alert Management: routes requests (evidence: `backend/server.js`)
- Express API → SSE Event Stream: registers clients (evidence: `backend/server.js`)
- Express API → Emergency Alert Engine: starts engine (evidence: `backend/server.js`)
- Situation Dashboard → Weather Forecasts: reads forecasts (evidence: `backend/controllers/dashboardController.js`)
- Situation Dashboard → Alert Management: reads alerts (evidence: `backend/controllers/dashboardController.js`)
- Weather Forecasts → Open-Meteo: fetches forecasts (evidence: `backend/services/weatherService.js`)
- Emergency Alert Engine → Open-Meteo: fetches telemetry (evidence: `backend/services/emergencyAlertService.js`)
- Emergency Alert Engine → GDACS & USGS: checks events (evidence: `backend/services/emergencyAlertService.js`)
- Emergency Alert Engine → SSE Event Stream: broadcasts alerts (evidence: `backend/services/emergencyAlertService.js`)
- Incident Reports & Dossiers → SSE Event Stream: broadcasts updates (evidence: `backend/controllers/reportController.js`)
- Incident Reports & Dossiers → Database & Fallback: reads and writes (evidence: `backend/controllers/reportController.js`)
- Alert Management → SSE Event Stream: broadcasts alerts (evidence: `backend/services/alertService.js`)
- Alert Management → Database & Fallback: reads and writes (evidence: `backend/services/alertService.js`)
- Authentication → Database & Fallback: reads and writes (evidence: `backend/controllers/authController.js`)
- Authentication → JWT & Role Guards: issues tokens (evidence: `backend/controllers/authController.js`)
- JWT & Role Guards → Database & Fallback: loads user (evidence: `backend/middleware/authMiddleware.js`)
- JWT & Role Guards → Express API: guards routes (evidence: `backend/server.js`)
