# thushara-bajimar/avinya-2026 architecture

> Architecture diagram of the GitHub repository thushara-bajimar/avinya-2026, 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/thushara-bajimar/avinya-2026
- Repository: https://github.com/thushara-bajimar/avinya-2026

## Overview

AVINYA connects an unregistered bystander’s emergency alert to nearby verified responders, then coordinates acceptance, location, status, first-aid guidance, and ambulance arrival. The frontend also supports responder registration and administrative verification. The README documents matching, proximity/ETA, radius expansion, and ambulance assistance; those backend details are shown as documented relationships because the server excerpt is incomplete. Source excerpts confirm selected UI composition, SQLite use, and Socket.IO client events, but do not expose all server routes or dispatch internals.

Main entry points: [`src/components/AlertSentScreen.jsx`](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/AlertSentScreen.jsx) (Alert monitoring), [`server/index.js`](https://github.com/thushara-bajimar/avinya-2026/blob/main/server/index.js) (HTTP and event server), [`src/components/EmergencyFlow.jsx`](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/EmergencyFlow.jsx) (Alert workflow), [`src/App.jsx`](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/App.jsx) (Application shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Emergency client"]
  node_app["Application shell<br/>[App.jsx]"]
  node_emergency_flow["Alert workflow<br/>[EmergencyFlow.jsx]"]
  node_alert_screen["Alert monitoring"]
  node_emergency_form["Emergency details"]
  node_map["Location map<br/>[EmergencyMap.jsx]"]
  node_first_aid["First-aid guidance"]
  node_time["Emergency time<br/>[emergencyTime.js]"]
  node_socket_client["Live event client<br/>[socket.js]"]
end

subgraph group_response["Response coordination"]
  node_responder_dashboard["Responder dashboard"]
  node_response_engine["Matching and dispatch<br/>[README.md]"]
  node_api["HTTP and event server<br/>[index.js]"]
end

subgraph group_trust["Responder trust"]
  node_admin["Admin verification"]
  node_registration["Responder registration"]
end

subgraph group_persistence["Persistence"]
  node_database[("SQLite records<br/>[db.js]")]
end

node_bystander(("Bystander"))
node_professional(("Emergency services"))

node_bystander -->|"opens platform"| node_app
node_app -->|"renders alert flow"| node_emergency_flow
node_emergency_flow -.->|"uses details form"| node_emergency_form
node_emergency_flow -->|"renders sent alert"| node_alert_screen
node_emergency_flow -->|"renders map"| node_map
node_alert_screen -->|"renders map"| node_map
node_alert_screen -->|"loads guidance"| node_first_aid
node_alert_screen -->|"formats times"| node_time
node_alert_screen -->|"joins live events"| node_socket_client
node_emergency_flow -.->|"submits emergency"| node_api
node_api -->|"reads and writes"| node_database
node_api -->|"matches and dispatches"| node_response_engine
node_response_engine -->|"alerts responders"| node_responder_dashboard
node_responder_dashboard -->|"renders locations"| node_map
node_responder_dashboard -->|"joins responder events"| node_socket_client
node_responder_dashboard -->|"formats times"| node_time
node_app -->|"renders registration"| node_registration
node_app -->|"renders verification"| node_admin
node_registration -.->|"registers responder"| node_api
node_admin -.->|"verifies responder"| node_api
node_alert_screen -.->|"requests guidance and updates"| node_api
node_api -.->|"sends live updates"| node_socket_client
node_bystander -->|"calls for help"| node_professional
node_alert_screen -.->|"reports ambulance arrival"| node_professional

click node_app "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/App.jsx"
click node_emergency_flow "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/EmergencyFlow.jsx"
click node_alert_screen "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/AlertSentScreen.jsx"
click node_emergency_form "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/EmergencyAlertForm.jsx"
click node_map "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/EmergencyMap.jsx"
click node_first_aid "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/lib/firstAidGuidance.js"
click node_time "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/lib/emergencyTime.js"
click node_socket_client "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/lib/socket.js"
click node_responder_dashboard "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/ResponderDashboard.jsx"
click node_response_engine "https://github.com/thushara-bajimar/avinya-2026/blob/main/README.md"
click node_admin "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/AdminVerification.jsx"
click node_registration "https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/ResponderRegistration.jsx"
click node_api "https://github.com/thushara-bajimar/avinya-2026/blob/main/server/index.js"
click node_database "https://github.com/thushara-bajimar/avinya-2026/blob/main/server/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_app,node_emergency_flow,node_alert_screen,node_emergency_form,node_map,node_first_aid,node_time,node_socket_client toneBlue
class node_responder_dashboard,node_response_engine,node_api toneAmber
class node_admin,node_registration toneMint
class node_database toneRose
class node_bystander,node_professional toneIndigo
```

## Components

### Emergency client

- [Application shell](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/App.jsx): `src/App.jsx`
- [Alert workflow](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/EmergencyFlow.jsx): `src/components/EmergencyFlow.jsx`
- [Alert monitoring](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/AlertSentScreen.jsx): `src/components/AlertSentScreen.jsx`
- [Emergency details](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/EmergencyAlertForm.jsx): `src/components/EmergencyAlertForm.jsx`
- [Location map](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/EmergencyMap.jsx): `src/components/EmergencyMap.jsx`
- [First-aid guidance](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/lib/firstAidGuidance.js): `src/lib/firstAidGuidance.js`
- [Emergency time](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/lib/emergencyTime.js): `src/lib/emergencyTime.js`
- [Live event client](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/lib/socket.js): `src/lib/socket.js`

### Response coordination

- [Responder dashboard](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/ResponderDashboard.jsx): `src/components/ResponderDashboard.jsx`
- [Matching and dispatch](https://github.com/thushara-bajimar/avinya-2026/blob/main/README.md): `README.md`
- [HTTP and event server](https://github.com/thushara-bajimar/avinya-2026/blob/main/server/index.js): `server/index.js`

### Responder trust

- [Admin verification](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/AdminVerification.jsx): `src/components/AdminVerification.jsx`
- [Responder registration](https://github.com/thushara-bajimar/avinya-2026/blob/main/src/components/ResponderRegistration.jsx): `src/components/ResponderRegistration.jsx`

### Persistence

- [SQLite records](https://github.com/thushara-bajimar/avinya-2026/blob/main/server/db.js): `server/db.js`

### Other components

- **Bystander**
- **Emergency services**

## Connections

- Bystander → Application shell: opens platform (evidence: `README.md`)
- Application shell → Alert workflow: renders alert flow (evidence: `src/App.jsx`)
- Alert workflow → Emergency details: uses details form
- Alert workflow → Alert monitoring: renders sent alert (evidence: `src/components/EmergencyFlow.jsx`)
- Alert workflow → Location map: renders map (evidence: `src/components/EmergencyFlow.jsx`)
- Alert monitoring → Location map: renders map (evidence: `src/components/AlertSentScreen.jsx`)
- Alert monitoring → First-aid guidance: loads guidance (evidence: `src/components/AlertSentScreen.jsx`)
- Alert monitoring → Emergency time: formats times (evidence: `src/components/AlertSentScreen.jsx`)
- Alert monitoring → Live event client: joins live events (evidence: `src/components/AlertSentScreen.jsx`)
- Alert workflow → HTTP and event server: submits emergency
- HTTP and event server → SQLite records: reads and writes (evidence: `server/index.js`)
- HTTP and event server → Matching and dispatch: matches and dispatches (evidence: `README.md`)
- Matching and dispatch → Responder dashboard: alerts responders (evidence: `README.md`)
- Responder dashboard → Location map: renders locations (evidence: `src/components/ResponderDashboard.jsx`)
- Responder dashboard → Live event client: joins responder events (evidence: `src/components/ResponderDashboard.jsx`)
- Responder dashboard → Emergency time: formats times (evidence: `src/components/ResponderDashboard.jsx`)
- Application shell → Responder registration: renders registration (evidence: `src/App.jsx`)
- Application shell → Admin verification: renders verification (evidence: `src/App.jsx`)
- Responder registration → HTTP and event server: registers responder
- Admin verification → HTTP and event server: verifies responder
- Alert monitoring → HTTP and event server: requests guidance and updates
- HTTP and event server → Live event client: sends live updates
- Bystander → Emergency services: calls for help (evidence: `README.md`)
- Alert monitoring → Emergency services: reports ambulance arrival
