# malik-haziq/humantryx architecture

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

- Interactive diagram: https://gitdiagram.com/malik-haziq/humantryx
- Repository: https://github.com/malik-haziq/humantryx

## Overview

Humantryx is an AI-powered HR management system. Employees and HR staff use its web application for onboarding and day-to-day workforce operations; administrators manage organizations and access. The README documents attendance, leave approvals, payroll, recruitment, document search, and internal news. The sampled code confirms the tRPC entry point, authentication, database access, and leave/employee service behavior. Several feature modules are represented from the README and file tree; their internal call chains were not sampled, so those links are omitted or marked unverified.

Main entry points: [`src/server/db/index.ts`](https://github.com/malik-haziq/humantryx/blob/main/src/server/db/index.ts) (PostgreSQL data), [`src/server/api/root.ts`](https://github.com/malik-haziq/humantryx/blob/main/src/server/api/root.ts) (API router registry), [`src/server/api/services/leave.service.ts`](https://github.com/malik-haziq/humantryx/blob/main/src/server/api/services/leave.service.ts) (Leave service), [`src/server/api/services/employee.service.ts`](https://github.com/malik-haziq/humantryx/blob/main/src/server/api/services/employee.service.ts) (Employee service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application entry"]
  node_authpages["Sign-in and onboarding<br/>[page.tsx]"]
  node_dashboard["HR dashboard<br/>[page.tsx]"]
  node_auth["Authentication<br/>[index.ts]"]
end

subgraph group_people["People operations"]
  node_employeeops["Employee management"]
  node_invitations["Invitations"]
  node_recruitment["Recruitment<br/>[jobs-list.tsx]"]
  node_admin["Platform administration<br/>[dashboard.tsx]"]
end

subgraph group_workforce["Workforce workflows"]
  node_attendance["Attendance tracking"]
  node_leave["Leave management<br/>[leaves-page.tsx]"]
  node_leavepolicy["Leave policies"]
  node_payroll["Payroll and payslips"]
end

subgraph group_platform["API and persistence"]
  node_trpcroute["tRPC HTTP route<br/>[route.ts]"]
  node_apirouter["API router registry<br/>[root.ts]"]
  node_adminrouter["Admin API<br/>[admin.ts]"]
  node_leaveservice["Leave service<br/>[leave.service.ts]"]
  node_employeeservice["Employee service"]
  node_db[("PostgreSQL data<br/>[index.ts]")]
  node_employeeschema[("Employee records<br/>[employees.ts]")]
  node_leaveschema[("Leave records<br/>[leaves.ts]")]
  node_queryclient["Query client<br/>[query-client.ts]"]
end

subgraph group_intelligence["AI and content"]
  node_documents["Document knowledge base<br/>[documents-page.tsx]"]
  node_ai["AI services<br/>[ai.service.ts]"]
  node_news["Company news"]
end

node_employee(("Employee"))
node_hr(("HR staff"))
node_superadmin(("Super admin"))

node_employee -.->|"signs in"| node_authpages
node_hr -.->|"manages workforce"| node_dashboard
node_superadmin -.->|"administers platform"| node_admin
node_authpages -.->|"authenticates"| node_auth
node_employee -.->|"tracks time"| node_attendance
node_employee -.->|"requests leave"| node_leave
node_hr -.->|"reviews requests"| node_leave
node_hr -.->|"configures policies"| node_leavepolicy
node_hr -.->|"manages employees"| node_employeeops
node_employeeops -.->|"invites employees"| node_invitations
node_hr -.->|"processes payroll"| node_payroll
node_hr -.->|"screens candidates"| node_recruitment
node_hr -.->|"searches documents"| node_documents
node_documents -.->|"retrieves knowledge"| node_ai
node_hr -.->|"publishes updates"| node_news
node_trpcroute -->|"dispatches requests"| node_apirouter
node_apirouter -->|"registers router"| node_adminrouter
node_apirouter -.->|"provides queries"| node_queryclient
node_leaveservice -->|"queries and writes"| node_db
node_leaveservice -->|"uses leave tables"| node_leaveschema
node_employeeservice -->|"queries and writes"| node_db
node_employeeservice -->|"uses employee table"| node_employeeschema
node_auth -->|"uses adapter"| node_db
node_db -->|"loads schema"| node_employeeschema

click node_authpages "https://github.com/malik-haziq/humantryx/blob/main/src/app/(pages)/(auth)/sign-in/page.tsx"
click node_dashboard "https://github.com/malik-haziq/humantryx/blob/main/src/app/(pages)/dashboard/page.tsx"
click node_auth "https://github.com/malik-haziq/humantryx/blob/main/src/server/auth/index.ts"
click node_employeeops "https://github.com/malik-haziq/humantryx/blob/main/src/modules/employees/components/employee/employee-management.tsx"
click node_invitations "https://github.com/malik-haziq/humantryx/blob/main/src/modules/invitations/invitation-landing-page.tsx"
click node_attendance "https://github.com/malik-haziq/humantryx/blob/main/src/modules/attendance/my-attendance-page.tsx"
click node_leave "https://github.com/malik-haziq/humantryx/blob/main/src/modules/leaves/my-leaves/leaves-page.tsx"
click node_leavepolicy "https://github.com/malik-haziq/humantryx/blob/main/src/modules/leaves/policies/components/leave-policies-management.tsx"
click node_payroll "https://github.com/malik-haziq/humantryx/blob/main/src/modules/payroll/components/payroll-management.tsx"
click node_recruitment "https://github.com/malik-haziq/humantryx/blob/main/src/modules/recruitment/postings/listing/jobs-list.tsx"
click node_admin "https://github.com/malik-haziq/humantryx/blob/main/src/modules/superadmin/components/dashboard.tsx"
click node_documents "https://github.com/malik-haziq/humantryx/blob/main/src/modules/documents/components/documents-page.tsx"
click node_ai "https://github.com/malik-haziq/humantryx/blob/main/src/server/api/services/ai.service.ts"
click node_news "https://github.com/malik-haziq/humantryx/blob/main/src/modules/news/components/news-management.tsx"
click node_trpcroute "https://github.com/malik-haziq/humantryx/blob/main/src/app/api/trpc/%5Btrpc%5D/route.ts"
click node_apirouter "https://github.com/malik-haziq/humantryx/blob/main/src/server/api/root.ts"
click node_adminrouter "https://github.com/malik-haziq/humantryx/blob/main/src/server/api/routers/admin.ts"
click node_leaveservice "https://github.com/malik-haziq/humantryx/blob/main/src/server/api/services/leave.service.ts"
click node_employeeservice "https://github.com/malik-haziq/humantryx/blob/main/src/server/api/services/employee.service.ts"
click node_db "https://github.com/malik-haziq/humantryx/blob/main/src/server/db/index.ts"
click node_employeeschema "https://github.com/malik-haziq/humantryx/blob/main/src/server/db/employees.ts"
click node_leaveschema "https://github.com/malik-haziq/humantryx/blob/main/src/server/db/leaves.ts"
click node_queryclient "https://github.com/malik-haziq/humantryx/blob/main/src/trpc/query-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_authpages,node_dashboard,node_auth toneBlue
class node_employeeops,node_invitations,node_recruitment,node_admin toneAmber
class node_attendance,node_leave,node_leavepolicy,node_payroll toneMint
class node_trpcroute,node_apirouter,node_adminrouter,node_leaveservice,node_employeeservice,node_db,node_employeeschema,node_leaveschema,node_queryclient toneRose
class node_documents,node_ai,node_news,node_employee,node_hr,node_superadmin toneIndigo
```

## Components

### Application entry

- [Sign-in and onboarding](https://github.com/malik-haziq/humantryx/blob/main/src/app/(pages)/(auth)/sign-in/page.tsx): `src/app/(pages)/(auth)/sign-in/page.tsx`
- [HR dashboard](https://github.com/malik-haziq/humantryx/blob/main/src/app/(pages)/dashboard/page.tsx): `src/app/(pages)/dashboard/page.tsx`
- [Authentication](https://github.com/malik-haziq/humantryx/blob/main/src/server/auth/index.ts): `src/server/auth/index.ts`

### People operations

- [Employee management](https://github.com/malik-haziq/humantryx/blob/main/src/modules/employees/components/employee/employee-management.tsx): `src/modules/employees/components/employee/employee-management.tsx`
- [Invitations](https://github.com/malik-haziq/humantryx/blob/main/src/modules/invitations/invitation-landing-page.tsx): `src/modules/invitations/invitation-landing-page.tsx`
- [Recruitment](https://github.com/malik-haziq/humantryx/blob/main/src/modules/recruitment/postings/listing/jobs-list.tsx): `src/modules/recruitment/postings/listing/jobs-list.tsx`
- [Platform administration](https://github.com/malik-haziq/humantryx/blob/main/src/modules/superadmin/components/dashboard.tsx): `src/modules/superadmin/components/dashboard.tsx`

### Workforce workflows

- [Attendance tracking](https://github.com/malik-haziq/humantryx/blob/main/src/modules/attendance/my-attendance-page.tsx): `src/modules/attendance/my-attendance-page.tsx`
- [Leave management](https://github.com/malik-haziq/humantryx/blob/main/src/modules/leaves/my-leaves/leaves-page.tsx): `src/modules/leaves/my-leaves/leaves-page.tsx`
- [Leave policies](https://github.com/malik-haziq/humantryx/blob/main/src/modules/leaves/policies/components/leave-policies-management.tsx): `src/modules/leaves/policies/components/leave-policies-management.tsx`
- [Payroll and payslips](https://github.com/malik-haziq/humantryx/blob/main/src/modules/payroll/components/payroll-management.tsx): `src/modules/payroll/components/payroll-management.tsx`

### API and persistence

- [tRPC HTTP route](https://github.com/malik-haziq/humantryx/blob/main/src/app/api/trpc/%5Btrpc%5D/route.ts): `src/app/api/trpc/[trpc]/route.ts`
- [API router registry](https://github.com/malik-haziq/humantryx/blob/main/src/server/api/root.ts): `src/server/api/root.ts`
- [Admin API](https://github.com/malik-haziq/humantryx/blob/main/src/server/api/routers/admin.ts): `src/server/api/routers/admin.ts`
- [Leave service](https://github.com/malik-haziq/humantryx/blob/main/src/server/api/services/leave.service.ts): `src/server/api/services/leave.service.ts`
- [Employee service](https://github.com/malik-haziq/humantryx/blob/main/src/server/api/services/employee.service.ts): `src/server/api/services/employee.service.ts`
- [PostgreSQL data](https://github.com/malik-haziq/humantryx/blob/main/src/server/db/index.ts): `src/server/db/index.ts`
- [Employee records](https://github.com/malik-haziq/humantryx/blob/main/src/server/db/employees.ts): `src/server/db/employees.ts`
- [Leave records](https://github.com/malik-haziq/humantryx/blob/main/src/server/db/leaves.ts): `src/server/db/leaves.ts`
- [Query client](https://github.com/malik-haziq/humantryx/blob/main/src/trpc/query-client.ts): `src/trpc/query-client.ts`

### AI and content

- [Document knowledge base](https://github.com/malik-haziq/humantryx/blob/main/src/modules/documents/components/documents-page.tsx): `src/modules/documents/components/documents-page.tsx`
- [AI services](https://github.com/malik-haziq/humantryx/blob/main/src/server/api/services/ai.service.ts): `src/server/api/services/ai.service.ts`
- [Company news](https://github.com/malik-haziq/humantryx/blob/main/src/modules/news/components/news-management.tsx): `src/modules/news/components/news-management.tsx`

### Other components

- **Employee**
- **HR staff**
- **Super admin**

## Connections

- Employee → Sign-in and onboarding: signs in
- HR staff → HR dashboard: manages workforce
- Super admin → Platform administration: administers platform
- Sign-in and onboarding → Authentication: authenticates
- Employee → Attendance tracking: tracks time
- Employee → Leave management: requests leave
- HR staff → Leave management: reviews requests
- HR staff → Leave policies: configures policies
- HR staff → Employee management: manages employees
- Employee management → Invitations: invites employees
- HR staff → Payroll and payslips: processes payroll
- HR staff → Recruitment: screens candidates
- HR staff → Document knowledge base: searches documents
- Document knowledge base → AI services: retrieves knowledge
- HR staff → Company news: publishes updates
- tRPC HTTP route → API router registry: dispatches requests (evidence: `src/app/api/trpc/[trpc]/route.ts`)
- API router registry → Admin API: registers router (evidence: `src/server/api/root.ts`)
- API router registry → Query client: provides queries
- Leave service → PostgreSQL data: queries and writes (evidence: `src/server/api/services/leave.service.ts`)
- Leave service → Leave records: uses leave tables (evidence: `src/server/api/services/leave.service.ts`)
- Employee service → PostgreSQL data: queries and writes (evidence: `src/server/api/services/employee.service.ts`)
- Employee service → Employee records: uses employee table (evidence: `src/server/api/services/employee.service.ts`)
- Authentication → PostgreSQL data: uses adapter (evidence: `src/server/auth/index.ts`)
- PostgreSQL data → Employee records: loads schema (evidence: `src/server/db/index.ts`)
