# rhithor/resq architecture

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

- Interactive diagram: https://gitdiagram.com/rhithor/resq
- Repository: https://github.com/rhithor/resq

## Overview

ResQ Radar is a disaster-response dashboard for turning victim distress reports into volunteer action. Its documented workflow is SOS reporting, incident persistence and live alerting, volunteer map-based triage, claiming a victim, and resolution. The backend source confirms the API, spatial database queries, status changes, and Socket.IO broadcasts; the README describes the dashboard capabilities. Frontend wiring beyond the sampled NextAuth route is therefore represented only where documented, not as inferred API calls.

Main entry points: [`backend/src/server.js`](https://github.com/rhithor/resq/blob/main/backend/src/server.js) (Express and Socket.IO), [`frontend/src/app/dashboard/page.js`](https://github.com/rhithor/resq/blob/main/frontend/src/app/dashboard/page.js) (Tactical Dashboard), [`backend/src/config/db.js`](https://github.com/rhithor/resq/blob/main/backend/src/config/db.js) (Prisma Client), [`backend/src/routes/victimRoutes.js`](https://github.com/rhithor/resq/blob/main/backend/src/routes/victimRoutes.js) (Victim Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Volunteer and Victim UI"]
  node_dashboard["Tactical Dashboard<br/>[page.js]"]
  node_map["Location Map<br/>[MapModal.jsx]"]
  node_alert["Audio Alerts<br/>[alert.mp3]"]
  node_sospage["SOS Screen<br/>[page.js]"]
  node_login["Login Screen<br/>[page.js]"]
end

subgraph group_api["Backend API"]
  node_server["Express and Socket.IO<br/>[server.js]"]
  node_victimroutes["Victim Routes<br/>[victimRoutes.js]"]
  node_volroutes["Volunteer Routes<br/>[volunteerRoutes.js]"]
  node_disroutes["Disaster Routes<br/>[disasterRoutes.js]"]
  node_authroutes["Auth Routes<br/>[authRoutes.js]"]
end

subgraph group_response["Rescue Operations"]
  node_victimctl["Victim Controller"]
  node_volctl["Volunteer Controller"]
  node_disctl["Disaster Controller"]
end

subgraph group_identity["Identity and Persistence"]
  node_oauth["Google OAuth<br/>[route.js]"]
  node_authctl["Auth Controller<br/>[authController.js]"]
  node_authmw["Access Control<br/>[authMiddleware.js]"]
  node_dbclient["Prisma Client<br/>[db.js]"]
  node_database[("PostgreSQL + PostGIS<br/>[schema.prisma]")]
end

node_victim(("Victim"))
node_volunteer(("Volunteer"))

node_victim -->|"reports SOS"| node_sospage
node_volunteer -->|"monitors incidents"| node_dashboard
node_dashboard -->|"views location"| node_map
node_dashboard -->|"plays cue"| node_alert
node_volunteer -->|"signs in"| node_login
node_login -->|"starts sign-in"| node_oauth
node_oauth -.->|"Google identity"| node_server
node_server -->|"mounts routes"| node_victimroutes
node_server -->|"mounts routes"| node_volroutes
node_server -->|"mounts routes"| node_disroutes
node_server -->|"mounts routes"| node_authroutes
node_victimroutes -->|"dispatches"| node_victimctl
node_volroutes -->|"dispatches"| node_volctl
node_disroutes -->|"dispatches"| node_disctl
node_authroutes -->|"dispatches"| node_authctl
node_victimroutes -->|"guards status"| node_authmw
node_volroutes -->|"guards access"| node_authmw
node_disroutes -->|"guards access"| node_authmw
node_victimctl -->|"queries and updates"| node_dbclient
node_volctl -->|"queries and updates"| node_dbclient
node_disctl -->|"queries and updates"| node_dbclient
node_authctl -->|"reads and writes"| node_dbclient
node_dbclient -->|"queries"| node_database
node_victimctl -->|"emits incident events"| node_server
node_disctl -->|"emits incident event"| node_server
node_server -.->|"broadcasts live alerts"| node_dashboard
node_dashboard -->|"pinpoints victims"| node_map

click node_dashboard "https://github.com/rhithor/resq/blob/main/frontend/src/app/dashboard/page.js"
click node_map "https://github.com/rhithor/resq/blob/main/frontend/src/app/dashboard/components/MapModal.jsx"
click node_alert "https://github.com/rhithor/resq/blob/main/frontend/src/app/dashboard/sounds/alert.mp3"
click node_sospage "https://github.com/rhithor/resq/blob/main/frontend/src/app/sos/page.js"
click node_login "https://github.com/rhithor/resq/blob/main/frontend/src/app/login/page.js"
click node_oauth "https://github.com/rhithor/resq/blob/main/frontend/src/app/api/auth/%5B...nextauth%5D/route.js"
click node_server "https://github.com/rhithor/resq/blob/main/backend/src/server.js"
click node_victimroutes "https://github.com/rhithor/resq/blob/main/backend/src/routes/victimRoutes.js"
click node_victimctl "https://github.com/rhithor/resq/blob/main/backend/src/controllers/victimController.js"
click node_volroutes "https://github.com/rhithor/resq/blob/main/backend/src/routes/volunteerRoutes.js"
click node_volctl "https://github.com/rhithor/resq/blob/main/backend/src/controllers/volunteerController.js"
click node_disroutes "https://github.com/rhithor/resq/blob/main/backend/src/routes/disasterRoutes.js"
click node_disctl "https://github.com/rhithor/resq/blob/main/backend/src/controllers/disasterController.js"
click node_authroutes "https://github.com/rhithor/resq/blob/main/backend/src/routes/authRoutes.js"
click node_authctl "https://github.com/rhithor/resq/blob/main/backend/src/controllers/authController.js"
click node_authmw "https://github.com/rhithor/resq/blob/main/backend/src/middleware/authMiddleware.js"
click node_dbclient "https://github.com/rhithor/resq/blob/main/backend/src/config/db.js"
click node_database "https://github.com/rhithor/resq/blob/main/backend/prisma/schema.prisma"

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_dashboard,node_map,node_alert,node_sospage,node_login toneBlue
class node_server,node_victimroutes,node_volroutes,node_disroutes,node_authroutes toneAmber
class node_victimctl,node_volctl,node_disctl toneMint
class node_oauth,node_authctl,node_authmw,node_dbclient,node_database toneRose
class node_victim,node_volunteer toneIndigo
```

## Components

### Volunteer and Victim UI

- [Tactical Dashboard](https://github.com/rhithor/resq/blob/main/frontend/src/app/dashboard/page.js): `frontend/src/app/dashboard/page.js`
- [Location Map](https://github.com/rhithor/resq/blob/main/frontend/src/app/dashboard/components/MapModal.jsx): `frontend/src/app/dashboard/components/MapModal.jsx`
- [Audio Alerts](https://github.com/rhithor/resq/blob/main/frontend/src/app/dashboard/sounds/alert.mp3): `frontend/src/app/dashboard/sounds/alert.mp3`
- [SOS Screen](https://github.com/rhithor/resq/blob/main/frontend/src/app/sos/page.js): `frontend/src/app/sos/page.js`
- [Login Screen](https://github.com/rhithor/resq/blob/main/frontend/src/app/login/page.js): `frontend/src/app/login/page.js`

### Backend API

- [Express and Socket.IO](https://github.com/rhithor/resq/blob/main/backend/src/server.js): `backend/src/server.js`
- [Victim Routes](https://github.com/rhithor/resq/blob/main/backend/src/routes/victimRoutes.js): `backend/src/routes/victimRoutes.js`
- [Volunteer Routes](https://github.com/rhithor/resq/blob/main/backend/src/routes/volunteerRoutes.js): `backend/src/routes/volunteerRoutes.js`
- [Disaster Routes](https://github.com/rhithor/resq/blob/main/backend/src/routes/disasterRoutes.js): `backend/src/routes/disasterRoutes.js`
- [Auth Routes](https://github.com/rhithor/resq/blob/main/backend/src/routes/authRoutes.js): `backend/src/routes/authRoutes.js`

### Rescue Operations

- [Victim Controller](https://github.com/rhithor/resq/blob/main/backend/src/controllers/victimController.js): `backend/src/controllers/victimController.js`
- [Volunteer Controller](https://github.com/rhithor/resq/blob/main/backend/src/controllers/volunteerController.js): `backend/src/controllers/volunteerController.js`
- [Disaster Controller](https://github.com/rhithor/resq/blob/main/backend/src/controllers/disasterController.js): `backend/src/controllers/disasterController.js`

### Identity and Persistence

- [Google OAuth](https://github.com/rhithor/resq/blob/main/frontend/src/app/api/auth/%5B...nextauth%5D/route.js): `frontend/src/app/api/auth/[...nextauth]/route.js`
- [Auth Controller](https://github.com/rhithor/resq/blob/main/backend/src/controllers/authController.js): `backend/src/controllers/authController.js`
- [Access Control](https://github.com/rhithor/resq/blob/main/backend/src/middleware/authMiddleware.js): `backend/src/middleware/authMiddleware.js`
- [Prisma Client](https://github.com/rhithor/resq/blob/main/backend/src/config/db.js): `backend/src/config/db.js`
- [PostgreSQL + PostGIS](https://github.com/rhithor/resq/blob/main/backend/prisma/schema.prisma): `backend/prisma/schema.prisma`

### Other components

- **Victim**
- **Volunteer**

## Connections

- Victim → SOS Screen: reports SOS
- Volunteer → Tactical Dashboard: monitors incidents
- Tactical Dashboard → Location Map: views location
- Tactical Dashboard → Audio Alerts: plays cue
- Volunteer → Login Screen: signs in
- Login Screen → Google OAuth: starts sign-in
- Google OAuth → Express and Socket.IO: Google identity
- Express and Socket.IO → Victim Routes: mounts routes
- Express and Socket.IO → Volunteer Routes: mounts routes
- Express and Socket.IO → Disaster Routes: mounts routes
- Express and Socket.IO → Auth Routes: mounts routes
- Victim Routes → Victim Controller: dispatches
- Volunteer Routes → Volunteer Controller: dispatches
- Disaster Routes → Disaster Controller: dispatches
- Auth Routes → Auth Controller: dispatches
- Victim Routes → Access Control: guards status
- Volunteer Routes → Access Control: guards access
- Disaster Routes → Access Control: guards access
- Victim Controller → Prisma Client: queries and updates
- Volunteer Controller → Prisma Client: queries and updates
- Disaster Controller → Prisma Client: queries and updates
- Auth Controller → Prisma Client: reads and writes
- Prisma Client → PostgreSQL + PostGIS: queries
- Victim Controller → Express and Socket.IO: emits incident events
- Disaster Controller → Express and Socket.IO: emits incident event
- Express and Socket.IO → Tactical Dashboard: broadcasts live alerts
- Tactical Dashboard → Location Map: pinpoints victims
