# caseyyygg/bahaba-official architecture

> Architecture diagram of the GitHub repository caseyyygg/bahaba-official, 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/caseyyygg/bahaba-official
- Repository: https://github.com/caseyyygg/bahaba-official

## Overview

Bahaba is a location-based flood information and response web app. Users sign up or log in, select a location, then view flood reports and alerts on a map or in a command-center dashboard, and manage profile and notification settings. The React app coordinates those screens and calls a PHP API backed by a database; flood-map logic aggregates reports into map features, while browser service-worker notifications provide an alert channel. The empty README and unsampled page/API implementations limit evidence for several domain links; those relationships are omitted where they cannot be established.

Main entry points: [`bahaba-app/src/App.jsx`](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/App.jsx) (App coordinator), [`bahaba-app/src/components/Icon.jsx`](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/components/Icon.jsx) (Icon components), [`bahaba-app/src/pages/MapPage.jsx`](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/MapPage.jsx) (Map screen), [`bahaba-app/api`](https://github.com/caseyyygg/bahaba-official/tree/main/bahaba-app/api) (PHP API endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web application"]
  node_app["App coordinator<br/>[App.jsx]"]
  node_auth["Authentication screens<br/>[AuthPage.jsx]"]
  node_selection["Location selection<br/>[SelectionPage.jsx]"]
  node_command["Command dashboard<br/>[CommandPage.jsx]"]
  node_settings["User settings<br/>[SettingsPage.jsx]"]
  node_splash["Welcome screen<br/>[SplashPage.jsx]"]
  node_api_client["API client<br/>[api.js]"]
  node_saved["Saved settings<br/>[useSavedSetting.js]"]
  node_icon["Icon components<br/>[Icon.jsx]"]
end

subgraph group_server["API and data"]
  node_api["PHP API endpoints"]
  node_bootstrap["Request bootstrap<br/>[bootstrap.php]"]
  node_location_helpers["Location helpers"]
  node_retention["Report retention"]
  node_database[("Application database")]
end

subgraph group_mapping["Flood mapping"]
  node_mapview["Map screen<br/>[MapPage.jsx]"]
  node_maprender["Interactive map<br/>[FreeMap.jsx]"]
  node_floodlogic["Flood aggregation<br/>[floodMap.js]"]
  node_locations["Location lookup<br/>[locations.js]"]
end

subgraph group_alerts["Notifications"]
  node_alertsview["Alerts screen<br/>[AlertsPage.jsx]"]
  node_notification_logic["Notification controls<br/>[notifications.js]"]
  node_notification_client["Browser notification client"]
  node_worker["Notification worker"]
end

node_user(("Resident or responder"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_auth
node_app -->|"renders"| node_selection
node_app -->|"renders"| node_mapview
node_app -->|"renders"| node_alertsview
node_app -->|"renders"| node_command
node_app -->|"renders"| node_settings
node_app -->|"renders"| node_splash
node_app -->|"calls"| node_api_client
node_app -->|"uses"| node_saved
node_app -->|"calls"| node_notification_logic
node_api_client -.->|"requests"| node_api
node_api -->|"loads"| node_bootstrap
node_bootstrap -->|"loads"| node_location_helpers
node_bootstrap -->|"connects"| node_database
node_api -.->|"reads and writes"| node_database
node_mapview -->|"renders"| node_maprender
node_mapview -->|"aggregates"| node_floodlogic
node_mapview -->|"looks up"| node_locations
node_maprender -->|"builds points"| node_floodlogic
node_mapview -->|"renders"| node_icon
node_auth -->|"renders"| node_icon
node_command -->|"renders"| node_icon
node_alertsview -->|"renders"| node_icon
node_settings -->|"renders"| node_icon
node_splash -->|"renders"| node_icon
node_notification_logic -->|"uses"| node_notification_client
node_notification_client -->|"registers"| node_worker
node_retention -->|"archives reports"| node_database

click node_app "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/App.jsx"
click node_auth "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/AuthPage.jsx"
click node_selection "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/SelectionPage.jsx"
click node_mapview "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/MapPage.jsx"
click node_maprender "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/components/FreeMap.jsx"
click node_floodlogic "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/floodMap.js"
click node_locations "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/locations.js"
click node_alertsview "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/AlertsPage.jsx"
click node_command "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/CommandPage.jsx"
click node_settings "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/SettingsPage.jsx"
click node_splash "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/SplashPage.jsx"
click node_api_client "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/api.js"
click node_saved "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/useSavedSetting.js"
click node_api "https://github.com/caseyyygg/bahaba-official/tree/main/bahaba-app/api"
click node_bootstrap "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/api/bootstrap.php"
click node_location_helpers "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/api/location_helpers.php"
click node_retention "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/api/report-retention.php"
click node_notification_logic "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/notifications.js"
click node_notification_client "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/public/notification-client.js"
click node_worker "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/public/notification-worker.js"
click node_icon "https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/components/Icon.jsx"

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_selection,node_command,node_settings,node_splash,node_api_client,node_saved,node_icon toneBlue
class node_api,node_bootstrap,node_location_helpers,node_retention,node_database toneAmber
class node_mapview,node_maprender,node_floodlogic,node_locations toneMint
class node_alertsview,node_notification_logic,node_notification_client,node_worker toneRose
class node_user toneIndigo
```

## Components

### Web application

- [App coordinator](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/App.jsx): `bahaba-app/src/App.jsx`
- [Authentication screens](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/AuthPage.jsx): `bahaba-app/src/pages/AuthPage.jsx`
- [Location selection](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/SelectionPage.jsx): `bahaba-app/src/pages/SelectionPage.jsx`
- [Command dashboard](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/CommandPage.jsx): `bahaba-app/src/pages/CommandPage.jsx`
- [User settings](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/SettingsPage.jsx): `bahaba-app/src/pages/SettingsPage.jsx`
- [Welcome screen](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/SplashPage.jsx): `bahaba-app/src/pages/SplashPage.jsx`
- [API client](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/api.js): `bahaba-app/src/api.js`
- [Saved settings](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/useSavedSetting.js): `bahaba-app/src/useSavedSetting.js`
- [Icon components](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/components/Icon.jsx): `bahaba-app/src/components/Icon.jsx`

### API and data

- [PHP API endpoints](https://github.com/caseyyygg/bahaba-official/tree/main/bahaba-app/api): `bahaba-app/api`
- [Request bootstrap](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/api/bootstrap.php): `bahaba-app/api/bootstrap.php`
- [Location helpers](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/api/location_helpers.php): `bahaba-app/api/location_helpers.php`
- [Report retention](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/api/report-retention.php): `bahaba-app/api/report-retention.php`
- **Application database**

### Flood mapping

- [Map screen](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/MapPage.jsx): `bahaba-app/src/pages/MapPage.jsx`
- [Interactive map](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/components/FreeMap.jsx): `bahaba-app/src/components/FreeMap.jsx`
- [Flood aggregation](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/floodMap.js): `bahaba-app/src/floodMap.js`
- [Location lookup](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/locations.js): `bahaba-app/src/locations.js`

### Notifications

- [Alerts screen](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/pages/AlertsPage.jsx): `bahaba-app/src/pages/AlertsPage.jsx`
- [Notification controls](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/src/notifications.js): `bahaba-app/src/notifications.js`
- [Browser notification client](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/public/notification-client.js): `bahaba-app/public/notification-client.js`
- [Notification worker](https://github.com/caseyyygg/bahaba-official/blob/main/bahaba-app/public/notification-worker.js): `bahaba-app/public/notification-worker.js`

### Other components

- **Resident or responder**

## Connections

- Resident or responder → App coordinator: uses
- App coordinator → Authentication screens: renders (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → Location selection: renders (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → Map screen: renders (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → Alerts screen: renders (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → Command dashboard: renders (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → User settings: renders (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → Welcome screen: renders (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → API client: calls (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → Saved settings: uses (evidence: `bahaba-app/src/App.jsx`)
- App coordinator → Notification controls: calls (evidence: `bahaba-app/src/App.jsx`)
- API client → PHP API endpoints: requests
- PHP API endpoints → Request bootstrap: loads (evidence: `bahaba-app/api/index.php`)
- Request bootstrap → Location helpers: loads (evidence: `bahaba-app/api/bootstrap.php`)
- Request bootstrap → Application database: connects (evidence: `bahaba-app/api/bootstrap.php`)
- PHP API endpoints → Application database: reads and writes
- Map screen → Interactive map: renders (evidence: `bahaba-app/src/pages/MapPage.jsx`)
- Map screen → Flood aggregation: aggregates (evidence: `bahaba-app/src/pages/MapPage.jsx`)
- Map screen → Location lookup: looks up (evidence: `bahaba-app/src/pages/MapPage.jsx`)
- Interactive map → Flood aggregation: builds points (evidence: `bahaba-app/src/components/FreeMap.jsx`)
- Map screen → Icon components: renders (evidence: `bahaba-app/src/pages/MapPage.jsx`)
- Authentication screens → Icon components: renders (evidence: `bahaba-app/src/pages/AuthPage.jsx`)
- Command dashboard → Icon components: renders (evidence: `bahaba-app/src/pages/CommandPage.jsx`)
- Alerts screen → Icon components: renders (evidence: `bahaba-app/src/pages/AlertsPage.jsx`)
- User settings → Icon components: renders (evidence: `bahaba-app/src/pages/SettingsPage.jsx`)
- Welcome screen → Icon components: renders (evidence: `bahaba-app/src/pages/SplashPage.jsx`)
- Notification controls → Browser notification client: uses (evidence: `bahaba-app/src/notifications.js`)
- Browser notification client → Notification worker: registers (evidence: `bahaba-app/public/notification-client.js`)
- Report retention → Application database: archives reports (evidence: `bahaba-app/api/report-retention.php`)
