# techcharge-iq/payrollsheet architecture

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

- Interactive diagram: https://gitdiagram.com/techcharge-iq/payrollsheet
- Repository: https://github.com/techcharge-iq/payrollsheet

## Overview

Payroll Companion is a role-based workforce and payroll application. Users sign in, enter employee and attendance data, prepare monthly payroll batches, and review or export payroll results. The app also supports advances, cost allocation, workforce and project management, attendance review, audit history, and WPS exports. The graph reflects documented capabilities even where their component source was not sampled; those feature links are based on the route index, while unsampled implementation details and some data flows are left unspecified.

Main entry points: [`src/routes/index.tsx`](https://github.com/techcharge-iq/payrollsheet/blob/main/src/routes/index.tsx) (Payroll workspace), [`src/lib/payroll-data.ts`](https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/payroll-data.ts) (Payroll data access), [`src/integrations/supabase/external-client.ts`](https://github.com/techcharge-iq/payrollsheet/blob/main/src/integrations/supabase/external-client.ts) (Supabase client), [`src/components/payroll/PayrollTab.tsx`](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/PayrollTab.tsx) (Monthly payroll)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_workspace["Payroll workspace<br/>[index.tsx]"]
  node_login["Sign-in<br/>[LoginPage.tsx]"]
end

subgraph group_payroll["Payroll operations"]
  node_employees["Employees<br/>[EmployeesTab.tsx]"]
  node_payroll_batches["Monthly payroll<br/>[PayrollTab.tsx]"]
  node_employee_history["Employee history<br/>[HistoryTab.tsx]"]
  node_salary_slips["Salary slips<br/>[SlipsTab.tsx]"]
  node_advances["Advances<br/>[AdvancesTab.tsx]"]
  node_cost_allocation["Cost allocation<br/>[CostTab.tsx]"]
  node_cost_details["Cost details"]
  node_wps["WPS export<br/>[WpsExportTab.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardTab.tsx]"]
end

subgraph group_attendance["Attendance and workforce"]
  node_timesheets["Daily timesheets<br/>[TimesheetsTab.tsx]"]
  node_attendance_dialog["Attendance editor"]
  node_attendance_reports["Attendance reports"]
  node_attendance_review["AI attendance review"]
  node_workforce["Workforce and leave<br/>[WorkforceTab.tsx]"]
end

subgraph group_management["Management and access"]
  node_management["Users and projects<br/>[ManagementTab.tsx]"]
  node_audit["Audit history"]
end

subgraph group_data["Data and services"]
  node_payroll_logic["Payroll calculations<br/>[payroll.ts]"]
  node_payroll_data["Payroll data access<br/>[payroll-data.ts]"]
  node_cache["Local data cache<br/>[payroll-cache.ts]"]
  node_management_data["Management data access<br/>[management-data.ts]"]
  node_supabase_client["Supabase client<br/>[external-client.ts]"]
  node_supabase[("Supabase database")]
end

node_user(("Payroll user"))
node_ai_gateway["Vercel AI Gateway"]

node_user -->|"uses"| node_workspace
node_workspace -->|"shows when signed out"| node_login
node_workspace -->|"routes to"| node_employees
node_workspace -->|"routes to"| node_payroll_batches
node_workspace -->|"routes to"| node_employee_history
node_workspace -->|"routes to"| node_salary_slips
node_workspace -->|"routes to"| node_advances
node_workspace -->|"routes to"| node_cost_allocation
node_workspace -->|"routes to"| node_wps
node_workspace -->|"routes to"| node_timesheets
node_workspace -->|"routes to"| node_attendance_reports
node_workspace -->|"routes to"| node_workforce
node_workspace -->|"routes to"| node_management
node_workspace -->|"routes to"| node_audit
node_workspace -->|"routes to"| node_dashboard
node_payroll_batches -->|"calculates pay"| node_payroll_logic
node_payroll_batches -->|"reads and saves"| node_payroll_data
node_payroll_batches -.->|"opens details"| node_cost_details
node_cost_allocation -->|"opens details"| node_cost_details
node_timesheets -->|"opens editor"| node_attendance_dialog
node_timesheets -->|"reads attendance data"| node_payroll_data
node_attendance_review -->|"uses client"| node_supabase_client
node_attendance_review -->|"requests review"| node_ai_gateway
node_payroll_data -->|"uses calculations"| node_payroll_logic
node_payroll_data -->|"writes cached rows"| node_cache
node_payroll_data -->|"queries and writes"| node_supabase_client
node_management -->|"loads management data"| node_management_data
node_management -->|"uses client"| node_supabase_client
node_management_data -->|"queries data"| node_supabase_client
node_supabase_client -->|"connects to"| node_supabase
node_attendance_reports -->|"reads attendance data"| node_payroll_data

click node_workspace "https://github.com/techcharge-iq/payrollsheet/blob/main/src/routes/index.tsx"
click node_login "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/LoginPage.tsx"
click node_employees "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/EmployeesTab.tsx"
click node_payroll_batches "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/PayrollTab.tsx"
click node_employee_history "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/HistoryTab.tsx"
click node_salary_slips "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/SlipsTab.tsx"
click node_advances "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/AdvancesTab.tsx"
click node_cost_allocation "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/CostTab.tsx"
click node_cost_details "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/CostDetailsModal.tsx"
click node_wps "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/WpsExportTab.tsx"
click node_timesheets "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/TimesheetsTab.tsx"
click node_attendance_dialog "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/MonthlyAttendanceDialog.tsx"
click node_attendance_reports "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/AttendanceReportTab.tsx"
click node_attendance_review "https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/attendance-review.functions.ts"
click node_workforce "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/WorkforceTab.tsx"
click node_management "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/ManagementTab.tsx"
click node_audit "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/AuditHistoryTab.tsx"
click node_payroll_logic "https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/payroll.ts"
click node_payroll_data "https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/payroll-data.ts"
click node_cache "https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/payroll-cache.ts"
click node_management_data "https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/management-data.ts"
click node_supabase_client "https://github.com/techcharge-iq/payrollsheet/blob/main/src/integrations/supabase/external-client.ts"
click node_dashboard "https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/DashboardTab.tsx"

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_workspace,node_login,node_user toneBlue
class node_employees,node_payroll_batches,node_employee_history,node_salary_slips,node_advances,node_cost_allocation,node_cost_details,node_wps,node_dashboard toneAmber
class node_timesheets,node_attendance_dialog,node_attendance_reports,node_attendance_review,node_workforce toneMint
class node_management,node_audit toneRose
class node_payroll_logic,node_payroll_data,node_cache,node_management_data,node_supabase_client,node_supabase,node_ai_gateway toneIndigo
```

## Components

### Application

- [Payroll workspace](https://github.com/techcharge-iq/payrollsheet/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Sign-in](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/LoginPage.tsx): `src/components/payroll/LoginPage.tsx`

### Payroll operations

- [Employees](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/EmployeesTab.tsx): `src/components/payroll/EmployeesTab.tsx`
- [Monthly payroll](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/PayrollTab.tsx): `src/components/payroll/PayrollTab.tsx`
- [Employee history](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/HistoryTab.tsx): `src/components/payroll/HistoryTab.tsx`
- [Salary slips](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/SlipsTab.tsx): `src/components/payroll/SlipsTab.tsx`
- [Advances](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/AdvancesTab.tsx): `src/components/payroll/AdvancesTab.tsx`
- [Cost allocation](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/CostTab.tsx): `src/components/payroll/CostTab.tsx`
- [Cost details](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/CostDetailsModal.tsx): `src/components/payroll/CostDetailsModal.tsx`
- [WPS export](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/WpsExportTab.tsx): `src/components/payroll/WpsExportTab.tsx`
- [Dashboard](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/DashboardTab.tsx): `src/components/payroll/DashboardTab.tsx`

### Attendance and workforce

- [Daily timesheets](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/TimesheetsTab.tsx): `src/components/payroll/TimesheetsTab.tsx`
- [Attendance editor](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/MonthlyAttendanceDialog.tsx): `src/components/payroll/MonthlyAttendanceDialog.tsx`
- [Attendance reports](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/AttendanceReportTab.tsx): `src/components/payroll/AttendanceReportTab.tsx`
- [AI attendance review](https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/attendance-review.functions.ts): `src/lib/attendance-review.functions.ts`
- [Workforce and leave](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/WorkforceTab.tsx): `src/components/payroll/WorkforceTab.tsx`

### Management and access

- [Users and projects](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/ManagementTab.tsx): `src/components/payroll/ManagementTab.tsx`
- [Audit history](https://github.com/techcharge-iq/payrollsheet/blob/main/src/components/payroll/AuditHistoryTab.tsx): `src/components/payroll/AuditHistoryTab.tsx`

### Data and services

- [Payroll calculations](https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/payroll.ts): `src/lib/payroll.ts`
- [Payroll data access](https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/payroll-data.ts): `src/lib/payroll-data.ts`
- [Local data cache](https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/payroll-cache.ts): `src/lib/payroll-cache.ts`
- [Management data access](https://github.com/techcharge-iq/payrollsheet/blob/main/src/lib/management-data.ts): `src/lib/management-data.ts`
- [Supabase client](https://github.com/techcharge-iq/payrollsheet/blob/main/src/integrations/supabase/external-client.ts): `src/integrations/supabase/external-client.ts`
- **Supabase database**

### Other components

- **Payroll user**
- **Vercel AI Gateway**

## Connections

- Payroll user → Payroll workspace: uses (evidence: `src/routes/index.tsx`)
- Payroll workspace → Sign-in: shows when signed out (evidence: `src/routes/index.tsx`)
- Payroll workspace → Employees: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Monthly payroll: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Employee history: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Salary slips: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Advances: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Cost allocation: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → WPS export: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Daily timesheets: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Attendance reports: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Workforce and leave: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Users and projects: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Audit history: routes to (evidence: `src/routes/index.tsx`)
- Payroll workspace → Dashboard: routes to (evidence: `src/routes/index.tsx`)
- Monthly payroll → Payroll calculations: calculates pay (evidence: `src/components/payroll/PayrollTab.tsx`)
- Monthly payroll → Payroll data access: reads and saves (evidence: `src/components/payroll/PayrollTab.tsx`)
- Monthly payroll → Cost details: opens details
- Cost allocation → Cost details: opens details (evidence: `src/components/payroll/CostTab.tsx`)
- Daily timesheets → Attendance editor: opens editor (evidence: `src/components/payroll/TimesheetsTab.tsx`)
- Daily timesheets → Payroll data access: reads attendance data (evidence: `src/components/payroll/TimesheetsTab.tsx`)
- AI attendance review → Supabase client: uses client (evidence: `src/lib/attendance-review.functions.ts`)
- AI attendance review → Vercel AI Gateway: requests review (evidence: `README.md`)
- Payroll data access → Payroll calculations: uses calculations (evidence: `src/lib/payroll-data.ts`)
- Payroll data access → Local data cache: writes cached rows (evidence: `src/lib/payroll-data.ts`)
- Payroll data access → Supabase client: queries and writes (evidence: `src/lib/payroll-data.ts`)
- Users and projects → Management data access: loads management data (evidence: `src/components/payroll/ManagementTab.tsx`)
- Users and projects → Supabase client: uses client (evidence: `src/components/payroll/ManagementTab.tsx`)
- Management data access → Supabase client: queries data (evidence: `src/lib/management-data.ts`)
- Supabase client → Supabase database: connects to (evidence: `src/integrations/supabase/external-client.ts`)
- Attendance reports → Payroll data access: reads attendance data (evidence: `src/components/payroll/AttendanceReportTab.tsx`)
