# dearseolhwa/uni-guard architecture

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

- Interactive diagram: https://gitdiagram.com/dearseolhwa/uni-guard
- Repository: https://github.com/dearseolhwa/uni-guard

## Overview

UniGuard is a prototype for community disaster information and response: residents and local officials use a browser-based app for reporting, alerts, assistance, preparedness information, and road updates. The central runtime controller handles user actions and delegates database work to a repository that supports Supabase and a local/offline mode. The tree also shows account management and notification delivery services. Source excerpts are partial, so some feature modules are shown without inferred call relationships.

Main entry points: [`final yata/js/screens.js`](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/screens.js) (Mobile screens), [`final yata/js/screens.web.js`](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/screens.web.js) (Web screens), [`final yata/js/app.js`](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/app.js) (App controller), [`final yata/js/repo.js`](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/repo.js) (Data repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["App controller<br/>[app.js]"]
  node_authui["Account screens<br/>[screens.auth.js]"]
  node_mobileui["Mobile screens<br/>[screens.js]"]
  node_webui["Web screens<br/>[screens.web.js]"]
end

subgraph group_features["Response features"]
  node_geo["Location services<br/>[geo.js]"]
  node_map["Hazard map<br/>[map.js]"]
  node_hazards["Hazard types<br/>[hazard-types.js]"]
  node_sos["SOS reporting<br/>[sos.js]"]
  node_urgent["Urgent alerts<br/>[urgent-alerts.js]"]
  node_relief["Relief assistance<br/>[relief.js]"]
  node_roadwork["Road updates<br/>[roadwork.js]"]
  node_guides["Preparedness guides<br/>[guides.js]"]
  node_faqs["Help center<br/>[faqs.js]"]
end

subgraph group_data["Data and identity"]
  node_auth["Authentication<br/>[auth.js]"]
  node_repo["Data repository<br/>[repo.js]"]
  node_supabase[("Supabase backend")]
  node_adminusers["Admin user service<br/>[index.ts]"]
end

subgraph group_delivery["Notification delivery"]
  node_notifications["Notification store"]
  node_pwa["Offline and PWA<br/>[pwa.js]"]
  node_sw["Service worker<br/>[sw.js]"]
  node_push["Push dispatch<br/>[index.ts]"]
  node_sms["SMS fallback<br/>[index.ts]"]
end

node_resident(("Resident or official"))

node_resident -->|"uses"| node_app
node_app -->|"loads data"| node_repo
node_app -->|"reverse geocodes"| node_geo
node_auth -->|"reads profiles"| node_repo
node_repo -->|"reads and writes"| node_supabase
node_mobileui -->|"renders relief"| node_relief
node_mobileui -->|"renders guides"| node_guides
node_mobileui -->|"renders FAQs"| node_faqs
node_webui -->|"renders relief"| node_relief
node_webui -->|"renders guides"| node_guides
node_webui -->|"renders FAQs"| node_faqs
node_push -->|"invokes fallback"| node_sms
node_sw -.->|"handles payload"| node_push

click node_app "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/app.js"
click node_authui "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/screens.auth.js"
click node_mobileui "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/screens.js"
click node_webui "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/screens.web.js"
click node_auth "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/auth.js"
click node_repo "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/repo.js"
click node_geo "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/geo.js"
click node_map "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/map.js"
click node_hazards "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/hazard-types.js"
click node_sos "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/sos.js"
click node_urgent "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/urgent-alerts.js"
click node_relief "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/relief.js"
click node_roadwork "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/roadwork.js"
click node_guides "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/guides.js"
click node_faqs "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/faqs.js"
click node_notifications "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/notifications-store.js"
click node_pwa "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/pwa.js"
click node_sw "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/sw.js"
click node_push "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/supabase/functions/push-dispatch/index.ts"
click node_sms "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/supabase/functions/sms-fallback/index.ts"
click node_adminusers "https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/supabase/functions/admin-users/index.ts"

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_authui,node_mobileui,node_webui toneBlue
class node_geo,node_map,node_hazards,node_sos,node_urgent,node_relief,node_roadwork,node_guides,node_faqs toneAmber
class node_auth,node_repo,node_supabase,node_adminusers toneMint
class node_notifications,node_pwa,node_sw,node_push,node_sms toneRose
class node_resident toneIndigo
```

## Components

### Web application

- [App controller](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/app.js): `final yata/js/app.js`
- [Account screens](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/screens.auth.js): `final yata/js/screens.auth.js`
- [Mobile screens](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/screens.js): `final yata/js/screens.js`
- [Web screens](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/screens.web.js): `final yata/js/screens.web.js`

### Response features

- [Location services](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/geo.js): `final yata/js/geo.js`
- [Hazard map](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/map.js): `final yata/js/map.js`
- [Hazard types](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/hazard-types.js): `final yata/js/hazard-types.js`
- [SOS reporting](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/sos.js): `final yata/js/sos.js`
- [Urgent alerts](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/urgent-alerts.js): `final yata/js/urgent-alerts.js`
- [Relief assistance](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/relief.js): `final yata/js/relief.js`
- [Road updates](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/roadwork.js): `final yata/js/roadwork.js`
- [Preparedness guides](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/guides.js): `final yata/js/guides.js`
- [Help center](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/faqs.js): `final yata/js/faqs.js`

### Data and identity

- [Authentication](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/auth.js): `final yata/js/auth.js`
- [Data repository](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/repo.js): `final yata/js/repo.js`
- **Supabase backend**
- [Admin user service](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/supabase/functions/admin-users/index.ts): `final yata/supabase/functions/admin-users/index.ts`

### Notification delivery

- [Notification store](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/notifications-store.js): `final yata/js/notifications-store.js`
- [Offline and PWA](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/js/pwa.js): `final yata/js/pwa.js`
- [Service worker](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/sw.js): `final yata/sw.js`
- [Push dispatch](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/supabase/functions/push-dispatch/index.ts): `final yata/supabase/functions/push-dispatch/index.ts`
- [SMS fallback](https://github.com/dearseolhwa/uni-guard/blob/login-page/final%20yata/supabase/functions/sms-fallback/index.ts): `final yata/supabase/functions/sms-fallback/index.ts`

### Other components

- **Resident or official**

## Connections

- Resident or official → App controller: uses
- App controller → Data repository: loads data (evidence: `final yata/js/app.js`)
- App controller → Location services: reverse geocodes (evidence: `final yata/js/app.js`)
- Authentication → Data repository: reads profiles (evidence: `final yata/js/auth.js`)
- Data repository → Supabase backend: reads and writes (evidence: `final yata/js/repo.js`)
- Mobile screens → Relief assistance: renders relief (evidence: `final yata/js/screens.js`)
- Mobile screens → Preparedness guides: renders guides (evidence: `final yata/js/screens.js`)
- Mobile screens → Help center: renders FAQs (evidence: `final yata/js/screens.js`)
- Web screens → Relief assistance: renders relief (evidence: `final yata/js/screens.web.js`)
- Web screens → Preparedness guides: renders guides (evidence: `final yata/js/screens.web.js`)
- Web screens → Help center: renders FAQs (evidence: `final yata/js/screens.web.js`)
- Push dispatch → SMS fallback: invokes fallback (evidence: `final yata/supabase/functions/push-dispatch/index.ts`)
- Service worker → Push dispatch: handles payload (evidence: `final yata/sw.js`)
