# kadez-406/lalapor architecture

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

- Interactive diagram: https://gitdiagram.com/kadez-406/lalapor
- Repository: https://github.com/kadez-406/lalapor

## Overview

Lalapor is a web-and-mobile public-service complaint platform. Residents authenticate, browse or create location- and photo-supported reports, then discuss and upvote them; administrators review report status, while super admins manage users. Both clients use the Express REST API, which persists users, reports, categories, comments, and upvotes in MySQL. The README documents the key capabilities and client/API architecture; unsampled mobile and web feature internals are represented at their existing source paths, without inferring internal call sequences.

Main entry points: [`frontend-web/src/App.jsx`](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/App.jsx) (Web application), [`backend/server.js`](https://github.com/kadez-406/lalapor/blob/main/backend/server.js) (API server), [`frontend-mobile/src/app/(tabs)/_layout.tsx`](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/(tabs)/_layout.tsx) (Mobile application), [`backend/models`](https://github.com/kadez-406/lalapor/tree/main/backend/models) (Domain models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web client"]
  node_webapp["Web application<br/>[App.jsx]"]
  node_web_auth["Web authentication<br/>[AuthContext.jsx]"]
  node_web_dashboard["Report dashboard<br/>[DashboardPage.jsx]"]
  node_web_create["Create report"]
  node_web_detail["Report discussion"]
  node_web_admin["User administration"]
  node_web_help["Help directory"]
  node_web_map["Report map<br/>[MapView.jsx]"]
  node_web_api["Web API client<br/>[api.js]"]
end

subgraph group_mobile["Mobile client"]
  node_mobileapp["Mobile application<br/>[_layout.tsx]"]
  node_mobile_auth["Mobile authentication<br/>[AuthContext.tsx]"]
  node_mobile_reports["Browse reports<br/>[index.tsx]"]
  node_mobile_create["Create report<br/>[tambah.tsx]"]
  node_mobile_detail["Report detail<br/>[&#91;id&#93;.tsx]"]
  node_mobile_help["Help directory<br/>[help.tsx]"]
  node_mobile_map["Mobile map<br/>[MyMapView.tsx]"]
  node_mobile_api["Mobile API client<br/>[api.ts]"]
end

subgraph group_api["REST API"]
  node_api_server["API server<br/>[server.js]"]
  node_report_routes["Report endpoints<br/>[laporanRoutes.js]"]
  node_user_routes["User endpoints<br/>[userRoutes.js]"]
  node_category_routes["Category endpoints<br/>[categoryRoutes.js]"]
  node_auth_routes["Authentication endpoints<br/>[authRoutes.js]"]
end

subgraph group_domain["Complaint domain"]
  node_report_logic["Report operations"]
  node_user_logic["User management<br/>[userController.js]"]
  node_comment_logic["Comment operations"]
  node_category_logic["Category operations"]
  node_auth_logic["Account operations<br/>[authController.js]"]
end

subgraph group_storage["Persistence"]
  node_db_models[("Domain models")]
  node_db_config[("MySQL connection<br/>[database.js]")]
end

node_resident(("Resident or staff"))
node_mysql[("MySQL database")]

node_resident -->|"uses web"| node_webapp
node_resident -->|"uses mobile"| node_mobileapp
node_webapp -->|"provides auth"| node_web_auth
node_webapp -->|"routes to"| node_web_dashboard
node_webapp -->|"routes to"| node_web_create
node_webapp -->|"routes to"| node_web_detail
node_webapp -->|"routes to"| node_web_admin
node_webapp -->|"routes to"| node_web_help
node_web_dashboard -->|"requests data"| node_web_api
node_web_detail -->|"requests data"| node_web_api
node_web_dashboard -->|"renders map"| node_web_map
node_web_detail -->|"renders map"| node_web_map
node_web_api -->|"calls REST API"| node_api_server
node_mobileapp -.->|"provides auth"| node_mobile_auth
node_mobileapp -.->|"routes to"| node_mobile_reports
node_mobileapp -.->|"routes to"| node_mobile_create
node_mobileapp -.->|"routes to"| node_mobile_detail
node_mobileapp -.->|"routes to"| node_mobile_help
node_mobile_create -.->|"selects location"| node_mobile_map
node_mobile_api -->|"calls REST API"| node_api_server
node_api_server -->|"mounts routes"| node_auth_routes
node_api_server -->|"mounts routes"| node_report_routes
node_api_server -->|"mounts routes"| node_user_routes
node_api_server -->|"mounts routes"| node_category_routes
node_report_routes -->|"dispatches requests"| node_report_logic
node_report_routes -->|"dispatches comments"| node_comment_logic
node_user_routes -->|"dispatches requests"| node_user_logic
node_category_routes -->|"dispatches requests"| node_category_logic
node_auth_routes -->|"dispatches requests"| node_auth_logic
node_report_logic -->|"queries models"| node_db_models
node_user_logic -->|"queries models"| node_db_models
node_db_models -->|"uses connection"| node_db_config
node_api_server -->|"syncs models"| node_db_models
node_db_config -->|"connects to"| node_mysql
node_resident -.->|"pins location"| node_web_map
node_resident -.->|"pins location"| node_mobile_map

click node_webapp "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/App.jsx"
click node_web_auth "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/context/AuthContext.jsx"
click node_web_dashboard "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/DashboardPage.jsx"
click node_web_create "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/TambahLaporanPage.jsx"
click node_web_detail "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/DetailLaporanPage.jsx"
click node_web_admin "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/ManageUsersPage.jsx"
click node_web_help "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/HelpDirectoryPage.jsx"
click node_web_map "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/components/MapView.jsx"
click node_web_api "https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/services/api.js"
click node_mobileapp "https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/(tabs)/_layout.tsx"
click node_mobile_auth "https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/context/AuthContext.tsx"
click node_mobile_reports "https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/(tabs)/index.tsx"
click node_mobile_create "https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/(tabs)/tambah.tsx"
click node_mobile_detail "https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/laporan/%5Bid%5D.tsx"
click node_mobile_help "https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/help.tsx"
click node_mobile_map "https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/components/MyMapView.tsx"
click node_mobile_api "https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/services/api.ts"
click node_api_server "https://github.com/kadez-406/lalapor/blob/main/backend/server.js"
click node_report_routes "https://github.com/kadez-406/lalapor/blob/main/backend/routes/laporanRoutes.js"
click node_user_routes "https://github.com/kadez-406/lalapor/blob/main/backend/routes/userRoutes.js"
click node_category_routes "https://github.com/kadez-406/lalapor/blob/main/backend/routes/categoryRoutes.js"
click node_auth_routes "https://github.com/kadez-406/lalapor/blob/main/backend/routes/authRoutes.js"
click node_report_logic "https://github.com/kadez-406/lalapor/blob/main/backend/controllers/laporanController.js"
click node_user_logic "https://github.com/kadez-406/lalapor/blob/main/backend/controllers/userController.js"
click node_comment_logic "https://github.com/kadez-406/lalapor/blob/main/backend/controllers/commentController.js"
click node_category_logic "https://github.com/kadez-406/lalapor/blob/main/backend/controllers/categoryController.js"
click node_auth_logic "https://github.com/kadez-406/lalapor/blob/main/backend/controllers/authController.js"
click node_db_models "https://github.com/kadez-406/lalapor/tree/main/backend/models"
click node_db_config "https://github.com/kadez-406/lalapor/blob/main/backend/config/database.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_webapp,node_web_auth,node_web_dashboard,node_web_create,node_web_detail,node_web_admin,node_web_help,node_web_map,node_web_api toneBlue
class node_mobileapp,node_mobile_auth,node_mobile_reports,node_mobile_create,node_mobile_detail,node_mobile_help,node_mobile_map,node_mobile_api,node_mysql toneAmber
class node_api_server,node_report_routes,node_user_routes,node_category_routes,node_auth_routes toneMint
class node_report_logic,node_user_logic,node_comment_logic,node_category_logic,node_auth_logic toneRose
class node_db_models,node_db_config,node_resident toneIndigo
```

## Components

### Web client

- [Web application](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/App.jsx): `frontend-web/src/App.jsx`
- [Web authentication](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/context/AuthContext.jsx): `frontend-web/src/context/AuthContext.jsx`
- [Report dashboard](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/DashboardPage.jsx): `frontend-web/src/pages/DashboardPage.jsx`
- [Create report](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/TambahLaporanPage.jsx): `frontend-web/src/pages/TambahLaporanPage.jsx`
- [Report discussion](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/DetailLaporanPage.jsx): `frontend-web/src/pages/DetailLaporanPage.jsx`
- [User administration](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/ManageUsersPage.jsx): `frontend-web/src/pages/ManageUsersPage.jsx`
- [Help directory](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/pages/HelpDirectoryPage.jsx): `frontend-web/src/pages/HelpDirectoryPage.jsx`
- [Report map](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/components/MapView.jsx): `frontend-web/src/components/MapView.jsx`
- [Web API client](https://github.com/kadez-406/lalapor/blob/main/frontend-web/src/services/api.js): `frontend-web/src/services/api.js`

### Mobile client

- [Mobile application](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/(tabs)/_layout.tsx): `frontend-mobile/src/app/(tabs)/_layout.tsx`
- [Mobile authentication](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/context/AuthContext.tsx): `frontend-mobile/src/context/AuthContext.tsx`
- [Browse reports](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/(tabs)/index.tsx): `frontend-mobile/src/app/(tabs)/index.tsx`
- [Create report](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/(tabs)/tambah.tsx): `frontend-mobile/src/app/(tabs)/tambah.tsx`
- [Report detail](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/laporan/%5Bid%5D.tsx): `frontend-mobile/src/app/laporan/[id].tsx`
- [Help directory](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/app/help.tsx): `frontend-mobile/src/app/help.tsx`
- [Mobile map](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/components/MyMapView.tsx): `frontend-mobile/src/components/MyMapView.tsx`
- [Mobile API client](https://github.com/kadez-406/lalapor/blob/main/frontend-mobile/src/services/api.ts): `frontend-mobile/src/services/api.ts`

### REST API

- [API server](https://github.com/kadez-406/lalapor/blob/main/backend/server.js): `backend/server.js`
- [Report endpoints](https://github.com/kadez-406/lalapor/blob/main/backend/routes/laporanRoutes.js): `backend/routes/laporanRoutes.js`
- [User endpoints](https://github.com/kadez-406/lalapor/blob/main/backend/routes/userRoutes.js): `backend/routes/userRoutes.js`
- [Category endpoints](https://github.com/kadez-406/lalapor/blob/main/backend/routes/categoryRoutes.js): `backend/routes/categoryRoutes.js`
- [Authentication endpoints](https://github.com/kadez-406/lalapor/blob/main/backend/routes/authRoutes.js): `backend/routes/authRoutes.js`

### Complaint domain

- [Report operations](https://github.com/kadez-406/lalapor/blob/main/backend/controllers/laporanController.js): `backend/controllers/laporanController.js`
- [User management](https://github.com/kadez-406/lalapor/blob/main/backend/controllers/userController.js): `backend/controllers/userController.js`
- [Comment operations](https://github.com/kadez-406/lalapor/blob/main/backend/controllers/commentController.js): `backend/controllers/commentController.js`
- [Category operations](https://github.com/kadez-406/lalapor/blob/main/backend/controllers/categoryController.js): `backend/controllers/categoryController.js`
- [Account operations](https://github.com/kadez-406/lalapor/blob/main/backend/controllers/authController.js): `backend/controllers/authController.js`

### Persistence

- [Domain models](https://github.com/kadez-406/lalapor/tree/main/backend/models): `backend/models`
- [MySQL connection](https://github.com/kadez-406/lalapor/blob/main/backend/config/database.js): `backend/config/database.js`

### Other components

- **Resident or staff**
- **MySQL database**

## Connections

- Resident or staff → Web application: uses web (evidence: `README.md`)
- Resident or staff → Mobile application: uses mobile (evidence: `README.md`)
- Web application → Web authentication: provides auth (evidence: `frontend-web/src/App.jsx`)
- Web application → Report dashboard: routes to (evidence: `frontend-web/src/App.jsx`)
- Web application → Create report: routes to (evidence: `frontend-web/src/App.jsx`)
- Web application → Report discussion: routes to (evidence: `frontend-web/src/App.jsx`)
- Web application → User administration: routes to (evidence: `frontend-web/src/App.jsx`)
- Web application → Help directory: routes to (evidence: `frontend-web/src/App.jsx`)
- Report dashboard → Web API client: requests data (evidence: `frontend-web/src/pages/DashboardPage.jsx`)
- Report discussion → Web API client: requests data (evidence: `frontend-web/src/pages/DetailLaporanPage.jsx`)
- Report dashboard → Report map: renders map (evidence: `frontend-web/src/pages/DashboardPage.jsx`)
- Report discussion → Report map: renders map (evidence: `frontend-web/src/pages/DetailLaporanPage.jsx`)
- Web API client → API server: calls REST API (evidence: `README.md`)
- Mobile application → Mobile authentication: provides auth
- Mobile application → Browse reports: routes to
- Mobile application → Create report: routes to
- Mobile application → Report detail: routes to
- Mobile application → Help directory: routes to
- Create report → Mobile map: selects location
- Mobile API client → API server: calls REST API (evidence: `README.md`)
- API server → Authentication endpoints: mounts routes (evidence: `backend/server.js`)
- API server → Report endpoints: mounts routes (evidence: `backend/server.js`)
- API server → User endpoints: mounts routes (evidence: `backend/server.js`)
- API server → Category endpoints: mounts routes (evidence: `backend/server.js`)
- Report endpoints → Report operations: dispatches requests (evidence: `backend/routes/laporanRoutes.js`)
- Report endpoints → Comment operations: dispatches comments (evidence: `backend/routes/laporanRoutes.js`)
- User endpoints → User management: dispatches requests (evidence: `backend/routes/userRoutes.js`)
- Category endpoints → Category operations: dispatches requests (evidence: `backend/routes/categoryRoutes.js`)
- Authentication endpoints → Account operations: dispatches requests (evidence: `backend/routes/authRoutes.js`)
- Report operations → Domain models: queries models (evidence: `backend/controllers/laporanController.js`)
- User management → Domain models: queries models (evidence: `backend/controllers/userController.js`)
- Domain models → MySQL connection: uses connection (evidence: `backend/models/index.js`)
- API server → Domain models: syncs models (evidence: `backend/server.js`)
- MySQL connection → MySQL database: connects to (evidence: `backend/config/database.js`)
- Resident or staff → Report map: pins location (evidence: `README.md`)
- Resident or staff → Mobile map: pins location (evidence: `README.md`)
