# bbndct04/kp-app architecture

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

- Interactive diagram: https://gitdiagram.com/bbndct04/kp-app
- Repository: https://github.com/bbndct04/kp-app

## Overview

This is a Barangay New Kababae complaint-reporting and case-management web app built on Laravel, rather than the generic Laravel product described by its README. Residents register, submit incidents, then track cases and notifications; staff and admins review complaints, update mediation/status details, manage users, and produce analytics and official forms. The graph preserves authentication, ID verification, profile, and installable/offline PWA capabilities. Edges use route/controller references, sampled calls, or documented view relationships; unsampled subsystems are included without guessed internal links.

Main entry points: [`routes/web.php`](https://github.com/bbndct04/kp-app/blob/main/routes/web.php) (Web routes), [`app/Http/Controllers/AdminController.php`](https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/AdminController.php) (Case review and status), [`app/Models/User.php`](https://github.com/bbndct04/kp-app/blob/main/app/Models/User.php) (User accounts), [`routes/auth.php`](https://github.com/bbndct04/kp-app/blob/main/routes/auth.php) (Auth routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and identity"]
  node_web_routes["Web routes<br/>[web.php]"]
  node_auth_routes["Auth routes<br/>[auth.php]"]
  node_registration["Registration"]
  node_login["Login"]
  node_identity["ID verification"]
  node_profile["Profile management"]
  node_user_model[("User accounts<br/>[User.php]")]
end

subgraph group_casework["Complaint casework"]
  node_complaint_intake["Complaint intake"]
  node_complaint_model[("Complaint records<br/>[Complaint.php]")]
  node_notifications[("Complaint notifications")]
  node_notification_controller["Notification handling"]
end

subgraph group_oversight["Administration"]
  node_admin_cases["Case review and status"]
  node_admin_views["Admin dashboards and forms"]
end

subgraph group_experience["Resident experience"]
  node_resident_views["Resident case views"]
  node_complaint_form["Complaint form<br/>[create.blade.php]"]
  node_app_layout["App navigation and PWA<br/>[app.blade.php]"]
  node_service_worker["Offline service worker<br/>[sw.js]"]
end

node_resident(("Resident"))
node_staff(("Staff / admin"))

node_resident -->|"registers or logs in"| node_auth_routes
node_auth_routes -->|"routes registration"| node_registration
node_auth_routes -->|"routes login"| node_login
node_registration -->|"creates account"| node_user_model
node_login -.->|"authenticates user"| node_user_model
node_staff -->|"opens admin routes"| node_web_routes
node_resident -->|"opens resident routes"| node_web_routes
node_web_routes -->|"routes submissions"| node_complaint_intake
node_complaint_intake -->|"creates complaint"| node_complaint_model
node_complaint_intake -->|"renders form"| node_complaint_form
node_web_routes -->|"routes administration"| node_admin_cases
node_admin_cases -->|"reads and updates cases"| node_complaint_model
node_admin_cases -->|"manages users"| node_user_model
node_admin_cases -->|"creates status notices"| node_notifications
node_admin_cases -->|"renders admin pages"| node_admin_views
node_web_routes -->|"routes notifications"| node_notification_controller
node_notification_controller -->|"reads and updates notices"| node_notifications
node_web_routes -.->|"serves resident pages"| node_resident_views
node_app_layout -->|"registers worker"| node_service_worker
node_app_layout -->|"shows unread count"| node_notifications
node_resident_views -->|"displays case data"| node_complaint_model
node_identity -.->|"verifies identity"| node_user_model
node_profile -.->|"updates profile"| node_user_model

click node_web_routes "https://github.com/bbndct04/kp-app/blob/main/routes/web.php"
click node_auth_routes "https://github.com/bbndct04/kp-app/blob/main/routes/auth.php"
click node_registration "https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php"
click node_login "https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php"
click node_identity "https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/IDVerificationController.php"
click node_profile "https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/ProfileController.php"
click node_user_model "https://github.com/bbndct04/kp-app/blob/main/app/Models/User.php"
click node_complaint_intake "https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/ComplaintController.php"
click node_complaint_model "https://github.com/bbndct04/kp-app/blob/main/app/Models/Complaint.php"
click node_admin_cases "https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/AdminController.php"
click node_admin_views "https://github.com/bbndct04/kp-app/tree/main/resources/views/admin"
click node_notifications "https://github.com/bbndct04/kp-app/blob/main/app/Models/ComplaintNotification.php"
click node_notification_controller "https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/NotificationController.php"
click node_resident_views "https://github.com/bbndct04/kp-app/tree/main/resources/views/resident"
click node_complaint_form "https://github.com/bbndct04/kp-app/blob/main/resources/views/complaints/create.blade.php"
click node_app_layout "https://github.com/bbndct04/kp-app/blob/main/resources/views/layouts/app.blade.php"
click node_service_worker "https://github.com/bbndct04/kp-app/blob/main/public/sw.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_web_routes,node_auth_routes,node_registration,node_login,node_identity,node_profile,node_user_model toneBlue
class node_complaint_intake,node_complaint_model,node_notifications,node_notification_controller toneAmber
class node_admin_cases,node_admin_views toneMint
class node_resident_views,node_complaint_form,node_app_layout,node_service_worker toneRose
class node_resident,node_staff toneIndigo
```

## Components

### Access and identity

- [Web routes](https://github.com/bbndct04/kp-app/blob/main/routes/web.php): `routes/web.php`
- [Auth routes](https://github.com/bbndct04/kp-app/blob/main/routes/auth.php): `routes/auth.php`
- [Registration](https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/Auth/RegisteredUserController.php): `app/Http/Controllers/Auth/RegisteredUserController.php`
- [Login](https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/Auth/AuthenticatedSessionController.php): `app/Http/Controllers/Auth/AuthenticatedSessionController.php`
- [ID verification](https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/IDVerificationController.php): `app/Http/Controllers/IDVerificationController.php`
- [Profile management](https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/ProfileController.php): `app/Http/Controllers/ProfileController.php`
- [User accounts](https://github.com/bbndct04/kp-app/blob/main/app/Models/User.php): `app/Models/User.php`

### Complaint casework

- [Complaint intake](https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/ComplaintController.php): `app/Http/Controllers/ComplaintController.php`
- [Complaint records](https://github.com/bbndct04/kp-app/blob/main/app/Models/Complaint.php): `app/Models/Complaint.php`
- [Complaint notifications](https://github.com/bbndct04/kp-app/blob/main/app/Models/ComplaintNotification.php): `app/Models/ComplaintNotification.php`
- [Notification handling](https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/NotificationController.php): `app/Http/Controllers/NotificationController.php`

### Administration

- [Case review and status](https://github.com/bbndct04/kp-app/blob/main/app/Http/Controllers/AdminController.php): `app/Http/Controllers/AdminController.php`
- [Admin dashboards and forms](https://github.com/bbndct04/kp-app/tree/main/resources/views/admin): `resources/views/admin`

### Resident experience

- [Resident case views](https://github.com/bbndct04/kp-app/tree/main/resources/views/resident): `resources/views/resident`
- [Complaint form](https://github.com/bbndct04/kp-app/blob/main/resources/views/complaints/create.blade.php): `resources/views/complaints/create.blade.php`
- [App navigation and PWA](https://github.com/bbndct04/kp-app/blob/main/resources/views/layouts/app.blade.php): `resources/views/layouts/app.blade.php`
- [Offline service worker](https://github.com/bbndct04/kp-app/blob/main/public/sw.js): `public/sw.js`

### Other components

- **Resident**
- **Staff / admin**

## Connections

- Resident → Auth routes: registers or logs in (evidence: `routes/auth.php`)
- Auth routes → Registration: routes registration (evidence: `routes/auth.php`)
- Auth routes → Login: routes login (evidence: `routes/auth.php`)
- Registration → User accounts: creates account (evidence: `app/Http/Controllers/Auth/RegisteredUserController.php`)
- Login → User accounts: authenticates user
- Staff / admin → Web routes: opens admin routes (evidence: `routes/web.php`)
- Resident → Web routes: opens resident routes (evidence: `routes/web.php`)
- Web routes → Complaint intake: routes submissions (evidence: `routes/web.php`)
- Complaint intake → Complaint records: creates complaint (evidence: `app/Http/Controllers/ComplaintController.php`)
- Complaint intake → Complaint form: renders form (evidence: `app/Http/Controllers/ComplaintController.php`)
- Web routes → Case review and status: routes administration (evidence: `routes/web.php`)
- Case review and status → Complaint records: reads and updates cases (evidence: `app/Http/Controllers/AdminController.php`)
- Case review and status → User accounts: manages users (evidence: `app/Http/Controllers/AdminController.php`)
- Case review and status → Complaint notifications: creates status notices (evidence: `app/Http/Controllers/AdminController.php`)
- Case review and status → Admin dashboards and forms: renders admin pages (evidence: `app/Http/Controllers/AdminController.php`)
- Web routes → Notification handling: routes notifications (evidence: `routes/web.php`)
- Notification handling → Complaint notifications: reads and updates notices (evidence: `app/Http/Controllers/NotificationController.php`)
- Web routes → Resident case views: serves resident pages
- App navigation and PWA → Offline service worker: registers worker (evidence: `resources/views/layouts/app.blade.php`)
- App navigation and PWA → Complaint notifications: shows unread count (evidence: `resources/views/layouts/app.blade.php`)
- Resident case views → Complaint records: displays case data (evidence: `resources/views/resident/track.blade.php`)
- ID verification → User accounts: verifies identity
- Profile management → User accounts: updates profile
