# kcsimfinity/hris architecture

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

- Interactive diagram: https://gitdiagram.com/kcsimfinity/hris
- Repository: https://github.com/kcsimfinity/hris

## Overview

This is a multi-company HRIS app with role-based portals for employees, company administrators, and a super administrator. The user journey begins at app routing and authentication, then enters a role-specific workspace for workforce administration or employee self-service. Admin capabilities span employee and organization management, attendance, leave, documents, payroll, schedules, reports, and settings; the employee portal covers personal records and those operational areas. Firebase provides authentication and Firestore-backed services. Several feature modules are present in the tree but were not sampled, so their internal call paths are not asserted.

Main entry points: [`src/features/admin/components`](https://github.com/kcsimfinity/hris/tree/main/src/features/admin/components) (Admin workspace), [`src/features/employee/components/EmployeePortalScreen.tsx`](https://github.com/kcsimfinity/hris/blob/main/src/features/employee/components/EmployeePortalScreen.tsx) (Employee portal), [`src/features/documents`](https://github.com/kcsimfinity/hris/tree/main/src/features/documents) (Document records), [`src/features/auth/context/AuthContext.tsx`](https://github.com/kcsimfinity/hris/blob/main/src/features/auth/context/AuthContext.tsx) (Auth state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["App entry and auth"]
  node_routing["Role routing"]
  node_login["Login screen<br/>[LoginScreen.tsx]"]
  node_auth["Auth state<br/>[AuthContext.tsx]"]
end

subgraph group_admin["Company administration"]
  node_adminportal["Admin workspace"]
  node_employees["Employee directory"]
  node_organization["Departments and roles"]
  node_attendance["Attendance"]
  node_leave["Leave management"]
  node_documents["Document records"]
  node_payroll["Payroll"]
  node_schedules["Schedules"]
  node_reports["Reports"]
  node_settings["Company settings"]
end

subgraph group_employee["Employee self-service"]
  node_employeeportal["Employee portal"]
end

subgraph group_platform["Platform administration"]
  node_superadmin["Super-admin workspace<br/>[super-admin.tsx]"]
  node_superdata["System management data"]
end

subgraph group_data["Firebase data"]
  node_firebaseauth["Firebase Auth<br/>[authService.ts]"]
  node_firestore[("Cloud Firestore<br/>[firebaseConfig.ts]")]
  node_employee_store["Employee records<br/>[employeeService.ts]"]
  node_organization_store["Organization records"]
  node_document_store["Document records store<br/>[documentService.ts]"]
  node_company_store["Company records<br/>[companyService.ts]"]
  node_super_store["System data service"]
end

node_person(("HRIS user"))

node_person -.->|"opens app"| node_routing
node_routing -.->|"checks session"| node_auth
node_login -.->|"uses auth hook"| node_auth
node_auth -->|"calls auth service"| node_firebaseauth
node_auth -->|"loads profile"| node_firestore
node_routing -.->|"routes role"| node_superadmin
node_superadmin -->|"renders data views"| node_superdata
node_superdata -->|"loads companies"| node_company_store
node_superdata -->|"loads system data"| node_super_store
node_employees -->|"loads employee records"| node_employee_store
node_organization -->|"loads departments"| node_organization_store
node_documents -->|"loads records"| node_document_store
node_documents -->|"loads directory"| node_employee_store
node_documents -->|"loads org data"| node_organization_store
node_adminportal -.->|"provides feature"| node_employees
node_adminportal -.->|"provides feature"| node_attendance
node_adminportal -.->|"provides feature"| node_leave
node_adminportal -.->|"provides feature"| node_documents
node_adminportal -.->|"provides feature"| node_payroll
node_adminportal -.->|"provides feature"| node_schedules
node_adminportal -.->|"provides feature"| node_reports
node_adminportal -.->|"provides feature"| node_settings
node_employeeportal -.->|"offers self-service"| node_attendance
node_employeeportal -.->|"offers self-service"| node_leave
node_employeeportal -.->|"offers self-service"| node_documents
node_employeeportal -.->|"offers self-service"| node_payroll
node_employeeportal -.->|"offers self-service"| node_schedules

click node_routing "https://github.com/kcsimfinity/hris/tree/main/src/app"
click node_login "https://github.com/kcsimfinity/hris/blob/main/src/features/auth/screens/LoginScreen.tsx"
click node_auth "https://github.com/kcsimfinity/hris/blob/main/src/features/auth/context/AuthContext.tsx"
click node_adminportal "https://github.com/kcsimfinity/hris/tree/main/src/features/admin/components"
click node_employees "https://github.com/kcsimfinity/hris/tree/main/src/features/employees/components"
click node_organization "https://github.com/kcsimfinity/hris/blob/main/src/features/employees/components/PositionManager.tsx"
click node_attendance "https://github.com/kcsimfinity/hris/tree/main/src/features/attendance"
click node_leave "https://github.com/kcsimfinity/hris/tree/main/src/features/leave"
click node_documents "https://github.com/kcsimfinity/hris/tree/main/src/features/documents"
click node_payroll "https://github.com/kcsimfinity/hris/tree/main/src/features/payroll"
click node_schedules "https://github.com/kcsimfinity/hris/tree/main/src/features/schedules"
click node_reports "https://github.com/kcsimfinity/hris/tree/main/src/features/reports"
click node_settings "https://github.com/kcsimfinity/hris/tree/main/src/features/settings"
click node_employeeportal "https://github.com/kcsimfinity/hris/blob/main/src/features/employee/components/EmployeePortalScreen.tsx"
click node_superadmin "https://github.com/kcsimfinity/hris/blob/main/src/app/(protected)/super-admin.tsx"
click node_superdata "https://github.com/kcsimfinity/hris/blob/main/src/features/superAdmin/hooks/useSuperAdminData.ts"
click node_firebaseauth "https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/authService.ts"
click node_firestore "https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/firebaseConfig.ts"
click node_employee_store "https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/employeeService.ts"
click node_organization_store "https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/organizationService.ts"
click node_document_store "https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/documentService.ts"
click node_company_store "https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/companyService.ts"
click node_super_store "https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/superAdminService.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_routing,node_login,node_auth,node_person toneBlue
class node_adminportal,node_employees,node_organization,node_attendance,node_leave,node_documents,node_payroll,node_schedules,node_reports,node_settings toneAmber
class node_employeeportal toneMint
class node_superadmin,node_superdata toneRose
class node_firebaseauth,node_firestore,node_employee_store,node_organization_store,node_document_store,node_company_store,node_super_store toneIndigo
```

## Components

### App entry and auth

- [Role routing](https://github.com/kcsimfinity/hris/tree/main/src/app): `src/app`
- [Login screen](https://github.com/kcsimfinity/hris/blob/main/src/features/auth/screens/LoginScreen.tsx): `src/features/auth/screens/LoginScreen.tsx`
- [Auth state](https://github.com/kcsimfinity/hris/blob/main/src/features/auth/context/AuthContext.tsx): `src/features/auth/context/AuthContext.tsx`

### Company administration

- [Admin workspace](https://github.com/kcsimfinity/hris/tree/main/src/features/admin/components): `src/features/admin/components`
- [Employee directory](https://github.com/kcsimfinity/hris/tree/main/src/features/employees/components): `src/features/employees/components`
- [Departments and roles](https://github.com/kcsimfinity/hris/blob/main/src/features/employees/components/PositionManager.tsx): `src/features/employees/components/PositionManager.tsx`
- [Attendance](https://github.com/kcsimfinity/hris/tree/main/src/features/attendance): `src/features/attendance`
- [Leave management](https://github.com/kcsimfinity/hris/tree/main/src/features/leave): `src/features/leave`
- [Document records](https://github.com/kcsimfinity/hris/tree/main/src/features/documents): `src/features/documents`
- [Payroll](https://github.com/kcsimfinity/hris/tree/main/src/features/payroll): `src/features/payroll`
- [Schedules](https://github.com/kcsimfinity/hris/tree/main/src/features/schedules): `src/features/schedules`
- [Reports](https://github.com/kcsimfinity/hris/tree/main/src/features/reports): `src/features/reports`
- [Company settings](https://github.com/kcsimfinity/hris/tree/main/src/features/settings): `src/features/settings`

### Employee self-service

- [Employee portal](https://github.com/kcsimfinity/hris/blob/main/src/features/employee/components/EmployeePortalScreen.tsx): `src/features/employee/components/EmployeePortalScreen.tsx`

### Platform administration

- [Super-admin workspace](https://github.com/kcsimfinity/hris/blob/main/src/app/(protected)/super-admin.tsx): `src/app/(protected)/super-admin.tsx`
- [System management data](https://github.com/kcsimfinity/hris/blob/main/src/features/superAdmin/hooks/useSuperAdminData.ts): `src/features/superAdmin/hooks/useSuperAdminData.ts`

### Firebase data

- [Firebase Auth](https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/authService.ts): `src/services/firebase/authService.ts`
- [Cloud Firestore](https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/firebaseConfig.ts): `src/services/firebase/firebaseConfig.ts`
- [Employee records](https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/employeeService.ts): `src/services/firebase/employeeService.ts`
- [Organization records](https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/organizationService.ts): `src/services/firebase/organizationService.ts`
- [Document records store](https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/documentService.ts): `src/services/firebase/documentService.ts`
- [Company records](https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/companyService.ts): `src/services/firebase/companyService.ts`
- [System data service](https://github.com/kcsimfinity/hris/blob/main/src/services/firebase/superAdminService.ts): `src/services/firebase/superAdminService.ts`

### Other components

- **HRIS user**

## Connections

- HRIS user → Role routing: opens app
- Role routing → Auth state: checks session
- Login screen → Auth state: uses auth hook
- Auth state → Firebase Auth: calls auth service (evidence: `src/features/auth/context/AuthContext.tsx`)
- Auth state → Cloud Firestore: loads profile (evidence: `src/features/auth/context/AuthContext.tsx`)
- Role routing → Super-admin workspace: routes role
- Super-admin workspace → System management data: renders data views (evidence: `src/app/(protected)/super-admin.tsx`)
- System management data → Company records: loads companies (evidence: `src/features/superAdmin/hooks/useSuperAdminData.ts`)
- System management data → System data service: loads system data (evidence: `src/features/superAdmin/hooks/useSuperAdminData.ts`)
- Employee directory → Employee records: loads employee records
- Departments and roles → Organization records: loads departments (evidence: `src/features/employees/components/PositionManager.tsx`)
- Document records → Document records store: loads records (evidence: `src/features/documents/hooks/useAdminDocuments.ts`)
- Document records → Employee records: loads directory (evidence: `src/features/documents/hooks/useAdminDocuments.ts`)
- Document records → Organization records: loads org data (evidence: `src/features/documents/hooks/useAdminDocuments.ts`)
- Admin workspace → Employee directory: provides feature
- Admin workspace → Attendance: provides feature
- Admin workspace → Leave management: provides feature
- Admin workspace → Document records: provides feature
- Admin workspace → Payroll: provides feature
- Admin workspace → Schedules: provides feature
- Admin workspace → Reports: provides feature
- Admin workspace → Company settings: provides feature
- Employee portal → Attendance: offers self-service
- Employee portal → Leave management: offers self-service
- Employee portal → Document records: offers self-service
- Employee portal → Payroll: offers self-service
- Employee portal → Schedules: offers self-service
