# apexpredator20050904/cblrep architecture

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

- Interactive diagram: https://gitdiagram.com/apexpredator20050904/cblrep
- Repository: https://github.com/apexpredator20050904/cblrep

## Overview

CBLREP is a barangay resource-exchange portal: members use the Flutter app to post offers or needs and negotiate two-sided exchanges; municipal staff use a React console to verify residents and moderate activity. Both clients reach the Laravel API, which routes requests to domain controllers and persists portal state. The README documents the mobile/API and console/API connections; source-index references and excerpts support the controller, model, and notification links. Mobile implementation details were not sampled, so its internal stages are left aggregated.

Main entry points: [`backend/routes/api.php`](https://github.com/apexpredator20050904/cblrep/blob/main/backend/routes/api.php) (API routes), [`backend/app/Http/Controllers/Api/ExchangeController.php`](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/ExchangeController.php) (Barter workflow), [`backend/app/Http/Controllers/Api/AdminTwoFactorController.php`](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AdminTwoFactorController.php) (Admin 2FA), [`backend/app/Services/NotificationService.php`](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Services/NotificationService.php) (Notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Portal clients"]
  node_mobile["Member app"]
  node_console["Admin console<br/>[App.jsx]"]
end

subgraph group_api["API workflows"]
  node_api_routes["API routes<br/>[api.php]"]
  node_authentication["Sign-in and 2FA<br/>[AuthController.php]"]
  node_two_factor["Admin 2FA"]
  node_listings["Listing management"]
  node_exchanges["Barter workflow"]
  node_admin_portal["Admin operations"]
  node_approvals["Resident approvals"]
  node_other_admin["Admin capabilities"]
end

subgraph group_domain["Portal domain"]
  node_resources[("Listings<br/>[Resource.php]")]
  node_exchange_records[("Exchange records<br/>[Exchange.php]")]
  node_users[("Member accounts<br/>[User.php]")]
  node_audit[("Audit trail<br/>[AuditLog.php]")]
  node_mariadb[("MariaDB<br/>[database.php]")]
end

subgraph group_operations["Member services"]
  node_notifications["Notifications"]
  node_push["Push delivery<br/>[PushService.php]"]
  node_totp["TOTP support<br/>[TotpService.php]"]
end

node_members(("Community members"))
node_admins(("Municipal admins"))

node_members -->|"uses"| node_mobile
node_admins -->|"uses"| node_console
node_mobile -->|"requests API"| node_api_routes
node_console -->|"requests API"| node_api_routes
node_api_routes -->|"routes to"| node_authentication
node_api_routes -->|"routes to"| node_listings
node_api_routes -->|"routes to"| node_exchanges
node_api_routes -->|"routes to"| node_admin_portal
node_api_routes -->|"routes to"| node_approvals
node_api_routes -->|"routes to"| node_two_factor
node_authentication -->|"uses accounts"| node_users
node_authentication -->|"delegates 2FA"| node_two_factor
node_two_factor -->|"verifies codes"| node_totp
node_two_factor -->|"checks accounts"| node_users
node_listings -->|"manages listings"| node_resources
node_exchanges -->|"manages trades"| node_exchange_records
node_exchanges -->|"checks listings"| node_resources
node_exchanges -->|"notifies parties"| node_notifications
node_admin_portal -->|"reads audit"| node_audit
node_approvals -->|"records decisions"| node_audit
node_approvals -->|"notifies members"| node_notifications
node_notifications -->|"dispatches push"| node_push
node_notifications -->|"checks preferences"| node_users
node_other_admin -.->|"routes documented"| node_api_routes
node_resources -.->|"persists"| node_mariadb
node_exchange_records -.->|"persists"| node_mariadb
node_users -.->|"persists"| node_mariadb

click node_mobile "https://github.com/apexpredator20050904/cblrep/tree/main/mobile"
click node_console "https://github.com/apexpredator20050904/cblrep/blob/main/frontend/src/App.jsx"
click node_api_routes "https://github.com/apexpredator20050904/cblrep/blob/main/backend/routes/api.php"
click node_authentication "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AuthController.php"
click node_two_factor "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AdminTwoFactorController.php"
click node_listings "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/ListingController.php"
click node_exchanges "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/ExchangeController.php"
click node_admin_portal "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AdminPortalController.php"
click node_approvals "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AdminApprovalController.php"
click node_resources "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Models/Resource.php"
click node_exchange_records "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Models/Exchange.php"
click node_users "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Models/User.php"
click node_audit "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Models/AuditLog.php"
click node_mariadb "https://github.com/apexpredator20050904/cblrep/blob/main/backend/config/database.php"
click node_notifications "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Services/NotificationService.php"
click node_push "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Services/PushService.php"
click node_totp "https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Support/TotpService.php"
click node_other_admin "https://github.com/apexpredator20050904/cblrep/tree/main/backend/app/Http/Controllers/Api"

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_mobile,node_console toneBlue
class node_api_routes,node_authentication,node_two_factor,node_listings,node_exchanges,node_admin_portal,node_approvals,node_other_admin toneAmber
class node_resources,node_exchange_records,node_users,node_audit,node_mariadb toneMint
class node_notifications,node_push,node_totp toneRose
class node_members,node_admins toneIndigo
```

## Components

### Portal clients

- [Member app](https://github.com/apexpredator20050904/cblrep/tree/main/mobile): `mobile`
- [Admin console](https://github.com/apexpredator20050904/cblrep/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`

### API workflows

- [API routes](https://github.com/apexpredator20050904/cblrep/blob/main/backend/routes/api.php): `backend/routes/api.php`
- [Sign-in and 2FA](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AuthController.php): `backend/app/Http/Controllers/Api/AuthController.php`
- [Admin 2FA](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AdminTwoFactorController.php): `backend/app/Http/Controllers/Api/AdminTwoFactorController.php`
- [Listing management](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/ListingController.php): `backend/app/Http/Controllers/Api/ListingController.php`
- [Barter workflow](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/ExchangeController.php): `backend/app/Http/Controllers/Api/ExchangeController.php`
- [Admin operations](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AdminPortalController.php): `backend/app/Http/Controllers/Api/AdminPortalController.php`
- [Resident approvals](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Http/Controllers/Api/AdminApprovalController.php): `backend/app/Http/Controllers/Api/AdminApprovalController.php`
- [Admin capabilities](https://github.com/apexpredator20050904/cblrep/tree/main/backend/app/Http/Controllers/Api): `backend/app/Http/Controllers/Api`

### Portal domain

- [Listings](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Models/Resource.php): `backend/app/Models/Resource.php`
- [Exchange records](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Models/Exchange.php): `backend/app/Models/Exchange.php`
- [Member accounts](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Models/User.php): `backend/app/Models/User.php`
- [Audit trail](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Models/AuditLog.php): `backend/app/Models/AuditLog.php`
- [MariaDB](https://github.com/apexpredator20050904/cblrep/blob/main/backend/config/database.php): `backend/config/database.php`

### Member services

- [Notifications](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Services/NotificationService.php): `backend/app/Services/NotificationService.php`
- [Push delivery](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Services/PushService.php): `backend/app/Services/PushService.php`
- [TOTP support](https://github.com/apexpredator20050904/cblrep/blob/main/backend/app/Support/TotpService.php): `backend/app/Support/TotpService.php`

### Other components

- **Community members**
- **Municipal admins**

## Connections

- Community members → Member app: uses (evidence: `README.md`)
- Municipal admins → Admin console: uses (evidence: `README.md`)
- Member app → API routes: requests API (evidence: `README.md`)
- Admin console → API routes: requests API (evidence: `README.md`)
- API routes → Sign-in and 2FA: routes to (evidence: `backend/routes/api.php`)
- API routes → Listing management: routes to (evidence: `backend/routes/api.php`)
- API routes → Barter workflow: routes to (evidence: `backend/routes/api.php`)
- API routes → Admin operations: routes to (evidence: `backend/routes/api.php`)
- API routes → Resident approvals: routes to (evidence: `backend/routes/api.php`)
- API routes → Admin 2FA: routes to (evidence: `backend/routes/api.php`)
- Sign-in and 2FA → Member accounts: uses accounts (evidence: `backend/app/Http/Controllers/Api/AuthController.php`)
- Sign-in and 2FA → Admin 2FA: delegates 2FA (evidence: `backend/app/Http/Controllers/Api/AuthController.php`)
- Admin 2FA → TOTP support: verifies codes (evidence: `backend/app/Http/Controllers/Api/AdminTwoFactorController.php`)
- Admin 2FA → Member accounts: checks accounts (evidence: `backend/app/Http/Controllers/Api/AdminTwoFactorController.php`)
- Listing management → Listings: manages listings (evidence: `backend/app/Http/Controllers/Api/ListingController.php`)
- Barter workflow → Exchange records: manages trades (evidence: `backend/app/Http/Controllers/Api/ExchangeController.php`)
- Barter workflow → Listings: checks listings (evidence: `backend/app/Http/Controllers/Api/ExchangeController.php`)
- Barter workflow → Notifications: notifies parties (evidence: `backend/app/Http/Controllers/Api/ExchangeController.php`)
- Admin operations → Audit trail: reads audit (evidence: `backend/app/Http/Controllers/Api/AdminPortalController.php`)
- Resident approvals → Audit trail: records decisions (evidence: `backend/app/Http/Controllers/Api/AdminApprovalController.php`)
- Resident approvals → Notifications: notifies members (evidence: `backend/app/Http/Controllers/Api/AdminApprovalController.php`)
- Notifications → Push delivery: dispatches push (evidence: `backend/app/Services/NotificationService.php`)
- Notifications → Member accounts: checks preferences (evidence: `backend/app/Services/NotificationService.php`)
- Admin capabilities → API routes: routes documented (evidence: `backend/routes/api.php`)
- Listings → MariaDB: persists
- Exchange records → MariaDB: persists
- Member accounts → MariaDB: persists
