# bitguybandit/esumbong architecture

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

- Interactive diagram: https://gitdiagram.com/bitguybandit/esumbong
- Repository: https://github.com/bitguybandit/esumbong

## Overview

eSumbong is a resident-facing complaint reporting and tracking system with a Barangay Officer case-processing portal. Residents submit reports, optionally with photos and map locations, then follow status updates; officers review, reject or categorize reports, choose referral targets, log actions, and resolve or close cases. The React client uses an Express REST API backed by Supabase Auth, PostgreSQL, and Storage. Several page and route implementations were not excerpted, so their documented capabilities are represented without speculative internal call links.

Main entry points: [`server/src/db.js`](https://github.com/bitguybandit/esumbong/blob/main/server/src/db.js) (Server database client), [`server/src/app.js`](https://github.com/bitguybandit/esumbong/blob/main/server/src/app.js) (Express API router), [`client/src/lib/api.js`](https://github.com/bitguybandit/esumbong/blob/main/client/src/lib/api.js) (REST API client), [`client/src/App.jsx`](https://github.com/bitguybandit/esumbong/blob/main/client/src/App.jsx) (Route application)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Web experience"]
  node_app["Route application<br/>[App.jsx]"]
  node_landing["Public entry<br/>[Landing.jsx]"]
  node_auth_context["Session and profile<br/>[AuthContext.jsx]"]
  node_api_client["REST API client<br/>[api.js]"]
  node_supabase_client["Supabase client<br/>[supabase.js]"]
  node_shared_components["Shared interface components"]
end

subgraph group_casework["Complaint casework"]
  node_resident_views["Resident portal"]
  node_submit["Complaint submission"]
  node_officer_views["Officer portal"]
  node_officer_detail["Case review"]
  node_officer_dashboard["Officer dashboard"]
end

subgraph group_api["API services"]
  node_server_app["Express API router<br/>[app.js]"]
  node_auth_routes["Auth and profile<br/>[auth.routes.js]"]
  node_complaint_routes["Complaint reports and tracking"]
  node_officer_routes["Officer case actions<br/>[officer.routes.js]"]
  node_upload_routes["Photo uploads<br/>[uploads.routes.js]"]
  node_notification_routes["Resident notifications"]
  node_catalog_routes["Categories and referrals"]
  node_auth_middleware["Request authentication<br/>[auth.js]"]
  node_validation["Validation and schemas<br/>[validate.js]"]
  node_case_helpers["Case workflow helpers"]
  node_db_client["Server database client<br/>[db.js]"]
end

subgraph group_platform["Supabase platform"]
  node_supabase_auth["Supabase Auth"]
  node_postgres[("PostgreSQL data")]
  node_storage[("Supabase Storage")]
end

node_resident(("Resident"))
node_officer(("Barangay officer"))

node_resident -->|"opens"| node_landing
node_officer -->|"enters portal"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_resident_views
node_app -->|"routes to"| node_submit
node_app -->|"routes to"| node_officer_views
node_resident -->|"files report"| node_submit
node_officer -->|"reviews case"| node_officer_detail
node_officer -->|"views workload"| node_officer_dashboard
node_submit -->|"submits data"| node_api_client
node_resident_views -->|"requests records"| node_api_client
node_officer_detail -->|"requests case actions"| node_api_client
node_officer_dashboard -->|"loads dashboard data"| node_api_client
node_api_client -->|"gets session token"| node_supabase_client
node_auth_context -->|"manages session"| node_supabase_client
node_auth_context -->|"fetches profile"| node_api_client
node_app -->|"uses layouts"| node_shared_components
node_api_client -->|"calls REST API"| node_server_app
node_server_app -->|"mounts routes"| node_auth_routes
node_server_app -->|"mounts routes"| node_complaint_routes
node_server_app -->|"mounts routes"| node_officer_routes
node_server_app -->|"mounts routes"| node_upload_routes
node_server_app -->|"mounts routes"| node_notification_routes
node_server_app -->|"mounts routes"| node_catalog_routes
node_auth_routes -->|"requires identity"| node_auth_middleware
node_complaint_routes -->|"checks identity"| node_auth_middleware
node_officer_routes -->|"checks role"| node_auth_middleware
node_upload_routes -->|"accepts optional identity"| node_auth_middleware
node_complaint_routes -->|"validates reports"| node_validation
node_officer_routes -->|"validates actions"| node_validation
node_complaint_routes -->|"generates tracking ID"| node_case_helpers
node_officer_routes -->|"notifies residents"| node_case_helpers
node_auth_routes -->|"reads and updates profiles"| node_db_client
node_complaint_routes -->|"stores and reads cases"| node_db_client
node_officer_routes -->|"updates case records"| node_db_client
node_upload_routes -->|"uploads file"| node_db_client
node_notification_routes -->|"reads notifications"| node_db_client
node_auth_middleware -->|"checks credentials"| node_db_client
node_db_client -->|"validates users"| node_supabase_auth
node_db_client -->|"reads and writes"| node_postgres
node_upload_routes -->|"stores media"| node_storage
node_supabase_client -->|"authenticates users"| node_supabase_auth
node_resident -->|"receives updates"| node_notification_routes

click node_app "https://github.com/bitguybandit/esumbong/blob/main/client/src/App.jsx"
click node_landing "https://github.com/bitguybandit/esumbong/blob/main/client/src/pages/Landing.jsx"
click node_resident_views "https://github.com/bitguybandit/esumbong/tree/main/client/src/pages/resident"
click node_submit "https://github.com/bitguybandit/esumbong/blob/main/client/src/pages/resident/SubmitComplaint.jsx"
click node_officer_views "https://github.com/bitguybandit/esumbong/tree/main/client/src/pages/officer"
click node_officer_detail "https://github.com/bitguybandit/esumbong/blob/main/client/src/pages/officer/ComplaintDetails.jsx"
click node_officer_dashboard "https://github.com/bitguybandit/esumbong/blob/main/client/src/pages/officer/OfficerDashboard.jsx"
click node_auth_context "https://github.com/bitguybandit/esumbong/blob/main/client/src/context/AuthContext.jsx"
click node_api_client "https://github.com/bitguybandit/esumbong/blob/main/client/src/lib/api.js"
click node_supabase_client "https://github.com/bitguybandit/esumbong/blob/main/client/src/lib/supabase.js"
click node_shared_components "https://github.com/bitguybandit/esumbong/tree/main/client/src/components"
click node_server_app "https://github.com/bitguybandit/esumbong/blob/main/server/src/app.js"
click node_auth_routes "https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/auth.routes.js"
click node_complaint_routes "https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/complaints.routes.js"
click node_officer_routes "https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/officer.routes.js"
click node_upload_routes "https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/uploads.routes.js"
click node_notification_routes "https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/notifications.routes.js"
click node_catalog_routes "https://github.com/bitguybandit/esumbong/tree/main/server/src/routes"
click node_auth_middleware "https://github.com/bitguybandit/esumbong/blob/main/server/src/middleware/auth.js"
click node_validation "https://github.com/bitguybandit/esumbong/blob/main/server/src/utils/validate.js"
click node_case_helpers "https://github.com/bitguybandit/esumbong/tree/main/server/src/utils"
click node_db_client "https://github.com/bitguybandit/esumbong/blob/main/server/src/db.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_landing,node_auth_context,node_api_client,node_supabase_client,node_shared_components toneBlue
class node_resident_views,node_submit,node_officer_views,node_officer_detail,node_officer_dashboard toneAmber
class node_server_app,node_auth_routes,node_complaint_routes,node_officer_routes,node_upload_routes,node_notification_routes,node_catalog_routes,node_auth_middleware,node_validation,node_case_helpers,node_db_client toneMint
class node_supabase_auth,node_postgres,node_storage toneRose
class node_resident,node_officer toneIndigo
```

## Components

### Web experience

- [Route application](https://github.com/bitguybandit/esumbong/blob/main/client/src/App.jsx): `client/src/App.jsx`
- [Public entry](https://github.com/bitguybandit/esumbong/blob/main/client/src/pages/Landing.jsx): `client/src/pages/Landing.jsx`
- [Session and profile](https://github.com/bitguybandit/esumbong/blob/main/client/src/context/AuthContext.jsx): `client/src/context/AuthContext.jsx`
- [REST API client](https://github.com/bitguybandit/esumbong/blob/main/client/src/lib/api.js): `client/src/lib/api.js`
- [Supabase client](https://github.com/bitguybandit/esumbong/blob/main/client/src/lib/supabase.js): `client/src/lib/supabase.js`
- [Shared interface components](https://github.com/bitguybandit/esumbong/tree/main/client/src/components): `client/src/components`

### Complaint casework

- [Resident portal](https://github.com/bitguybandit/esumbong/tree/main/client/src/pages/resident): `client/src/pages/resident`
- [Complaint submission](https://github.com/bitguybandit/esumbong/blob/main/client/src/pages/resident/SubmitComplaint.jsx): `client/src/pages/resident/SubmitComplaint.jsx`
- [Officer portal](https://github.com/bitguybandit/esumbong/tree/main/client/src/pages/officer): `client/src/pages/officer`
- [Case review](https://github.com/bitguybandit/esumbong/blob/main/client/src/pages/officer/ComplaintDetails.jsx): `client/src/pages/officer/ComplaintDetails.jsx`
- [Officer dashboard](https://github.com/bitguybandit/esumbong/blob/main/client/src/pages/officer/OfficerDashboard.jsx): `client/src/pages/officer/OfficerDashboard.jsx`

### API services

- [Express API router](https://github.com/bitguybandit/esumbong/blob/main/server/src/app.js): `server/src/app.js`
- [Auth and profile](https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/auth.routes.js): `server/src/routes/auth.routes.js`
- [Complaint reports and tracking](https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/complaints.routes.js): `server/src/routes/complaints.routes.js`
- [Officer case actions](https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/officer.routes.js): `server/src/routes/officer.routes.js`
- [Photo uploads](https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/uploads.routes.js): `server/src/routes/uploads.routes.js`
- [Resident notifications](https://github.com/bitguybandit/esumbong/blob/main/server/src/routes/notifications.routes.js): `server/src/routes/notifications.routes.js`
- [Categories and referrals](https://github.com/bitguybandit/esumbong/tree/main/server/src/routes): `server/src/routes`
- [Request authentication](https://github.com/bitguybandit/esumbong/blob/main/server/src/middleware/auth.js): `server/src/middleware/auth.js`
- [Validation and schemas](https://github.com/bitguybandit/esumbong/blob/main/server/src/utils/validate.js): `server/src/utils/validate.js`
- [Case workflow helpers](https://github.com/bitguybandit/esumbong/tree/main/server/src/utils): `server/src/utils`
- [Server database client](https://github.com/bitguybandit/esumbong/blob/main/server/src/db.js): `server/src/db.js`

### Supabase platform

- **Supabase Auth**
- **PostgreSQL data**
- **Supabase Storage**

### Other components

- **Resident**
- **Barangay officer**

## Connections

- Resident → Public entry: opens (evidence: `README.md`)
- Barangay officer → Route application: enters portal (evidence: `client/src/App.jsx`)
- Route application → Public entry: routes to (evidence: `client/src/App.jsx`)
- Route application → Resident portal: routes to (evidence: `client/src/App.jsx`)
- Route application → Complaint submission: routes to (evidence: `client/src/App.jsx`)
- Route application → Officer portal: routes to (evidence: `client/src/App.jsx`)
- Resident → Complaint submission: files report (evidence: `README.md`)
- Barangay officer → Case review: reviews case (evidence: `README.md`)
- Barangay officer → Officer dashboard: views workload (evidence: `README.md`)
- Complaint submission → REST API client: submits data (evidence: `client/src/pages/resident/SubmitComplaint.jsx`)
- Resident portal → REST API client: requests records (evidence: `client/src/pages/resident/ResidentDashboard.jsx`)
- Case review → REST API client: requests case actions (evidence: `client/src/pages/officer/ComplaintDetails.jsx`)
- Officer dashboard → REST API client: loads dashboard data (evidence: `client/src/pages/officer/OfficerDashboard.jsx`)
- REST API client → Supabase client: gets session token (evidence: `client/src/lib/api.js`)
- Session and profile → Supabase client: manages session (evidence: `client/src/context/AuthContext.jsx`)
- Session and profile → REST API client: fetches profile (evidence: `client/src/context/AuthContext.jsx`)
- Route application → Shared interface components: uses layouts (evidence: `client/src/App.jsx`)
- REST API client → Express API router: calls REST API (evidence: `README.md`)
- Express API router → Auth and profile: mounts routes (evidence: `server/src/app.js`)
- Express API router → Complaint reports and tracking: mounts routes (evidence: `server/src/app.js`)
- Express API router → Officer case actions: mounts routes (evidence: `server/src/app.js`)
- Express API router → Photo uploads: mounts routes (evidence: `server/src/app.js`)
- Express API router → Resident notifications: mounts routes (evidence: `server/src/app.js`)
- Express API router → Categories and referrals: mounts routes (evidence: `server/src/app.js`)
- Auth and profile → Request authentication: requires identity (evidence: `server/src/routes/auth.routes.js`)
- Complaint reports and tracking → Request authentication: checks identity (evidence: `server/src/routes/complaints.routes.js`)
- Officer case actions → Request authentication: checks role (evidence: `server/src/routes/officer.routes.js`)
- Photo uploads → Request authentication: accepts optional identity (evidence: `server/src/routes/uploads.routes.js`)
- Complaint reports and tracking → Validation and schemas: validates reports (evidence: `server/src/routes/complaints.routes.js`)
- Officer case actions → Validation and schemas: validates actions (evidence: `server/src/routes/officer.routes.js`)
- Complaint reports and tracking → Case workflow helpers: generates tracking ID (evidence: `server/src/routes/complaints.routes.js`)
- Officer case actions → Case workflow helpers: notifies residents (evidence: `server/src/routes/officer.routes.js`)
- Auth and profile → Server database client: reads and updates profiles (evidence: `server/src/routes/auth.routes.js`)
- Complaint reports and tracking → Server database client: stores and reads cases (evidence: `server/src/routes/complaints.routes.js`)
- Officer case actions → Server database client: updates case records (evidence: `server/src/routes/officer.routes.js`)
- Photo uploads → Server database client: uploads file (evidence: `server/src/routes/uploads.routes.js`)
- Resident notifications → Server database client: reads notifications (evidence: `server/src/routes/notifications.routes.js`)
- Request authentication → Server database client: checks credentials (evidence: `server/src/middleware/auth.js`)
- Server database client → Supabase Auth: validates users (evidence: `README.md`)
- Server database client → PostgreSQL data: reads and writes (evidence: `README.md`)
- Photo uploads → Supabase Storage: stores media (evidence: `server/src/routes/uploads.routes.js`)
- Supabase client → Supabase Auth: authenticates users (evidence: `README.md`)
- Resident → Resident notifications: receives updates (evidence: `README.md`)
