# hattivishwajeet-ctrl/disaster-relief-management-system architecture

> Architecture diagram of the GitHub repository hattivishwajeet-ctrl/disaster-relief-management-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hattivishwajeet-ctrl/disaster-relief-management-system
- Repository: https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system

## Overview

Admins use the workspace to manage disasters, camps, requests, stock, allocations, and deliveries; volunteers submit field reports and update availability. The API is the main runtime entry point: it authenticates requests, performs operational actions, and serves analytics. Field reports are stored in MongoDB and reconciled into MySQL, while a WebSocket hub publishes MySQL notifications to admins. The graph follows documented capabilities where implementation excerpts are incomplete; unsampled routes are represented at the API boundary rather than given speculative call links.

Main entry points: [`server/api.mjs`](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs) (JSON API), [`app/workspace.jsx`](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/app/workspace.jsx) (Operations workspace), [`server/hub.mjs`](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/hub.mjs) (Live event hub), [`server/index.mjs`](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/index.mjs) (HTTP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_workspace["Operations workspace<br/>[workspace.jsx]"]
end

subgraph group_runtime["Application runtime"]
  node_http["HTTP server<br/>[index.mjs]"]
  node_api["JSON API<br/>[api.mjs]"]
  node_security["Session security<br/>[security.mjs]"]
end

subgraph group_operations["Relief operations"]
  node_resources["Disaster and camp setup<br/>[api.mjs]"]
  node_requests["Request ranking<br/>[api.mjs]"]
  node_allocation["Allocation and delivery<br/>[api.mjs]"]
  node_inventory["Inventory and shortages<br/>[api.mjs]"]
  node_availability["Volunteer availability<br/>[api.mjs]"]
end

subgraph group_reporting["Reporting and live updates"]
  node_reports["Field report intake<br/>[api.mjs]"]
  node_worker["Report reconciliation<br/>[reports.mjs]"]
  node_analytics["Operational analytics<br/>[analytics.mjs]"]
  node_hub["Live event hub<br/>[hub.mjs]"]
end

subgraph group_storage["Persistence"]
  node_db["Database adapters<br/>[db.mjs]"]
  node_mysql[("MySQL operations store")]
  node_mongo[("MongoDB report store")]
end

node_admin(("Admin"))
node_volunteer(("Volunteer"))

node_admin -->|"uses"| node_workspace
node_volunteer -->|"uses"| node_workspace
node_workspace -->|"calls"| node_api
node_workspace -->|"opens socket"| node_hub
node_http -->|"routes requests"| node_api
node_http -->|"starts"| node_hub
node_http -->|"starts"| node_worker
node_http -->|"initializes"| node_db
node_api -->|"authenticates"| node_security
node_api -->|"queries"| node_db
node_api -->|"handles"| node_resources
node_api -->|"handles"| node_requests
node_api -->|"handles"| node_allocation
node_api -->|"handles"| node_inventory
node_api -->|"handles"| node_availability
node_api -->|"handles"| node_reports
node_api -->|"queries"| node_analytics
node_api -->|"reads summaries"| node_worker
node_requests -->|"updates priority"| node_mysql
node_allocation -->|"allocates stock"| node_mysql
node_inventory -->|"updates stock"| node_mysql
node_availability -.->|"stores status"| node_mysql
node_reports -->|"stores reports"| node_mongo
node_worker -->|"watches reports"| node_mongo
node_worker -->|"reconciles reports"| node_mysql
node_analytics -->|"queries metrics"| node_mysql
node_hub -->|"checks sessions"| node_security
node_hub -->|"polls notifications"| node_mysql
node_db -->|"connects"| node_mysql
node_db -->|"connects"| node_mongo
node_api -->|"returns data"| node_workspace
node_hub -->|"publishes events"| node_workspace

click node_workspace "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/app/workspace.jsx"
click node_http "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/index.mjs"
click node_api "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs"
click node_security "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/security.mjs"
click node_resources "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs"
click node_requests "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs"
click node_allocation "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs"
click node_inventory "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs"
click node_availability "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs"
click node_reports "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs"
click node_worker "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/reports.mjs"
click node_analytics "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/analytics.mjs"
click node_hub "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/hub.mjs"
click node_db "https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/db.mjs"

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_workspace toneBlue
class node_http,node_api,node_security toneAmber
class node_resources,node_requests,node_allocation,node_inventory,node_availability toneMint
class node_reports,node_worker,node_analytics,node_hub toneRose
class node_db,node_mysql,node_mongo,node_admin,node_volunteer toneIndigo
```

## Components

### User experience

- [Operations workspace](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/app/workspace.jsx): `app/workspace.jsx`

### Application runtime

- [HTTP server](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/index.mjs): `server/index.mjs`
- [JSON API](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs): `server/api.mjs`
- [Session security](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/security.mjs): `server/security.mjs`

### Relief operations

- [Disaster and camp setup](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs): `server/api.mjs`
- [Request ranking](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs): `server/api.mjs`
- [Allocation and delivery](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs): `server/api.mjs`
- [Inventory and shortages](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs): `server/api.mjs`
- [Volunteer availability](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs): `server/api.mjs`

### Reporting and live updates

- [Field report intake](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/api.mjs): `server/api.mjs`
- [Report reconciliation](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/reports.mjs): `server/reports.mjs`
- [Operational analytics](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/analytics.mjs): `server/analytics.mjs`
- [Live event hub](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/hub.mjs): `server/hub.mjs`

### Persistence

- [Database adapters](https://github.com/hattivishwajeet-ctrl/disaster-relief-management-system/blob/main/server/db.mjs): `server/db.mjs`
- **MySQL operations store**
- **MongoDB report store**

### Other components

- **Admin**
- **Volunteer**

## Connections

- Admin → Operations workspace: uses (evidence: `README.md`)
- Volunteer → Operations workspace: uses (evidence: `README.md`)
- Operations workspace → JSON API: calls (evidence: `app/workspace.jsx`)
- Operations workspace → Live event hub: opens socket (evidence: `app/workspace.jsx`)
- HTTP server → JSON API: routes requests (evidence: `server/index.mjs`)
- HTTP server → Live event hub: starts (evidence: `server/index.mjs`)
- HTTP server → Report reconciliation: starts (evidence: `server/index.mjs`)
- HTTP server → Database adapters: initializes (evidence: `server/index.mjs`)
- JSON API → Session security: authenticates (evidence: `server/api.mjs`)
- JSON API → Database adapters: queries (evidence: `server/api.mjs`)
- JSON API → Disaster and camp setup: handles (evidence: `server/api.mjs`)
- JSON API → Request ranking: handles (evidence: `server/api.mjs`)
- JSON API → Allocation and delivery: handles (evidence: `server/api.mjs`)
- JSON API → Inventory and shortages: handles (evidence: `server/api.mjs`)
- JSON API → Volunteer availability: handles (evidence: `README.md`)
- JSON API → Field report intake: handles (evidence: `server/api.mjs`)
- JSON API → Operational analytics: queries (evidence: `server/api.mjs`)
- JSON API → Report reconciliation: reads summaries (evidence: `server/api.mjs`)
- Request ranking → MySQL operations store: updates priority (evidence: `server/api.mjs`)
- Allocation and delivery → MySQL operations store: allocates stock (evidence: `server/api.mjs`)
- Inventory and shortages → MySQL operations store: updates stock (evidence: `server/api.mjs`)
- Volunteer availability → MySQL operations store: stores status
- Field report intake → MongoDB report store: stores reports (evidence: `README.md`)
- Report reconciliation → MongoDB report store: watches reports (evidence: `server/reports.mjs`)
- Report reconciliation → MySQL operations store: reconciles reports (evidence: `server/reports.mjs`)
- Operational analytics → MySQL operations store: queries metrics (evidence: `server/analytics.mjs`)
- Live event hub → Session security: checks sessions (evidence: `server/hub.mjs`)
- Live event hub → MySQL operations store: polls notifications (evidence: `server/hub.mjs`)
- Database adapters → MySQL operations store: connects (evidence: `server/db.mjs`)
- Database adapters → MongoDB report store: connects (evidence: `server/db.mjs`)
- JSON API → Operations workspace: returns data (evidence: `app/workspace.jsx`)
- Live event hub → Operations workspace: publishes events (evidence: `README.md`)
