# bragee7/z_new_voice_model-04-10-26- architecture

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

- Interactive diagram: https://gitdiagram.com/bragee7/z_new_voice_model-04-10-26-
- Repository: https://github.com/bragee7/z_new_voice_model-04-10-26-

## Overview

Women Safety Guardian handles emergency alerts and police case response, with web administration and an Android app. The documented user flow is voice or button SOS, location and media capture, alert submission, then police review, notes, and resolution. The web client also provides login, case management, maps, profiles, contacts, and administrative reporting. Source excerpts show web routing and server route registration; mobile implementation details and many client-to-API calls are not sampled, so those relationships rely on README documentation.

Main entry points: [`client/src/App.jsx`](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/App.jsx) (Web app routing), [`server/routes/sos.js`](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/sos.js) (SOS case API), [`server/routes/admin.js`](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/admin.js) (Admin API), [`server/index.js`](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/index.js) (API server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_webapp["Web app routing<br/>[App.jsx]"]
  node_authentication["Session and login<br/>[AuthContext.jsx]"]
  node_caseviews["Police case views"]
  node_casedetails["Case details<br/>[CaseDetails.jsx]"]
  node_profile["Profile management<br/>[Profile.jsx]"]
  node_maps["Maps and sharing<br/>[MapView.jsx]"]
end

subgraph group_response["Emergency response"]
  node_floating["Web SOS button"]
  node_mobile["Android safety app"]
  node_powerguard["Power-press guard"]
  node_powerreceiver["Power-press detection"]
  node_sosapi["SOS case API<br/>[sos.js]"]
  node_contactsapi["Contacts API<br/>[contacts.js]"]
  node_preferencesapi["Voice preferences API<br/>[preferences.js]"]
  node_stations["Station lookup"]
end

subgraph group_admin["Administration"]
  node_admindash["Admin reporting<br/>[AdminDashboard.jsx]"]
  node_admincases["Admin case management<br/>[AdminCases.jsx]"]
  node_adminusers["Admin user management<br/>[AdminUsers.jsx]"]
  node_audit["Audit log views<br/>[AdminAuditLog.jsx]"]
  node_adminapi["Admin API<br/>[admin.js]"]
end

subgraph group_platform["Backend platform"]
  node_server["API server<br/>[index.js]"]
  node_authapi["Authentication API<br/>[auth.js]"]
  node_authmw["JWT authorization<br/>[auth.js]"]
  node_database[("PostgreSQL store<br/>[db.js]")]
  node_config["Runtime configuration<br/>[index.js]"]
end

node_users(("Users"))
node_police(("Police staff"))
node_overpass["OpenStreetMap Overpass"]

node_webapp -->|"provides session"| node_authentication
node_webapp -->|"routes to"| node_caseviews
node_webapp -->|"routes to"| node_casedetails
node_webapp -->|"routes to"| node_profile
node_webapp -->|"renders"| node_floating
node_users -.->|"triggers SOS"| node_mobile
node_users -->|"triggers SOS"| node_floating
node_mobile -.->|"runs guard"| node_powerguard
node_powerguard -->|"registers receiver"| node_powerreceiver
node_powerreceiver -.->|"submits alert"| node_sosapi
node_mobile -.->|"submits SOS"| node_sosapi
node_floating -.->|"submits alert"| node_sosapi
node_sosapi -.->|"stores cases"| node_database
node_sosapi -.->|"looks up station"| node_stations
node_stations -->|"queries stations"| node_overpass
node_police -->|"reviews cases"| node_caseviews
node_caseviews -.->|"fetches cases"| node_sosapi
node_police -->|"updates cases"| node_casedetails
node_casedetails -.->|"reads and updates"| node_sosapi
node_casedetails -->|"shows locations"| node_maps
node_mobile -.->|"manages contacts"| node_contactsapi
node_mobile -.->|"syncs phrases"| node_preferencesapi
node_webapp -->|"routes to"| node_admindash
node_webapp -->|"routes to"| node_admincases
node_webapp -->|"routes to"| node_adminusers
node_webapp -->|"routes to"| node_audit
node_admindash -.->|"requests statistics"| node_adminapi
node_admincases -.->|"manages cases"| node_adminapi
node_adminusers -.->|"manages users"| node_adminapi
node_audit -.->|"reads audit data"| node_adminapi
node_server -->|"mounts routes"| node_authapi
node_server -->|"mounts routes"| node_sosapi
node_server -->|"mounts routes"| node_contactsapi
node_server -->|"mounts routes"| node_adminapi
node_server -->|"mounts routes"| node_preferencesapi
node_authapi -.->|"reads and writes"| node_database
node_authapi -.->|"uses authorization"| node_authmw
node_adminapi -->|"queries records"| node_database
node_adminapi -->|"checks access"| node_authmw
node_server -->|"loads settings"| node_config

click node_webapp "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/App.jsx"
click node_authentication "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/context/AuthContext.jsx"
click node_caseviews "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/PoliceDashboard.jsx"
click node_casedetails "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/CaseDetails.jsx"
click node_profile "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/Profile.jsx"
click node_maps "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/components/MapView.jsx"
click node_floating "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/components/FloatingSosButton.jsx"
click node_mobile "https://github.com/bragee7/z_new_voice_model-04-10-26-/tree/main/mobile/android"
click node_powerguard "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/mobile/android/app/src/main/kotlin/com/zelda/zelda_guardian/PowerGuardService.kt"
click node_powerreceiver "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/mobile/android/app/src/main/kotlin/com/zelda/zelda_guardian/PowerPressReceiver.kt"
click node_sosapi "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/sos.js"
click node_contactsapi "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/contacts.js"
click node_preferencesapi "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/preferences.js"
click node_stations "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/services/policeStationService.js"
click node_admindash "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/AdminDashboard.jsx"
click node_admincases "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/AdminCases.jsx"
click node_adminusers "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/AdminUsers.jsx"
click node_audit "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/AdminAuditLog.jsx"
click node_adminapi "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/admin.js"
click node_server "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/index.js"
click node_authapi "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/auth.js"
click node_authmw "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/middleware/auth.js"
click node_database "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/db.js"
click node_config "https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/config/index.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_webapp,node_authentication,node_caseviews,node_casedetails,node_profile,node_maps,node_users toneBlue
class node_floating,node_mobile,node_powerguard,node_powerreceiver,node_sosapi,node_contactsapi,node_preferencesapi,node_stations toneAmber
class node_admindash,node_admincases,node_adminusers,node_audit,node_adminapi toneMint
class node_server,node_authapi,node_authmw,node_database,node_config toneRose
class node_police,node_overpass toneIndigo
```

## Components

### Web client

- [Web app routing](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Session and login](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [Police case views](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/PoliceDashboard.jsx): `client/src/pages/PoliceDashboard.jsx`
- [Case details](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/CaseDetails.jsx): `client/src/pages/CaseDetails.jsx`
- [Profile management](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/Profile.jsx): `client/src/pages/Profile.jsx`
- [Maps and sharing](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/components/MapView.jsx): `client/src/components/MapView.jsx`

### Emergency response

- [Web SOS button](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/components/FloatingSosButton.jsx): `client/src/components/FloatingSosButton.jsx`
- [Android safety app](https://github.com/bragee7/z_new_voice_model-04-10-26-/tree/main/mobile/android): `mobile/android`
- [Power-press guard](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/mobile/android/app/src/main/kotlin/com/zelda/zelda_guardian/PowerGuardService.kt): `mobile/android/app/src/main/kotlin/com/zelda/zelda_guardian/PowerGuardService.kt`
- [Power-press detection](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/mobile/android/app/src/main/kotlin/com/zelda/zelda_guardian/PowerPressReceiver.kt): `mobile/android/app/src/main/kotlin/com/zelda/zelda_guardian/PowerPressReceiver.kt`
- [SOS case API](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/sos.js): `server/routes/sos.js`
- [Contacts API](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/contacts.js): `server/routes/contacts.js`
- [Voice preferences API](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/preferences.js): `server/routes/preferences.js`
- [Station lookup](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/services/policeStationService.js): `server/services/policeStationService.js`

### Administration

- [Admin reporting](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/AdminDashboard.jsx): `client/src/pages/AdminDashboard.jsx`
- [Admin case management](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/AdminCases.jsx): `client/src/pages/AdminCases.jsx`
- [Admin user management](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/AdminUsers.jsx): `client/src/pages/AdminUsers.jsx`
- [Audit log views](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/client/src/pages/AdminAuditLog.jsx): `client/src/pages/AdminAuditLog.jsx`
- [Admin API](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/admin.js): `server/routes/admin.js`

### Backend platform

- [API server](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/index.js): `server/index.js`
- [Authentication API](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/routes/auth.js): `server/routes/auth.js`
- [JWT authorization](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/middleware/auth.js): `server/middleware/auth.js`
- [PostgreSQL store](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/db.js): `server/db.js`
- [Runtime configuration](https://github.com/bragee7/z_new_voice_model-04-10-26-/blob/main/server/config/index.js): `server/config/index.js`

### Other components

- **Users**
- **Police staff**
- **OpenStreetMap Overpass**

## Connections

- Web app routing → Session and login: provides session (evidence: `client/src/App.jsx`)
- Web app routing → Police case views: routes to (evidence: `client/src/App.jsx`)
- Web app routing → Case details: routes to (evidence: `client/src/App.jsx`)
- Web app routing → Profile management: routes to (evidence: `client/src/App.jsx`)
- Web app routing → Web SOS button: renders (evidence: `client/src/App.jsx`)
- Users → Android safety app: triggers SOS (evidence: `README.md`)
- Users → Web SOS button: triggers SOS (evidence: `README.md`)
- Android safety app → Power-press guard: runs guard (evidence: `mobile/android/app/src/main/kotlin/com/zelda/zelda_guardian/PowerGuardService.kt`)
- Power-press guard → Power-press detection: registers receiver (evidence: `mobile/android/app/src/main/kotlin/com/zelda/zelda_guardian/PowerGuardService.kt`)
- Power-press detection → SOS case API: submits alert
- Android safety app → SOS case API: submits SOS (evidence: `README.md`)
- Web SOS button → SOS case API: submits alert (evidence: `README.md`)
- SOS case API → PostgreSQL store: stores cases
- SOS case API → Station lookup: looks up station
- Station lookup → OpenStreetMap Overpass: queries stations (evidence: `server/services/policeStationService.js`)
- Police staff → Police case views: reviews cases (evidence: `README.md`)
- Police case views → SOS case API: fetches cases (evidence: `README.md`)
- Police staff → Case details: updates cases (evidence: `README.md`)
- Case details → SOS case API: reads and updates (evidence: `README.md`)
- Case details → Maps and sharing: shows locations (evidence: `README.md`)
- Android safety app → Contacts API: manages contacts (evidence: `README.md`)
- Android safety app → Voice preferences API: syncs phrases (evidence: `README.md`)
- Web app routing → Admin reporting: routes to (evidence: `client/src/App.jsx`)
- Web app routing → Admin case management: routes to (evidence: `client/src/App.jsx`)
- Web app routing → Admin user management: routes to (evidence: `client/src/App.jsx`)
- Web app routing → Audit log views: routes to (evidence: `client/src/App.jsx`)
- Admin reporting → Admin API: requests statistics (evidence: `README.md`)
- Admin case management → Admin API: manages cases (evidence: `README.md`)
- Admin user management → Admin API: manages users
- Audit log views → Admin API: reads audit data (evidence: `README.md`)
- API server → Authentication API: mounts routes (evidence: `server/index.js`)
- API server → SOS case API: mounts routes (evidence: `server/index.js`)
- API server → Contacts API: mounts routes (evidence: `server/index.js`)
- API server → Admin API: mounts routes (evidence: `server/index.js`)
- API server → Voice preferences API: mounts routes (evidence: `server/index.js`)
- Authentication API → PostgreSQL store: reads and writes
- Authentication API → JWT authorization: uses authorization
- Admin API → PostgreSQL store: queries records (evidence: `server/routes/admin.js`)
- Admin API → JWT authorization: checks access (evidence: `server/routes/admin.js`)
- API server → Runtime configuration: loads settings (evidence: `server/index.js`)
