# lorenzred/cloud architecture

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

- Interactive diagram: https://gitdiagram.com/lorenzred/cloud
- Repository: https://github.com/lorenzred/cloud

## Overview

This is a Laravel barangay health and resident-services application, despite its README being the stock Laravel introduction. The principal workflow is residents submitting household/verification information, followed by barangay health workers reviewing residents and recording consultations, medical or monitoring activity; role-specific dashboards and reports support BHW, BNS, barangay-captain and LGU work. Authentication also exposes token login, refresh and revocation. The route file is only partially excerpted, so several feature links are shown as unverified rather than asserted as observed calls.

Main entry points: [`routes/web.php`](https://github.com/lorenzred/cloud/blob/main/routes/web.php) (Web routes), [`app/Http/Controllers/Api/AuthTokenController.php`](https://github.com/lorenzred/cloud/blob/main/app/Http/Controllers/Api/AuthTokenController.php) (Token API), [`app/Models/ResidentRequest.php`](https://github.com/lorenzred/cloud/blob/main/app/Models/ResidentRequest.php) (Resident applications), [`app/Models/Barangay.php`](https://github.com/lorenzred/cloud/blob/main/app/Models/Barangay.php) (Barangay boundaries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Access and roles"]
  node_routes["Web routes<br/>[web.php]"]
  node_token_api["Token API"]
  node_token_service["Token service"]
  node_users[("User accounts<br/>[User.php]")]
end

subgraph group_residents["Resident services"]
  node_res_request[("Resident applications")]
  node_private_storage["Private uploads<br/>[PrivateStorage.php]"]
  node_geo["Boundary validation<br/>[GeoBoundary.php]"]
  node_resident_chat["Resident-BHW chat"]
  node_events[("Events<br/>[Event.php]")]
end

subgraph group_health["Health operations"]
  node_records[("Resident records")]
  node_consultations[("Consultations<br/>[Consultation.php]")]
  node_monitoring[("Household monitoring")]
  node_visits[("Monitoring visits")]
  node_bns_health["Child health tracking<br/>[BnsChildHealth.php]"]
  node_bns_monitor["Child monitoring"]
  node_bns_nutrition["Child nutrition"]
end

subgraph group_oversight["Administration and reports"]
  node_bhw_dashboard["BHW dashboards"]
  node_bhw_reports["BHW reports"]
  node_bns_reports["BNS reports"]
  node_all_records["Records overview"]
  node_barangay[("Barangay boundaries<br/>[Barangay.php]")]
  node_purok[("Purok assignments<br/>[Purok.php]")]
end

node_resident(("Residents"))
node_staff(("Health and LGU staff"))

node_resident -.->|"submits requests"| node_routes
node_staff -.->|"uses services"| node_routes
node_routes -->|"builds dashboard"| node_bhw_dashboard
node_routes -->|"builds records"| node_all_records
node_routes -->|"builds reports"| node_bhw_reports
node_routes -->|"builds reports"| node_bns_reports
node_routes -->|"dispatches health work"| node_bns_health
node_routes -->|"dispatches monitoring"| node_bns_monitor
node_routes -->|"dispatches nutrition"| node_bns_nutrition
node_routes -->|"checks boundaries"| node_geo
node_routes -->|"reads resident records"| node_res_request
node_routes -->|"reads boundaries"| node_barangay
node_routes -->|"reads assignments"| node_purok
node_token_api -->|"issues and revokes"| node_token_service
node_token_api -->|"authenticates account"| node_users
node_token_api -->|"sanitizes credentials"| node_res_request
node_token_service -->|"creates access tokens"| node_users
node_res_request -->|"deletes ID uploads"| node_private_storage
node_monitoring -->|"has visits"| node_visits
node_resident_chat -->|"stores attachments"| node_private_storage
node_barangay -->|"references captain"| node_users
node_purok -->|"belongs to"| node_barangay

click node_routes "https://github.com/lorenzred/cloud/blob/main/routes/web.php"
click node_token_api "https://github.com/lorenzred/cloud/blob/main/app/Http/Controllers/Api/AuthTokenController.php"
click node_token_service "https://github.com/lorenzred/cloud/blob/main/app/Support/AuthTokenService.php"
click node_users "https://github.com/lorenzred/cloud/blob/main/app/Models/User.php"
click node_res_request "https://github.com/lorenzred/cloud/blob/main/app/Models/ResidentRequest.php"
click node_private_storage "https://github.com/lorenzred/cloud/blob/main/app/Support/PrivateStorage.php"
click node_geo "https://github.com/lorenzred/cloud/blob/main/app/Support/GeoBoundary.php"
click node_resident_chat "https://github.com/lorenzred/cloud/blob/main/app/Support/ResidentBhwChat.php"
click node_events "https://github.com/lorenzred/cloud/blob/main/app/Models/Event.php"
click node_records "https://github.com/lorenzred/cloud/blob/main/app/Models/ResidentRequest.php"
click node_consultations "https://github.com/lorenzred/cloud/blob/main/app/Models/Consultation.php"
click node_monitoring "https://github.com/lorenzred/cloud/blob/main/app/Models/HouseholdMonitoringCase.php"
click node_visits "https://github.com/lorenzred/cloud/blob/main/app/Models/HouseholdMonitoringVisit.php"
click node_bns_health "https://github.com/lorenzred/cloud/blob/main/app/Support/BnsChildHealth.php"
click node_bns_monitor "https://github.com/lorenzred/cloud/blob/main/app/Support/BnsChildMonitoring.php"
click node_bns_nutrition "https://github.com/lorenzred/cloud/blob/main/app/Support/BnsChildNutrition.php"
click node_bhw_dashboard "https://github.com/lorenzred/cloud/blob/main/app/Support/BhwDashboardBuilder.php"
click node_bhw_reports "https://github.com/lorenzred/cloud/blob/main/app/Support/BhwReportBuilder.php"
click node_bns_reports "https://github.com/lorenzred/cloud/blob/main/app/Support/BnsReportBuilder.php"
click node_all_records "https://github.com/lorenzred/cloud/blob/main/app/Support/AllRecordsBuilder.php"
click node_barangay "https://github.com/lorenzred/cloud/blob/main/app/Models/Barangay.php"
click node_purok "https://github.com/lorenzred/cloud/blob/main/app/Models/Purok.php"

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_routes,node_token_api,node_token_service,node_users toneBlue
class node_res_request,node_private_storage,node_geo,node_resident_chat,node_events toneAmber
class node_records,node_consultations,node_monitoring,node_visits,node_bns_health,node_bns_monitor,node_bns_nutrition toneMint
class node_bhw_dashboard,node_bhw_reports,node_bns_reports,node_all_records,node_barangay,node_purok toneRose
class node_resident,node_staff toneIndigo
```

## Components

### Access and roles

- [Web routes](https://github.com/lorenzred/cloud/blob/main/routes/web.php): `routes/web.php`
- [Token API](https://github.com/lorenzred/cloud/blob/main/app/Http/Controllers/Api/AuthTokenController.php): `app/Http/Controllers/Api/AuthTokenController.php`
- [Token service](https://github.com/lorenzred/cloud/blob/main/app/Support/AuthTokenService.php): `app/Support/AuthTokenService.php`
- [User accounts](https://github.com/lorenzred/cloud/blob/main/app/Models/User.php): `app/Models/User.php`

### Resident services

- [Resident applications](https://github.com/lorenzred/cloud/blob/main/app/Models/ResidentRequest.php): `app/Models/ResidentRequest.php`
- [Private uploads](https://github.com/lorenzred/cloud/blob/main/app/Support/PrivateStorage.php): `app/Support/PrivateStorage.php`
- [Boundary validation](https://github.com/lorenzred/cloud/blob/main/app/Support/GeoBoundary.php): `app/Support/GeoBoundary.php`
- [Resident-BHW chat](https://github.com/lorenzred/cloud/blob/main/app/Support/ResidentBhwChat.php): `app/Support/ResidentBhwChat.php`
- [Events](https://github.com/lorenzred/cloud/blob/main/app/Models/Event.php): `app/Models/Event.php`

### Health operations

- [Resident records](https://github.com/lorenzred/cloud/blob/main/app/Models/ResidentRequest.php): `app/Models/ResidentRequest.php`
- [Consultations](https://github.com/lorenzred/cloud/blob/main/app/Models/Consultation.php): `app/Models/Consultation.php`
- [Household monitoring](https://github.com/lorenzred/cloud/blob/main/app/Models/HouseholdMonitoringCase.php): `app/Models/HouseholdMonitoringCase.php`
- [Monitoring visits](https://github.com/lorenzred/cloud/blob/main/app/Models/HouseholdMonitoringVisit.php): `app/Models/HouseholdMonitoringVisit.php`
- [Child health tracking](https://github.com/lorenzred/cloud/blob/main/app/Support/BnsChildHealth.php): `app/Support/BnsChildHealth.php`
- [Child monitoring](https://github.com/lorenzred/cloud/blob/main/app/Support/BnsChildMonitoring.php): `app/Support/BnsChildMonitoring.php`
- [Child nutrition](https://github.com/lorenzred/cloud/blob/main/app/Support/BnsChildNutrition.php): `app/Support/BnsChildNutrition.php`

### Administration and reports

- [BHW dashboards](https://github.com/lorenzred/cloud/blob/main/app/Support/BhwDashboardBuilder.php): `app/Support/BhwDashboardBuilder.php`
- [BHW reports](https://github.com/lorenzred/cloud/blob/main/app/Support/BhwReportBuilder.php): `app/Support/BhwReportBuilder.php`
- [BNS reports](https://github.com/lorenzred/cloud/blob/main/app/Support/BnsReportBuilder.php): `app/Support/BnsReportBuilder.php`
- [Records overview](https://github.com/lorenzred/cloud/blob/main/app/Support/AllRecordsBuilder.php): `app/Support/AllRecordsBuilder.php`
- [Barangay boundaries](https://github.com/lorenzred/cloud/blob/main/app/Models/Barangay.php): `app/Models/Barangay.php`
- [Purok assignments](https://github.com/lorenzred/cloud/blob/main/app/Models/Purok.php): `app/Models/Purok.php`

### Other components

- **Residents**
- **Health and LGU staff**

## Connections

- Residents → Web routes: submits requests
- Health and LGU staff → Web routes: uses services
- Web routes → BHW dashboards: builds dashboard (evidence: `routes/web.php`)
- Web routes → Records overview: builds records (evidence: `routes/web.php`)
- Web routes → BHW reports: builds reports (evidence: `routes/web.php`)
- Web routes → BNS reports: builds reports (evidence: `routes/web.php`)
- Web routes → Child health tracking: dispatches health work (evidence: `routes/web.php`)
- Web routes → Child monitoring: dispatches monitoring (evidence: `routes/web.php`)
- Web routes → Child nutrition: dispatches nutrition (evidence: `routes/web.php`)
- Web routes → Boundary validation: checks boundaries (evidence: `routes/web.php`)
- Web routes → Resident applications: reads resident records (evidence: `routes/web.php`)
- Web routes → Barangay boundaries: reads boundaries (evidence: `routes/web.php`)
- Web routes → Purok assignments: reads assignments (evidence: `routes/web.php`)
- Token API → Token service: issues and revokes (evidence: `app/Http/Controllers/Api/AuthTokenController.php`)
- Token API → User accounts: authenticates account (evidence: `app/Http/Controllers/Api/AuthTokenController.php`)
- Token API → Resident applications: sanitizes credentials (evidence: `app/Http/Controllers/Api/AuthTokenController.php`)
- Token service → User accounts: creates access tokens (evidence: `app/Support/AuthTokenService.php`)
- Resident applications → Private uploads: deletes ID uploads (evidence: `app/Models/ResidentRequest.php`)
- Household monitoring → Monitoring visits: has visits (evidence: `app/Models/HouseholdMonitoringCase.php`)
- Resident-BHW chat → Private uploads: stores attachments (evidence: `app/Support/ResidentBhwChat.php`)
- Barangay boundaries → User accounts: references captain (evidence: `app/Models/Barangay.php`)
- Purok assignments → Barangay boundaries: belongs to (evidence: `app/Models/Purok.php`)
