# itsnatch22/eaziwageapp architecture

> Architecture diagram of the GitHub repository itsnatch22/eaziwageapp, 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/itsnatch22/eaziwageapp
- Repository: https://github.com/itsnatch22/eaziwageapp

## Overview

EaziWage is an earned-wage-access platform connecting employees, employers, and administrators to advance requests, approvals, real-money disbursement, and payday repayment. The principal employee workflow submits an advance request, checks fraud risk, reserves employer funds, and disburses through DusuPay; callbacks and scheduled reconciliation resolve payment outcomes. Documented supporting areas include employer payroll and funding, KYC, risk review, wallets, reporting, authentication, and notifications. The graph combines README-described flows with relationships visible in sampled source; unsampled dashboard-to-API links are omitted or marked unverified.

Main entry points: [`app/admin`](https://github.com/itsnatch22/eaziwageapp/tree/main/app/admin) (Admin dashboard), [`lib/supabaseAdmin.ts`](https://github.com/itsnatch22/eaziwageapp/blob/main/lib/supabaseAdmin.ts) (Supabase data), [`app/dashboards/employee-dashboard`](https://github.com/itsnatch22/eaziwageapp/tree/main/app/dashboards/employee-dashboard) (Employee dashboard), [`app/dashboards/employer-dashboard`](https://github.com/itsnatch22/eaziwageapp/tree/main/app/dashboards/employer-dashboard) (Employer dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and dashboards"]
  node_employee_ui["Employee dashboard"]
  node_employer_ui["Employer dashboard"]
  node_admin_ui["Admin dashboard"]
  node_auth["Authentication"]
end

subgraph group_advance["Advance lifecycle"]
  node_advance_request["Advance request<br/>[route.ts]"]
  node_fraud["Fraud screening<br/>[fraud-engine.ts]"]
  node_approval["Advance approval"]
  node_payout["Payout service<br/>[payout-service.ts]"]
end

subgraph group_funds["Funding and repayment"]
  node_dusupay{{"DusuPay gateway"}}
  node_webhook["Payment callbacks<br/>[route.ts]"]
  node_employer_wallet[("Employer wallet<br/>[route.ts]")]
  node_recoupment["Payday recoupment"]
  node_reconciliation["Payment reconciliation<br/>[route.ts]"]
  node_stanbic{{"Stanbic banking<br/>[client.ts]"}}
end

subgraph group_operations["Operations and compliance"]
  node_kyc["KYC review"]
  node_payroll["Payroll management"]
  node_risk_ops["Risk and fraud review"]
  node_reporting["Reporting and reconciliation"]
end

subgraph group_platform["Platform services"]
  node_supabase[("Supabase data<br/>[supabaseAdmin.ts]")]
  node_notifications["Notification service<br/>[notifications.ts]"]
  node_realtime["Realtime refresh"]
end

node_employee(("Employee"))
node_employer(("Employer"))
node_admin(("Administrator"))

node_employee -->|"uses"| node_employee_ui
node_employer -->|"uses"| node_employer_ui
node_admin -->|"uses"| node_admin_ui
node_employee_ui -.->|"authenticates"| node_auth
node_employer_ui -.->|"authenticates"| node_auth
node_admin_ui -.->|"authenticates"| node_auth
node_employee_ui -.->|"submits request"| node_advance_request
node_advance_request -->|"checks risk"| node_fraud
node_advance_request -->|"tries approval"| node_approval
node_approval -->|"disburses"| node_payout
node_payout -->|"sends funds"| node_dusupay
node_payout -->|"reserves funds"| node_employer_wallet
node_dusupay -->|"sends callbacks"| node_webhook
node_webhook -->|"updates payments"| node_supabase
node_webhook -->|"applies collection"| node_recoupment
node_webhook -->|"notifies users"| node_notifications
node_recoupment -->|"collects liability"| node_dusupay
node_reconciliation -->|"checks status"| node_dusupay
node_reconciliation -->|"records drift"| node_supabase
node_reconciliation -->|"alerts operations"| node_notifications
node_employer_ui -.->|"manages payroll"| node_payroll
node_admin_ui -.->|"reviews documents"| node_kyc
node_admin_ui -.->|"reviews risk"| node_risk_ops
node_admin_ui -.->|"views reports"| node_reporting
node_admin_ui -.->|"manages funding"| node_employer_wallet
node_kyc -.->|"reviews records"| node_supabase
node_risk_ops -.->|"reviews alerts"| node_supabase
node_reporting -.->|"reads records"| node_supabase
node_stanbic -->|"records deposits"| node_employer_wallet
node_notifications -->|"writes notices"| node_supabase
node_employee_ui -.->|"refreshes live"| node_realtime
node_employer_ui -.->|"refreshes live"| node_realtime
node_admin_ui -.->|"refreshes live"| node_realtime

click node_employee_ui "https://github.com/itsnatch22/eaziwageapp/tree/main/app/dashboards/employee-dashboard"
click node_employer_ui "https://github.com/itsnatch22/eaziwageapp/tree/main/app/dashboards/employer-dashboard"
click node_admin_ui "https://github.com/itsnatch22/eaziwageapp/tree/main/app/admin"
click node_auth "https://github.com/itsnatch22/eaziwageapp/tree/main/app/api/auth"
click node_advance_request "https://github.com/itsnatch22/eaziwageapp/blob/main/app/api/employee-dashboard/request-advance/route.ts"
click node_fraud "https://github.com/itsnatch22/eaziwageapp/blob/main/lib/fraud-engine.ts"
click node_approval "https://github.com/itsnatch22/eaziwageapp/blob/main/lib/services/advance-approval.ts"
click node_payout "https://github.com/itsnatch22/eaziwageapp/blob/main/lib/services/payout-service.ts"
click node_webhook "https://github.com/itsnatch22/eaziwageapp/blob/main/app/api/webhook/dusupay/route.ts"
click node_employer_wallet "https://github.com/itsnatch22/eaziwageapp/blob/main/app/api/employer-dashboard/wallet/route.ts"
click node_recoupment "https://github.com/itsnatch22/eaziwageapp/blob/main/lib/services/payday-recoupment-service.ts"
click node_reconciliation "https://github.com/itsnatch22/eaziwageapp/blob/main/app/api/cron/reconcile-dusupay/route.ts"
click node_kyc "https://github.com/itsnatch22/eaziwageapp/blob/main/app/admin/kyc-review/KycReviewClient.tsx"
click node_payroll "https://github.com/itsnatch22/eaziwageapp/tree/main/app/api/employer-dashboard/payroll"
click node_risk_ops "https://github.com/itsnatch22/eaziwageapp/blob/main/app/admin/fraud-detection/FraudDetectionClient.tsx"
click node_reporting "https://github.com/itsnatch22/eaziwageapp/tree/main/app/api/admin/reports"
click node_supabase "https://github.com/itsnatch22/eaziwageapp/blob/main/lib/supabaseAdmin.ts"
click node_notifications "https://github.com/itsnatch22/eaziwageapp/blob/main/lib/notifications.ts"
click node_realtime "https://github.com/itsnatch22/eaziwageapp/blob/main/hooks/useRealtimeRefresh.ts"
click node_stanbic "https://github.com/itsnatch22/eaziwageapp/blob/main/lib/stanbic/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_employee_ui,node_employer_ui,node_admin_ui,node_auth toneBlue
class node_advance_request,node_fraud,node_approval,node_payout toneAmber
class node_dusupay,node_webhook,node_employer_wallet,node_recoupment,node_reconciliation,node_stanbic toneMint
class node_kyc,node_payroll,node_risk_ops,node_reporting toneRose
class node_supabase,node_notifications,node_realtime,node_employee,node_employer,node_admin toneIndigo
```

## Components

### Access and dashboards

- [Employee dashboard](https://github.com/itsnatch22/eaziwageapp/tree/main/app/dashboards/employee-dashboard): `app/dashboards/employee-dashboard`
- [Employer dashboard](https://github.com/itsnatch22/eaziwageapp/tree/main/app/dashboards/employer-dashboard): `app/dashboards/employer-dashboard`
- [Admin dashboard](https://github.com/itsnatch22/eaziwageapp/tree/main/app/admin): `app/admin`
- [Authentication](https://github.com/itsnatch22/eaziwageapp/tree/main/app/api/auth): `app/api/auth`

### Advance lifecycle

- [Advance request](https://github.com/itsnatch22/eaziwageapp/blob/main/app/api/employee-dashboard/request-advance/route.ts): `app/api/employee-dashboard/request-advance/route.ts`
- [Fraud screening](https://github.com/itsnatch22/eaziwageapp/blob/main/lib/fraud-engine.ts): `lib/fraud-engine.ts`
- [Advance approval](https://github.com/itsnatch22/eaziwageapp/blob/main/lib/services/advance-approval.ts): `lib/services/advance-approval.ts`
- [Payout service](https://github.com/itsnatch22/eaziwageapp/blob/main/lib/services/payout-service.ts): `lib/services/payout-service.ts`

### Funding and repayment

- **DusuPay gateway**
- [Payment callbacks](https://github.com/itsnatch22/eaziwageapp/blob/main/app/api/webhook/dusupay/route.ts): `app/api/webhook/dusupay/route.ts`
- [Employer wallet](https://github.com/itsnatch22/eaziwageapp/blob/main/app/api/employer-dashboard/wallet/route.ts): `app/api/employer-dashboard/wallet/route.ts`
- [Payday recoupment](https://github.com/itsnatch22/eaziwageapp/blob/main/lib/services/payday-recoupment-service.ts): `lib/services/payday-recoupment-service.ts`
- [Payment reconciliation](https://github.com/itsnatch22/eaziwageapp/blob/main/app/api/cron/reconcile-dusupay/route.ts): `app/api/cron/reconcile-dusupay/route.ts`
- [Stanbic banking](https://github.com/itsnatch22/eaziwageapp/blob/main/lib/stanbic/client.ts): `lib/stanbic/client.ts`

### Operations and compliance

- [KYC review](https://github.com/itsnatch22/eaziwageapp/blob/main/app/admin/kyc-review/KycReviewClient.tsx): `app/admin/kyc-review/KycReviewClient.tsx`
- [Payroll management](https://github.com/itsnatch22/eaziwageapp/tree/main/app/api/employer-dashboard/payroll): `app/api/employer-dashboard/payroll`
- [Risk and fraud review](https://github.com/itsnatch22/eaziwageapp/blob/main/app/admin/fraud-detection/FraudDetectionClient.tsx): `app/admin/fraud-detection/FraudDetectionClient.tsx`
- [Reporting and reconciliation](https://github.com/itsnatch22/eaziwageapp/tree/main/app/api/admin/reports): `app/api/admin/reports`

### Platform services

- [Supabase data](https://github.com/itsnatch22/eaziwageapp/blob/main/lib/supabaseAdmin.ts): `lib/supabaseAdmin.ts`
- [Notification service](https://github.com/itsnatch22/eaziwageapp/blob/main/lib/notifications.ts): `lib/notifications.ts`
- [Realtime refresh](https://github.com/itsnatch22/eaziwageapp/blob/main/hooks/useRealtimeRefresh.ts): `hooks/useRealtimeRefresh.ts`

### Other components

- **Employee**
- **Employer**
- **Administrator**

## Connections

- Employee → Employee dashboard: uses
- Employer → Employer dashboard: uses
- Administrator → Admin dashboard: uses
- Employee dashboard → Authentication: authenticates
- Employer dashboard → Authentication: authenticates
- Admin dashboard → Authentication: authenticates
- Employee dashboard → Advance request: submits request
- Advance request → Fraud screening: checks risk (evidence: `app/api/employee-dashboard/request-advance/route.ts`)
- Advance request → Advance approval: tries approval (evidence: `app/api/employee-dashboard/request-advance/route.ts`)
- Advance approval → Payout service: disburses
- Payout service → DusuPay gateway: sends funds
- Payout service → Employer wallet: reserves funds
- DusuPay gateway → Payment callbacks: sends callbacks
- Payment callbacks → Supabase data: updates payments (evidence: `app/api/webhook/dusupay/route.ts`)
- Payment callbacks → Payday recoupment: applies collection (evidence: `app/api/webhook/dusupay/route.ts`)
- Payment callbacks → Notification service: notifies users (evidence: `app/api/webhook/dusupay/route.ts`)
- Payday recoupment → DusuPay gateway: collects liability
- Payment reconciliation → DusuPay gateway: checks status
- Payment reconciliation → Supabase data: records drift (evidence: `app/api/cron/reconcile-dusupay/route.ts`)
- Payment reconciliation → Notification service: alerts operations (evidence: `app/api/cron/reconcile-dusupay/route.ts`)
- Employer dashboard → Payroll management: manages payroll
- Admin dashboard → KYC review: reviews documents
- Admin dashboard → Risk and fraud review: reviews risk
- Admin dashboard → Reporting and reconciliation: views reports
- Admin dashboard → Employer wallet: manages funding
- KYC review → Supabase data: reviews records
- Risk and fraud review → Supabase data: reviews alerts
- Reporting and reconciliation → Supabase data: reads records
- Stanbic banking → Employer wallet: records deposits
- Notification service → Supabase data: writes notices (evidence: `lib/notifications.ts`)
- Employee dashboard → Realtime refresh: refreshes live
- Employer dashboard → Realtime refresh: refreshes live
- Admin dashboard → Realtime refresh: refreshes live (evidence: `app/admin/kyc-review/KycReviewClient.tsx`)
