# kamrul377/bill-apps architecture

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

- Interactive diagram: https://gitdiagram.com/kamrul377/bill-apps
- Repository: https://github.com/kamrul377/bill-apps

## Overview

FnF Online Travel Pay is a role-aware bill payment and approval console, with separate client/network inventory and operational history views. The primary workflow is staff sign-in, bill creation, review and approval, then recording payment; the dashboard also supports categories, staff administration, exports, and reporting. Client records, points of contact (POCs), and system logs form a distinct operations branch. The source excerpts show the dashboard’s category request and bill API persistence calls; other UI-to-API links are not asserted where source evidence was unavailable.

Main entry points: [`lib/db.ts`](https://github.com/kamrul377/bill-apps/blob/main/lib/db.ts) (Data Access Layer), [`app/page.tsx`](https://github.com/kamrul377/bill-apps/blob/main/app/page.tsx) (Console Dashboard), [`app/client-info/page.tsx`](https://github.com/kamrul377/bill-apps/blob/main/app/client-info/page.tsx) (Client Inventory), [`components/ProtectedRoute.tsx`](https://github.com/kamrul377/bill-apps/blob/main/components/ProtectedRoute.tsx) (Route Guard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Payment Console"]
  node_dashboard["Console Dashboard<br/>[page.tsx]"]
  node_login["Sign-in View<br/>[LoginView.tsx]"]
  node_createbill["Bill Creation<br/>[CreateBillView.tsx]"]
  node_pending["Pending Review"]
  node_approved["Approved Bills"]
  node_billdetail["Bill Details"]
  node_voucher["Payment Voucher"]
  node_dashboardview["Dashboard Reports<br/>[DashboardView.tsx]"]
  node_amountcharts["Amount Charts<br/>[AmountCharts.tsx]"]
  node_history["Paid History"]
  node_usersview["Staff Management"]
  node_protected["Route Guard<br/>[ProtectedRoute.tsx]"]
end

subgraph group_api["Application APIs"]
  node_loginapi["Login API<br/>[route.ts]"]
  node_billsapi["Bills API<br/>[route.ts]"]
  node_billidapi["Bill Record API<br/>[route.ts]"]
  node_exportapi["Bill Export API<br/>[route.ts]"]
  node_categoriesapi["Categories API<br/>[route.ts]"]
  node_categoryidapi["Category Record API<br/>[route.ts]"]
  node_usersapi["Users API<br/>[route.ts]"]
  node_useridapi["User Record API<br/>[route.ts]"]
  node_clientsapi["Client Records API<br/>[route.ts]"]
  node_clientidapi["Client Record API<br/>[route.ts]"]
  node_pocsapi["POC API<br/>[route.ts]"]
  node_pocidapi["POC Record API<br/>[route.ts]"]
  node_logsapi["System Logs API<br/>[route.ts]"]
  node_dbstatus["Database Status API<br/>[route.ts]"]
end

subgraph group_data["Persistence"]
  node_db["Data Access Layer<br/>[db.ts]"]
  node_mysql[("MySQL Database")]
end

subgraph group_ops["Client Operations"]
  node_clientpage["Client Inventory<br/>[page.tsx]"]
  node_clientmodal["Client Details"]
  node_pocview["POC Management<br/>[PocManagement.tsx]"]
  node_systemlog["Log Viewer<br/>[page.tsx]"]
  node_clienttypes["Client Data Types<br/>[client.ts]"]
end

node_staff(("Staff"))

node_staff -->|"uses"| node_dashboard
node_dashboard -->|"renders"| node_login
node_dashboard -->|"renders"| node_createbill
node_dashboard -->|"renders"| node_pending
node_dashboard -->|"renders"| node_approved
node_dashboard -->|"renders"| node_dashboardview
node_dashboard -->|"renders"| node_billdetail
node_dashboard -->|"renders"| node_voucher
node_dashboard -->|"renders"| node_usersview
node_dashboard -->|"requests"| node_categoriesapi
node_billsapi -->|"calls"| node_db
node_billidapi -->|"calls"| node_db
node_exportapi -->|"calls"| node_db
node_loginapi -->|"calls"| node_db
node_usersapi -->|"calls"| node_db
node_categoryidapi -->|"calls"| node_db
node_categoriesapi -->|"calls"| node_db
node_clientsapi -->|"uses pool"| node_db
node_clientidapi -->|"calls"| node_db
node_pocsapi -->|"calls"| node_db
node_pocidapi -->|"calls"| node_db
node_logsapi -->|"calls"| node_db
node_useridapi -->|"calls"| node_db
node_db -->|"queries"| node_mysql
node_dashboardview -->|"renders"| node_amountcharts
node_history -->|"guards"| node_protected
node_clientpage -->|"guards"| node_protected
node_clientpage -->|"renders"| node_clientmodal
node_clientmodal -->|"uses types"| node_clienttypes
node_clientpage -->|"uses types"| node_clienttypes
node_systemlog -->|"guards"| node_protected

click node_dashboard "https://github.com/kamrul377/bill-apps/blob/main/app/page.tsx"
click node_login "https://github.com/kamrul377/bill-apps/blob/main/components/LoginView.tsx"
click node_createbill "https://github.com/kamrul377/bill-apps/blob/main/components/CreateBillView.tsx"
click node_pending "https://github.com/kamrul377/bill-apps/blob/main/components/PendingApprovalView.tsx"
click node_approved "https://github.com/kamrul377/bill-apps/blob/main/components/ApprovedBillsView.tsx"
click node_billdetail "https://github.com/kamrul377/bill-apps/blob/main/components/BillDetailModal.tsx"
click node_voucher "https://github.com/kamrul377/bill-apps/blob/main/components/BillVoucherModal.tsx"
click node_dashboardview "https://github.com/kamrul377/bill-apps/blob/main/components/DashboardView.tsx"
click node_amountcharts "https://github.com/kamrul377/bill-apps/blob/main/components/AmountCharts.tsx"
click node_history "https://github.com/kamrul377/bill-apps/blob/main/app/paid-history/PaidHistoryClient.tsx"
click node_usersview "https://github.com/kamrul377/bill-apps/blob/main/components/UserManagementView.tsx"
click node_protected "https://github.com/kamrul377/bill-apps/blob/main/components/ProtectedRoute.tsx"
click node_loginapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/auth/login/route.ts"
click node_billsapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/bills/route.ts"
click node_billidapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/bills/%5Bid%5D/route.ts"
click node_exportapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/bills/export/route.ts"
click node_categoriesapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/categories/route.ts"
click node_categoryidapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/categories/%5Bid%5D/route.ts"
click node_usersapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/users/route.ts"
click node_useridapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/users/%5Bid%5D/route.ts"
click node_clientsapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/clients/route.ts"
click node_clientidapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/clients/%5Bid%5D/route.ts"
click node_pocsapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/pocs/route.ts"
click node_pocidapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/pocs/%5Bid%5D/route.ts"
click node_logsapi "https://github.com/kamrul377/bill-apps/blob/main/app/api/logs/route.ts"
click node_dbstatus "https://github.com/kamrul377/bill-apps/blob/main/app/api/db-status/route.ts"
click node_db "https://github.com/kamrul377/bill-apps/blob/main/lib/db.ts"
click node_clientpage "https://github.com/kamrul377/bill-apps/blob/main/app/client-info/page.tsx"
click node_clientmodal "https://github.com/kamrul377/bill-apps/blob/main/components/ClientDetailsModal.tsx"
click node_pocview "https://github.com/kamrul377/bill-apps/blob/main/components/PocManagement.tsx"
click node_systemlog "https://github.com/kamrul377/bill-apps/blob/main/app/client-info/system-log/page.tsx"
click node_clienttypes "https://github.com/kamrul377/bill-apps/blob/main/types/client.ts"

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_dashboard,node_login,node_createbill,node_pending,node_approved,node_billdetail,node_voucher,node_dashboardview,node_amountcharts,node_history,node_usersview,node_protected toneBlue
class node_loginapi,node_billsapi,node_billidapi,node_exportapi,node_categoriesapi,node_categoryidapi,node_usersapi,node_useridapi,node_clientsapi,node_clientidapi,node_pocsapi,node_pocidapi,node_logsapi,node_dbstatus toneAmber
class node_db,node_mysql toneMint
class node_clientpage,node_clientmodal,node_pocview,node_systemlog,node_clienttypes toneRose
class node_staff toneIndigo
```

## Components

### Payment Console

- [Console Dashboard](https://github.com/kamrul377/bill-apps/blob/main/app/page.tsx): `app/page.tsx`
- [Sign-in View](https://github.com/kamrul377/bill-apps/blob/main/components/LoginView.tsx): `components/LoginView.tsx`
- [Bill Creation](https://github.com/kamrul377/bill-apps/blob/main/components/CreateBillView.tsx): `components/CreateBillView.tsx`
- [Pending Review](https://github.com/kamrul377/bill-apps/blob/main/components/PendingApprovalView.tsx): `components/PendingApprovalView.tsx`
- [Approved Bills](https://github.com/kamrul377/bill-apps/blob/main/components/ApprovedBillsView.tsx): `components/ApprovedBillsView.tsx`
- [Bill Details](https://github.com/kamrul377/bill-apps/blob/main/components/BillDetailModal.tsx): `components/BillDetailModal.tsx`
- [Payment Voucher](https://github.com/kamrul377/bill-apps/blob/main/components/BillVoucherModal.tsx): `components/BillVoucherModal.tsx`
- [Dashboard Reports](https://github.com/kamrul377/bill-apps/blob/main/components/DashboardView.tsx): `components/DashboardView.tsx`
- [Amount Charts](https://github.com/kamrul377/bill-apps/blob/main/components/AmountCharts.tsx): `components/AmountCharts.tsx`
- [Paid History](https://github.com/kamrul377/bill-apps/blob/main/app/paid-history/PaidHistoryClient.tsx): `app/paid-history/PaidHistoryClient.tsx`
- [Staff Management](https://github.com/kamrul377/bill-apps/blob/main/components/UserManagementView.tsx): `components/UserManagementView.tsx`
- [Route Guard](https://github.com/kamrul377/bill-apps/blob/main/components/ProtectedRoute.tsx): `components/ProtectedRoute.tsx`

### Application APIs

- [Login API](https://github.com/kamrul377/bill-apps/blob/main/app/api/auth/login/route.ts): `app/api/auth/login/route.ts`
- [Bills API](https://github.com/kamrul377/bill-apps/blob/main/app/api/bills/route.ts): `app/api/bills/route.ts`
- [Bill Record API](https://github.com/kamrul377/bill-apps/blob/main/app/api/bills/%5Bid%5D/route.ts): `app/api/bills/[id]/route.ts`
- [Bill Export API](https://github.com/kamrul377/bill-apps/blob/main/app/api/bills/export/route.ts): `app/api/bills/export/route.ts`
- [Categories API](https://github.com/kamrul377/bill-apps/blob/main/app/api/categories/route.ts): `app/api/categories/route.ts`
- [Category Record API](https://github.com/kamrul377/bill-apps/blob/main/app/api/categories/%5Bid%5D/route.ts): `app/api/categories/[id]/route.ts`
- [Users API](https://github.com/kamrul377/bill-apps/blob/main/app/api/users/route.ts): `app/api/users/route.ts`
- [User Record API](https://github.com/kamrul377/bill-apps/blob/main/app/api/users/%5Bid%5D/route.ts): `app/api/users/[id]/route.ts`
- [Client Records API](https://github.com/kamrul377/bill-apps/blob/main/app/api/clients/route.ts): `app/api/clients/route.ts`
- [Client Record API](https://github.com/kamrul377/bill-apps/blob/main/app/api/clients/%5Bid%5D/route.ts): `app/api/clients/[id]/route.ts`
- [POC API](https://github.com/kamrul377/bill-apps/blob/main/app/api/pocs/route.ts): `app/api/pocs/route.ts`
- [POC Record API](https://github.com/kamrul377/bill-apps/blob/main/app/api/pocs/%5Bid%5D/route.ts): `app/api/pocs/[id]/route.ts`
- [System Logs API](https://github.com/kamrul377/bill-apps/blob/main/app/api/logs/route.ts): `app/api/logs/route.ts`
- [Database Status API](https://github.com/kamrul377/bill-apps/blob/main/app/api/db-status/route.ts): `app/api/db-status/route.ts`

### Persistence

- [Data Access Layer](https://github.com/kamrul377/bill-apps/blob/main/lib/db.ts): `lib/db.ts`
- **MySQL Database**

### Client Operations

- [Client Inventory](https://github.com/kamrul377/bill-apps/blob/main/app/client-info/page.tsx): `app/client-info/page.tsx`
- [Client Details](https://github.com/kamrul377/bill-apps/blob/main/components/ClientDetailsModal.tsx): `components/ClientDetailsModal.tsx`
- [POC Management](https://github.com/kamrul377/bill-apps/blob/main/components/PocManagement.tsx): `components/PocManagement.tsx`
- [Log Viewer](https://github.com/kamrul377/bill-apps/blob/main/app/client-info/system-log/page.tsx): `app/client-info/system-log/page.tsx`
- [Client Data Types](https://github.com/kamrul377/bill-apps/blob/main/types/client.ts): `types/client.ts`

### Other components

- **Staff**

## Connections

- Staff → Console Dashboard: uses
- Console Dashboard → Sign-in View: renders (evidence: `app/page.tsx`)
- Console Dashboard → Bill Creation: renders (evidence: `app/page.tsx`)
- Console Dashboard → Pending Review: renders (evidence: `app/page.tsx`)
- Console Dashboard → Approved Bills: renders (evidence: `app/page.tsx`)
- Console Dashboard → Dashboard Reports: renders (evidence: `app/page.tsx`)
- Console Dashboard → Bill Details: renders (evidence: `app/page.tsx`)
- Console Dashboard → Payment Voucher: renders (evidence: `app/page.tsx`)
- Console Dashboard → Staff Management: renders (evidence: `app/page.tsx`)
- Console Dashboard → Categories API: requests (evidence: `app/page.tsx`)
- Bills API → Data Access Layer: calls (evidence: `app/api/bills/route.ts`)
- Bill Record API → Data Access Layer: calls (evidence: `app/api/bills/[id]/route.ts`)
- Bill Export API → Data Access Layer: calls (evidence: `app/api/bills/export/route.ts`)
- Login API → Data Access Layer: calls (evidence: `app/api/auth/login/route.ts`)
- Users API → Data Access Layer: calls (evidence: `app/api/users/route.ts`)
- Category Record API → Data Access Layer: calls (evidence: `app/api/categories/[id]/route.ts`)
- Categories API → Data Access Layer: calls (evidence: `app/api/categories/route.ts`)
- Client Records API → Data Access Layer: uses pool (evidence: `app/api/clients/route.ts`)
- Client Record API → Data Access Layer: calls (evidence: `app/api/clients/[id]/route.ts`)
- POC API → Data Access Layer: calls (evidence: `app/api/pocs/route.ts`)
- POC Record API → Data Access Layer: calls (evidence: `app/api/pocs/[id]/route.ts`)
- System Logs API → Data Access Layer: calls (evidence: `app/api/logs/route.ts`)
- User Record API → Data Access Layer: calls (evidence: `app/api/users/[id]/route.ts`)
- Data Access Layer → MySQL Database: queries (evidence: `lib/db.ts`)
- Dashboard Reports → Amount Charts: renders (evidence: `components/DashboardView.tsx`)
- Paid History → Route Guard: guards (evidence: `app/paid-history/PaidHistoryClient.tsx`)
- Client Inventory → Route Guard: guards (evidence: `app/client-info/page.tsx`)
- Client Inventory → Client Details: renders (evidence: `app/client-info/page.tsx`)
- Client Details → Client Data Types: uses types (evidence: `components/ClientDetailsModal.tsx`)
- Client Inventory → Client Data Types: uses types (evidence: `app/client-info/page.tsx`)
- Log Viewer → Route Guard: guards (evidence: `app/client-info/system-log/page.tsx`)
