# kk666679/dashboardhr architecture

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

- Interactive diagram: https://gitdiagram.com/kk666679/dashboardhr
- Repository: https://github.com/kk666679/dashboardhr

## Overview

AiFWMS is a Malaysian HR and foreign-worker management platform. Users manage worker and employee lifecycles, attendance, payroll, compliance, and operational workflows through localized web dashboards; AI orchestration and regulatory intelligence support those operations. The graph preserves the README’s major product areas and the sampled AHROS execution layers. Most domain routes and integrations were not sampled, so their internal calls are omitted or marked unverified rather than inferred from directory names.

Main entry points: [`app/[locale]/dashboard/foreign-workers/page.tsx`](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/foreign-workers/page.tsx) (Foreign Worker Lifecycle), [`server/routers/workflowEngine.ts`](https://github.com/kk666679/dashboardhr/blob/main/server/routers/workflowEngine.ts) (Workflow Runtime API), [`lib/ahros/wiring/use-business-event-pipeline.ts`](https://github.com/kk666679/dashboardhr/blob/main/lib/ahros/wiring/use-business-event-pipeline.ts) (Business Event Pipeline), [`app/[locale]/dashboard/payroll/page.tsx`](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/payroll/page.tsx) (Payroll & Statutory)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workforce["Workforce Operations"]
  node_employee["Employee Lifecycle<br/>[page.tsx]"]
  node_worker["Foreign Worker Lifecycle<br/>[page.tsx]"]
  node_permits["Permits &amp; Visas<br/>[page.tsx]"]
  node_attendance["Geolocation Attendance<br/>[page.tsx]"]
  node_accommodation["Worker Accommodation<br/>[page.tsx]"]
end

subgraph group_finance["Payroll &amp; Finance"]
  node_payroll["Payroll &amp; Statutory<br/>[page.tsx]"]
  node_accounting["Accounting &amp; E-invoice<br/>[page.tsx]"]
end

subgraph group_governance["Compliance &amp; Quality"]
  node_regulatory["Regulatory Intelligence<br/>[change-pipeline.ts]"]
  node_compliance["Compliance Management<br/>[page.tsx]"]
  node_iso["ISO &amp; Quality<br/>[page.tsx]"]
  node_sops["SOP Management<br/>[route.ts]"]
end

subgraph group_automation["Automation &amp; AI"]
  node_workflow_ui["Workflow Designer<br/>[FlowDesigner.tsx]"]
  node_workflow_api["Workflow Runtime API<br/>[workflowEngine.ts]"]
  node_workflow_engine["Workflow Engine<br/>[workflow-engine.ts]"]
  node_ahros_ui["AHROS Workspace"]
  node_event_pipeline["Business Event Pipeline"]
  node_execution["Execution Engine"]
  node_event_bus["Artifact Event Bus<br/>[event-bus.ts]"]
  node_hr_orchestrator["HR Orchestrator<br/>[hr-orchestrator.ts]"]
  node_orchestrator_api["Orchestrator API<br/>[route.ts]"]
  node_knowledge["Knowledge Retrieval<br/>[index.ts]"]
end

subgraph group_platform["Platform Services"]
  node_database[("Tenant Data Store<br/>[prisma.ts]")]
  node_integrations["External Integrations<br/>[page.tsx]"]
  node_reports["Analytics &amp; Reports<br/>[page.tsx]"]
end

node_user(("HR User"))

node_user -->|"manages workforce"| node_employee
node_user -->|"manages lifecycle"| node_worker
node_user -->|"runs payroll"| node_payroll
node_user -->|"designs workflows"| node_workflow_ui
node_employee -.->|"supports lifecycle"| node_worker
node_worker -->|"manages permits"| node_permits
node_worker -->|"tracks attendance"| node_attendance
node_worker -->|"tracks housing"| node_accommodation
node_payroll -.->|"supports accounting"| node_accounting
node_regulatory -.->|"updates requirements"| node_compliance
node_compliance -->|"supports quality"| node_iso
node_workflow_ui -.->|"configures workflows"| node_workflow_api
node_workflow_api -.->|"controls runtime"| node_workflow_engine
node_workflow_api -->|"stores workflow data"| node_database
node_ahros_ui -.->|"starts event pipeline"| node_event_pipeline
node_event_pipeline -->|"initializes execution"| node_execution
node_execution -->|"publishes events"| node_event_bus
node_event_pipeline -->|"synchronizes artifacts"| node_event_bus
node_orchestrator_api -->|"dispatches request"| node_hr_orchestrator
node_orchestrator_api -.->|"retrieves context"| node_knowledge
node_regulatory -->|"records changes"| node_database
node_integrations -.->|"exchanges data"| node_worker
node_reports -.->|"reports payroll"| node_payroll

click node_employee "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/employees/page.tsx"
click node_worker "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/foreign-workers/page.tsx"
click node_permits "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/permits/page.tsx"
click node_attendance "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/geolocation/page.tsx"
click node_accommodation "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/accommodation/page.tsx"
click node_payroll "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/payroll/page.tsx"
click node_accounting "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/accounting/page.tsx"
click node_regulatory "https://github.com/kk666679/dashboardhr/blob/main/lib/regulatory/change-pipeline.ts"
click node_compliance "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/compliance/page.tsx"
click node_iso "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/iso/page.tsx"
click node_sops "https://github.com/kk666679/dashboardhr/blob/main/app/api/sops/route.ts"
click node_workflow_ui "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/automation/flow-process/components/FlowDesigner.tsx"
click node_workflow_api "https://github.com/kk666679/dashboardhr/blob/main/server/routers/workflowEngine.ts"
click node_workflow_engine "https://github.com/kk666679/dashboardhr/blob/main/lib/workflow-engine.ts"
click node_ahros_ui "https://github.com/kk666679/dashboardhr/blob/main/components/ahros/workspace/ahros-workspace.tsx"
click node_event_pipeline "https://github.com/kk666679/dashboardhr/blob/main/lib/ahros/wiring/use-business-event-pipeline.ts"
click node_execution "https://github.com/kk666679/dashboardhr/blob/main/lib/ahros/execution-engine.ts"
click node_event_bus "https://github.com/kk666679/dashboardhr/blob/main/lib/ahros/event-bus.ts"
click node_hr_orchestrator "https://github.com/kk666679/dashboardhr/blob/main/lib/orchestrator/hr-orchestrator.ts"
click node_orchestrator_api "https://github.com/kk666679/dashboardhr/blob/main/app/api/hr-orchestrator/route.ts"
click node_knowledge "https://github.com/kk666679/dashboardhr/blob/main/lib/kb/index.ts"
click node_database "https://github.com/kk666679/dashboardhr/blob/main/lib/prisma.ts"
click node_integrations "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/integrations/page.tsx"
click node_reports "https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/reports/page.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_employee,node_worker,node_permits,node_attendance,node_accommodation,node_user toneBlue
class node_payroll,node_accounting toneAmber
class node_regulatory,node_compliance,node_iso,node_sops toneMint
class node_workflow_ui,node_workflow_api,node_workflow_engine,node_ahros_ui,node_event_pipeline,node_execution,node_event_bus,node_hr_orchestrator,node_orchestrator_api,node_knowledge toneRose
class node_database,node_integrations,node_reports toneIndigo
```

## Components

### Workforce Operations

- [Employee Lifecycle](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/employees/page.tsx): `app/[locale]/dashboard/employees/page.tsx`
- [Foreign Worker Lifecycle](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/foreign-workers/page.tsx): `app/[locale]/dashboard/foreign-workers/page.tsx`
- [Permits & Visas](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/permits/page.tsx): `app/[locale]/dashboard/permits/page.tsx`
- [Geolocation Attendance](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/geolocation/page.tsx): `app/[locale]/dashboard/geolocation/page.tsx`
- [Worker Accommodation](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/accommodation/page.tsx): `app/[locale]/dashboard/accommodation/page.tsx`

### Payroll & Finance

- [Payroll & Statutory](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/payroll/page.tsx): `app/[locale]/dashboard/payroll/page.tsx`
- [Accounting & E-invoice](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/accounting/page.tsx): `app/[locale]/accounting/page.tsx`

### Compliance & Quality

- [Regulatory Intelligence](https://github.com/kk666679/dashboardhr/blob/main/lib/regulatory/change-pipeline.ts): `lib/regulatory/change-pipeline.ts`
- [Compliance Management](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/compliance/page.tsx): `app/[locale]/dashboard/compliance/page.tsx`
- [ISO & Quality](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/iso/page.tsx): `app/[locale]/iso/page.tsx`
- [SOP Management](https://github.com/kk666679/dashboardhr/blob/main/app/api/sops/route.ts): `app/api/sops/route.ts`

### Automation & AI

- [Workflow Designer](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/automation/flow-process/components/FlowDesigner.tsx): `app/[locale]/automation/flow-process/components/FlowDesigner.tsx`
- [Workflow Runtime API](https://github.com/kk666679/dashboardhr/blob/main/server/routers/workflowEngine.ts): `server/routers/workflowEngine.ts`
- [Workflow Engine](https://github.com/kk666679/dashboardhr/blob/main/lib/workflow-engine.ts): `lib/workflow-engine.ts`
- [AHROS Workspace](https://github.com/kk666679/dashboardhr/blob/main/components/ahros/workspace/ahros-workspace.tsx): `components/ahros/workspace/ahros-workspace.tsx`
- [Business Event Pipeline](https://github.com/kk666679/dashboardhr/blob/main/lib/ahros/wiring/use-business-event-pipeline.ts): `lib/ahros/wiring/use-business-event-pipeline.ts`
- [Execution Engine](https://github.com/kk666679/dashboardhr/blob/main/lib/ahros/execution-engine.ts): `lib/ahros/execution-engine.ts`
- [Artifact Event Bus](https://github.com/kk666679/dashboardhr/blob/main/lib/ahros/event-bus.ts): `lib/ahros/event-bus.ts`
- [HR Orchestrator](https://github.com/kk666679/dashboardhr/blob/main/lib/orchestrator/hr-orchestrator.ts): `lib/orchestrator/hr-orchestrator.ts`
- [Orchestrator API](https://github.com/kk666679/dashboardhr/blob/main/app/api/hr-orchestrator/route.ts): `app/api/hr-orchestrator/route.ts`
- [Knowledge Retrieval](https://github.com/kk666679/dashboardhr/blob/main/lib/kb/index.ts): `lib/kb/index.ts`

### Platform Services

- [Tenant Data Store](https://github.com/kk666679/dashboardhr/blob/main/lib/prisma.ts): `lib/prisma.ts`
- [External Integrations](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/integrations/page.tsx): `app/[locale]/dashboard/integrations/page.tsx`
- [Analytics & Reports](https://github.com/kk666679/dashboardhr/blob/main/app/%5Blocale%5D/dashboard/reports/page.tsx): `app/[locale]/dashboard/reports/page.tsx`

### Other components

- **HR User**

## Connections

- HR User → Employee Lifecycle: manages workforce (evidence: `README.md`)
- HR User → Foreign Worker Lifecycle: manages lifecycle (evidence: `README.md`)
- HR User → Payroll & Statutory: runs payroll (evidence: `README.md`)
- HR User → Workflow Designer: designs workflows (evidence: `README.md`)
- Employee Lifecycle → Foreign Worker Lifecycle: supports lifecycle
- Foreign Worker Lifecycle → Permits & Visas: manages permits (evidence: `README.md`)
- Foreign Worker Lifecycle → Geolocation Attendance: tracks attendance (evidence: `README.md`)
- Foreign Worker Lifecycle → Worker Accommodation: tracks housing (evidence: `README.md`)
- Payroll & Statutory → Accounting & E-invoice: supports accounting
- Regulatory Intelligence → Compliance Management: updates requirements
- Compliance Management → ISO & Quality: supports quality (evidence: `README.md`)
- Workflow Designer → Workflow Runtime API: configures workflows
- Workflow Runtime API → Workflow Engine: controls runtime
- Workflow Runtime API → Tenant Data Store: stores workflow data (evidence: `server/routers/workflowEngine.ts`)
- AHROS Workspace → Business Event Pipeline: starts event pipeline
- Business Event Pipeline → Execution Engine: initializes execution (evidence: `lib/ahros/wiring/use-business-event-pipeline.ts`)
- Execution Engine → Artifact Event Bus: publishes events (evidence: `lib/ahros/execution-engine.ts`)
- Business Event Pipeline → Artifact Event Bus: synchronizes artifacts (evidence: `lib/ahros/wiring/use-business-event-pipeline.ts`)
- Orchestrator API → HR Orchestrator: dispatches request (evidence: `app/api/hr-orchestrator/route.ts`)
- Orchestrator API → Knowledge Retrieval: retrieves context
- Regulatory Intelligence → Tenant Data Store: records changes (evidence: `lib/regulatory/change-pipeline.ts`)
- External Integrations → Foreign Worker Lifecycle: exchanges data
- Analytics & Reports → Payroll & Statutory: reports payroll
