# anishp21/senior-powerpulse architecture

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

- Interactive diagram: https://gitdiagram.com/anishp21/senior-powerpulse
- Repository: https://github.com/anishp21/senior-powerpulse

## Overview

Senior PowerPulse is a privacy-focused outage check-in and disaster-triage app for residents, volunteers, and community officials. Residents register life-support needs and battery backup, then check in or request help; shared app state records cases for urgency-based volunteer response and official neighborhood oversight. The app also provides weather alerts, audit-log access, charging assistance, and offline/PWA support. The graph follows documented wiring from the app and context excerpts; unsampled features are represented only where the README or source index supports them.

Main entry points: [`src/context/AppContext.tsx`](https://github.com/anishp21/senior-powerpulse/blob/main/src/context/AppContext.tsx) (Emergency coordination state), [`src/App.tsx`](https://github.com/anishp21/senior-powerpulse/blob/main/src/App.tsx) (Role-based app), [`src/components/resident/ResidentView.tsx`](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/ResidentView.tsx) (Resident dashboard), [`src/context/AuthContext.tsx`](https://github.com/anishp21/senior-powerpulse/blob/main/src/context/AuthContext.tsx) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and identity"]
  node_app["Role-based app<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_login["Sign-in<br/>[LoginScreen.tsx]"]
  node_registration["Account registration<br/>[RegisterScreen.tsx]"]
end

subgraph group_resident["Resident safety workflow"]
  node_resident["Resident dashboard<br/>[ResidentView.tsx]"]
  node_onboarding["Device onboarding"]
  node_checkin["Help and check-in"]
  node_charging["Charging help"]
  node_privacy["Privacy audit logs"]
  node_alerts_ui["Plain-language alerts"]
end

subgraph group_response["Community response"]
  node_volunteer["Volunteer response desk<br/>[VolunteerView.tsx]"]
  node_official["Official overview<br/>[OfficialView.tsx]"]
end

subgraph group_shared["Shared services and data"]
  node_triage["Urgency scoring<br/>[urgency.ts]"]
  node_appstate["Emergency coordination state<br/>[AppContext.tsx]"]
  node_weather["Weather alerts and lookup<br/>[weather.ts]"]
  node_translations["Alert translations<br/>[translations.ts]"]
  node_notifications["Volunteer notifications<br/>[notifications.ts]"]
  node_neon["Database adapter<br/>[neon.ts]"]
  node_database[("Neon PostgreSQL<br/>[neon_schema.sql]")]
  node_mockdata["Demo scenario data<br/>[mockData.ts]"]
  node_serviceworker["Offline cache<br/>[sw.js]"]
end

node_browser(("App user"))
node_nws["National Weather Service"]

node_browser -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"renders"| node_login
node_app -->|"routes role"| node_resident
node_app -->|"routes role"| node_volunteer
node_app -->|"routes role"| node_official
node_app -->|"opens"| node_alerts_ui
node_app -->|"opens"| node_privacy
node_login -->|"signs in"| node_auth
node_registration -.->|"creates account"| node_auth
node_registration -.->|"collects resident data"| node_onboarding
node_resident -.->|"opens setup"| node_onboarding
node_resident -.->|"requests help"| node_checkin
node_resident -->|"requests charging"| node_charging
node_resident -->|"reads state"| node_appstate
node_checkin -->|"submits request"| node_appstate
node_charging -->|"updates request"| node_appstate
node_privacy -->|"reads logs"| node_appstate
node_alerts_ui -->|"uses translations"| node_translations
node_volunteer -->|"handles cases"| node_appstate
node_volunteer -->|"requests permission"| node_notifications
node_official -->|"reads overview"| node_appstate
node_appstate -->|"scores urgency"| node_triage
node_appstate -->|"loads alerts"| node_weather
node_appstate -->|"persists records"| node_neon
node_appstate -->|"loads demo state"| node_mockdata
node_auth -->|"saves profile"| node_neon
node_neon -->|"reads and writes"| node_database
node_weather -->|"fetches alerts"| node_nws
node_app -->|"registers offline support"| node_serviceworker

click node_app "https://github.com/anishp21/senior-powerpulse/blob/main/src/App.tsx"
click node_auth "https://github.com/anishp21/senior-powerpulse/blob/main/src/context/AuthContext.tsx"
click node_login "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/auth/LoginScreen.tsx"
click node_registration "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/auth/RegisterScreen.tsx"
click node_resident "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/ResidentView.tsx"
click node_onboarding "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/OnboardingModal.tsx"
click node_checkin "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/HelpRequestModal.tsx"
click node_charging "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/ChargingHelpModal.tsx"
click node_privacy "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/PrivacyLogsModal.tsx"
click node_alerts_ui "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/alerts/PlainLanguageAlertScreen.tsx"
click node_volunteer "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/volunteer/VolunteerView.tsx"
click node_official "https://github.com/anishp21/senior-powerpulse/blob/main/src/components/official/OfficialView.tsx"
click node_triage "https://github.com/anishp21/senior-powerpulse/blob/main/src/lib/urgency.ts"
click node_appstate "https://github.com/anishp21/senior-powerpulse/blob/main/src/context/AppContext.tsx"
click node_weather "https://github.com/anishp21/senior-powerpulse/blob/main/src/lib/weather.ts"
click node_translations "https://github.com/anishp21/senior-powerpulse/blob/main/src/data/translations.ts"
click node_notifications "https://github.com/anishp21/senior-powerpulse/blob/main/src/lib/notifications.ts"
click node_neon "https://github.com/anishp21/senior-powerpulse/blob/main/src/lib/neon.ts"
click node_database "https://github.com/anishp21/senior-powerpulse/blob/main/neon_schema.sql"
click node_mockdata "https://github.com/anishp21/senior-powerpulse/blob/main/src/data/mockData.ts"
click node_serviceworker "https://github.com/anishp21/senior-powerpulse/blob/main/public/sw.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_auth,node_login,node_registration,node_browser toneBlue
class node_resident,node_onboarding,node_checkin,node_charging,node_privacy,node_alerts_ui toneAmber
class node_volunteer,node_official toneMint
class node_triage,node_appstate,node_weather,node_translations,node_notifications,node_neon,node_database,node_mockdata,node_serviceworker toneRose
class node_nws toneIndigo
```

## Components

### App entry and identity

- [Role-based app](https://github.com/anishp21/senior-powerpulse/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/anishp21/senior-powerpulse/blob/main/src/context/AuthContext.tsx): `src/context/AuthContext.tsx`
- [Sign-in](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/auth/LoginScreen.tsx): `src/components/auth/LoginScreen.tsx`
- [Account registration](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/auth/RegisterScreen.tsx): `src/components/auth/RegisterScreen.tsx`

### Resident safety workflow

- [Resident dashboard](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/ResidentView.tsx): `src/components/resident/ResidentView.tsx`
- [Device onboarding](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/OnboardingModal.tsx): `src/components/resident/OnboardingModal.tsx`
- [Help and check-in](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/HelpRequestModal.tsx): `src/components/resident/HelpRequestModal.tsx`
- [Charging help](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/ChargingHelpModal.tsx): `src/components/resident/ChargingHelpModal.tsx`
- [Privacy audit logs](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/resident/PrivacyLogsModal.tsx): `src/components/resident/PrivacyLogsModal.tsx`
- [Plain-language alerts](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/alerts/PlainLanguageAlertScreen.tsx): `src/components/alerts/PlainLanguageAlertScreen.tsx`

### Community response

- [Volunteer response desk](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/volunteer/VolunteerView.tsx): `src/components/volunteer/VolunteerView.tsx`
- [Official overview](https://github.com/anishp21/senior-powerpulse/blob/main/src/components/official/OfficialView.tsx): `src/components/official/OfficialView.tsx`

### Shared services and data

- [Urgency scoring](https://github.com/anishp21/senior-powerpulse/blob/main/src/lib/urgency.ts): `src/lib/urgency.ts`
- [Emergency coordination state](https://github.com/anishp21/senior-powerpulse/blob/main/src/context/AppContext.tsx): `src/context/AppContext.tsx`
- [Weather alerts and lookup](https://github.com/anishp21/senior-powerpulse/blob/main/src/lib/weather.ts): `src/lib/weather.ts`
- [Alert translations](https://github.com/anishp21/senior-powerpulse/blob/main/src/data/translations.ts): `src/data/translations.ts`
- [Volunteer notifications](https://github.com/anishp21/senior-powerpulse/blob/main/src/lib/notifications.ts): `src/lib/notifications.ts`
- [Database adapter](https://github.com/anishp21/senior-powerpulse/blob/main/src/lib/neon.ts): `src/lib/neon.ts`
- [Neon PostgreSQL](https://github.com/anishp21/senior-powerpulse/blob/main/neon_schema.sql): `neon_schema.sql`
- [Demo scenario data](https://github.com/anishp21/senior-powerpulse/blob/main/src/data/mockData.ts): `src/data/mockData.ts`
- [Offline cache](https://github.com/anishp21/senior-powerpulse/blob/main/public/sw.js): `public/sw.js`

### Other components

- **App user**
- **National Weather Service**

## Connections

- App user → Role-based app: uses (evidence: `README.md`)
- Role-based app → Authentication: provides auth (evidence: `src/App.tsx`)
- Role-based app → Sign-in: renders (evidence: `src/App.tsx`)
- Role-based app → Resident dashboard: routes role (evidence: `src/App.tsx`)
- Role-based app → Volunteer response desk: routes role (evidence: `src/App.tsx`)
- Role-based app → Official overview: routes role (evidence: `src/App.tsx`)
- Role-based app → Plain-language alerts: opens (evidence: `src/App.tsx`)
- Role-based app → Privacy audit logs: opens (evidence: `src/App.tsx`)
- Sign-in → Authentication: signs in (evidence: `src/components/auth/LoginScreen.tsx`)
- Account registration → Authentication: creates account
- Account registration → Device onboarding: collects resident data
- Resident dashboard → Device onboarding: opens setup
- Resident dashboard → Help and check-in: requests help
- Resident dashboard → Charging help: requests charging (evidence: `src/components/resident/ChargingHelpModal.tsx`)
- Resident dashboard → Emergency coordination state: reads state (evidence: `src/components/resident/ResidentView.tsx`)
- Help and check-in → Emergency coordination state: submits request (evidence: `src/components/resident/HelpRequestModal.tsx`)
- Charging help → Emergency coordination state: updates request (evidence: `src/components/resident/ChargingHelpModal.tsx`)
- Privacy audit logs → Emergency coordination state: reads logs (evidence: `src/components/resident/PrivacyLogsModal.tsx`)
- Plain-language alerts → Alert translations: uses translations (evidence: `src/components/alerts/PlainLanguageAlertScreen.tsx`)
- Volunteer response desk → Emergency coordination state: handles cases (evidence: `src/components/volunteer/VolunteerView.tsx`)
- Volunteer response desk → Volunteer notifications: requests permission (evidence: `src/components/volunteer/VolunteerView.tsx`)
- Official overview → Emergency coordination state: reads overview (evidence: `src/components/official/OfficialView.tsx`)
- Emergency coordination state → Urgency scoring: scores urgency (evidence: `src/context/AppContext.tsx`)
- Emergency coordination state → Weather alerts and lookup: loads alerts (evidence: `src/context/AppContext.tsx`)
- Emergency coordination state → Database adapter: persists records (evidence: `src/context/AppContext.tsx`)
- Emergency coordination state → Demo scenario data: loads demo state (evidence: `src/context/AppContext.tsx`)
- Authentication → Database adapter: saves profile (evidence: `src/context/AuthContext.tsx`)
- Database adapter → Neon PostgreSQL: reads and writes (evidence: `src/lib/neon.ts`)
- Weather alerts and lookup → National Weather Service: fetches alerts (evidence: `README.md`)
- Role-based app → Offline cache: registers offline support
