# redmonkin/core-hr-hub architecture

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

- Interactive diagram: https://gitdiagram.com/redmonkin/core-hr-hub
- Repository: https://github.com/redmonkin/core-hr-hub

## Overview

CoreHR Hub is a role-based HR management application. Users authenticate and enter protected pages, then manage employee records and move through leave, attendance, payroll, performance, asset, and document workflows; reporting and notifications support those operations. The frontend uses Supabase for authentication and persistence, with Edge Functions for email and scheduled reminders. The graph follows explicit routing and sampled hook/component interactions where available; broader feature paths and integrations are grounded in the README, so uncertain page-to-hook wiring is not shown.

Main entry points: [`src/App.tsx`](https://github.com/redmonkin/core-hr-hub/blob/main/src/App.tsx) (App routing), [`src/integrations/supabase/client.ts`](https://github.com/redmonkin/core-hr-hub/blob/main/src/integrations/supabase/client.ts) (Supabase client), [`supabase/functions`](https://github.com/redmonkin/core-hr-hub/tree/main/supabase/functions) (Notification functions), [`src/hooks/usePayroll.ts`](https://github.com/redmonkin/core-hr-hub/blob/main/src/hooks/usePayroll.ts) (Payroll data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application Access"]
  node_app["App routing<br/>[App.tsx]"]
  node_auth["Authentication<br/>[AuthContext.tsx]"]
  node_dashboard["Dashboard<br/>[Index.tsx]"]
end

subgraph group_people["People Operations"]
  node_employees["Employee management<br/>[Employees.tsx]"]
  node_employee_ops["Employee records<br/>[useEmployees.ts]"]
  node_documents["Employee documents"]
end

subgraph group_time["Time Management"]
  node_leave["Leave management<br/>[Leaves.tsx]"]
  node_attendance["Attendance tracking<br/>[Attendance.tsx]"]
end

subgraph group_rewards["Payroll Performance"]
  node_payroll["Payroll<br/>[Payroll.tsx]"]
  node_payroll_data["Payroll data<br/>[usePayroll.ts]"]
  node_salary["Salary structures"]
  node_performance["Performance reviews<br/>[Performance.tsx]"]
  node_goals["Goals and reviews<br/>[usePerformance.ts]"]
  node_goals_ui["Goal management<br/>[GoalsManager.tsx]"]
  node_team_reviews["Team review management"]
end

subgraph group_services["Data And Messaging"]
  node_supabase_client["Supabase client<br/>[client.ts]"]
  node_supabase[("Supabase services")]
  node_edge_functions["Notification functions"]
  node_resend["Resend email"]
end

node_user(("HR users"))
node_scheduler(("Cron scheduler"))

node_user -->|"uses"| node_app
node_app -->|"provides auth"| node_auth
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_employees
node_app -->|"routes to"| node_leave
node_app -->|"routes to"| node_attendance
node_app -->|"routes to"| node_payroll
node_app -->|"routes to"| node_performance
node_employees -->|"manages records"| node_employee_ops
node_payroll -->|"manages payroll"| node_payroll_data
node_salary -->|"uses payroll data"| node_payroll_data
node_goals_ui -->|"reads and mutates"| node_goals
node_team_reviews -->|"mutates reviews"| node_goals
node_employee_ops -->|"queries"| node_supabase_client
node_payroll_data -->|"queries"| node_supabase_client
node_goals -->|"queries"| node_supabase_client
node_auth -->|"auth access"| node_supabase_client
node_supabase_client -->|"connects"| node_supabase
node_scheduler -.->|"invokes scheduled"| node_edge_functions
node_edge_functions -.->|"accesses data"| node_supabase
node_edge_functions -.->|"sends email"| node_resend

click node_app "https://github.com/redmonkin/core-hr-hub/blob/main/src/App.tsx"
click node_auth "https://github.com/redmonkin/core-hr-hub/blob/main/src/contexts/AuthContext.tsx"
click node_dashboard "https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Index.tsx"
click node_employees "https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Employees.tsx"
click node_employee_ops "https://github.com/redmonkin/core-hr-hub/blob/main/src/hooks/useEmployees.ts"
click node_documents "https://github.com/redmonkin/core-hr-hub/blob/main/src/components/documents/EmployeeDocuments.tsx"
click node_leave "https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Leaves.tsx"
click node_attendance "https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Attendance.tsx"
click node_payroll "https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Payroll.tsx"
click node_payroll_data "https://github.com/redmonkin/core-hr-hub/blob/main/src/hooks/usePayroll.ts"
click node_salary "https://github.com/redmonkin/core-hr-hub/blob/main/src/components/payroll/SalaryStructureManager.tsx"
click node_performance "https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Performance.tsx"
click node_goals "https://github.com/redmonkin/core-hr-hub/blob/main/src/hooks/usePerformance.ts"
click node_goals_ui "https://github.com/redmonkin/core-hr-hub/blob/main/src/components/performance/GoalsManager.tsx"
click node_team_reviews "https://github.com/redmonkin/core-hr-hub/blob/main/src/components/performance/TeamReviewsManager.tsx"
click node_supabase_client "https://github.com/redmonkin/core-hr-hub/blob/main/src/integrations/supabase/client.ts"
click node_edge_functions "https://github.com/redmonkin/core-hr-hub/tree/main/supabase/functions"

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_app,node_auth,node_dashboard,node_user toneBlue
class node_employees,node_employee_ops,node_documents toneAmber
class node_leave,node_attendance toneMint
class node_payroll,node_payroll_data,node_salary,node_performance,node_goals,node_goals_ui,node_team_reviews,node_scheduler toneRose
class node_supabase_client,node_supabase,node_edge_functions,node_resend toneIndigo
```

## Components

### Application Access

- [App routing](https://github.com/redmonkin/core-hr-hub/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication](https://github.com/redmonkin/core-hr-hub/blob/main/src/contexts/AuthContext.tsx): `src/contexts/AuthContext.tsx`
- [Dashboard](https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`

### People Operations

- [Employee management](https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Employees.tsx): `src/pages/Employees.tsx`
- [Employee records](https://github.com/redmonkin/core-hr-hub/blob/main/src/hooks/useEmployees.ts): `src/hooks/useEmployees.ts`
- [Employee documents](https://github.com/redmonkin/core-hr-hub/blob/main/src/components/documents/EmployeeDocuments.tsx): `src/components/documents/EmployeeDocuments.tsx`

### Time Management

- [Leave management](https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Leaves.tsx): `src/pages/Leaves.tsx`
- [Attendance tracking](https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Attendance.tsx): `src/pages/Attendance.tsx`

### Payroll Performance

- [Payroll](https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Payroll.tsx): `src/pages/Payroll.tsx`
- [Payroll data](https://github.com/redmonkin/core-hr-hub/blob/main/src/hooks/usePayroll.ts): `src/hooks/usePayroll.ts`
- [Salary structures](https://github.com/redmonkin/core-hr-hub/blob/main/src/components/payroll/SalaryStructureManager.tsx): `src/components/payroll/SalaryStructureManager.tsx`
- [Performance reviews](https://github.com/redmonkin/core-hr-hub/blob/main/src/pages/Performance.tsx): `src/pages/Performance.tsx`
- [Goals and reviews](https://github.com/redmonkin/core-hr-hub/blob/main/src/hooks/usePerformance.ts): `src/hooks/usePerformance.ts`
- [Goal management](https://github.com/redmonkin/core-hr-hub/blob/main/src/components/performance/GoalsManager.tsx): `src/components/performance/GoalsManager.tsx`
- [Team review management](https://github.com/redmonkin/core-hr-hub/blob/main/src/components/performance/TeamReviewsManager.tsx): `src/components/performance/TeamReviewsManager.tsx`

### Data And Messaging

- [Supabase client](https://github.com/redmonkin/core-hr-hub/blob/main/src/integrations/supabase/client.ts): `src/integrations/supabase/client.ts`
- **Supabase services**
- [Notification functions](https://github.com/redmonkin/core-hr-hub/tree/main/supabase/functions): `supabase/functions`
- **Resend email**

### Other components

- **HR users**
- **Cron scheduler**

## Connections

- HR users → App routing: uses
- App routing → Authentication: provides auth
- App routing → Dashboard: routes to
- App routing → Employee management: routes to
- App routing → Leave management: routes to
- App routing → Attendance tracking: routes to
- App routing → Payroll: routes to
- App routing → Performance reviews: routes to
- Employee management → Employee records: manages records
- Payroll → Payroll data: manages payroll
- Salary structures → Payroll data: uses payroll data
- Goal management → Goals and reviews: reads and mutates
- Team review management → Goals and reviews: mutates reviews
- Employee records → Supabase client: queries
- Payroll data → Supabase client: queries
- Goals and reviews → Supabase client: queries
- Authentication → Supabase client: auth access
- Supabase client → Supabase services: connects
- Cron scheduler → Notification functions: invokes scheduled
- Notification functions → Supabase services: accesses data
- Notification functions → Resend email: sends email
