# fjdvm/hrms architecture

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

- Interactive diagram: https://gitdiagram.com/fjdvm/hrms
- Repository: https://github.com/fjdvm/hrms

## Overview

This is a staff-facing HRMS covering hiring, employee onboarding and records, performance, training, and operational dashboards. The principal workflow shown is an authenticated Staff member opening the applicant list, which loads and presents application data; the broader hiring lifecycle includes postings, interviews, and offers. The README also documents audit delivery and live staff notifications. Several major modules appear only in the tree or index, so their components are included without guessed call paths; edges are limited to relationships supported by excerpts, index references, or README statements.

Main entry points: [`lib/applications.ts`](https://github.com/fjdvm/hrms/blob/main/lib/applications.ts) (Applications), [`lib/database.ts`](https://github.com/fjdvm/hrms/blob/main/lib/database.ts) (Postgres access), [`app/(hrms)/applicants/page.tsx`](https://github.com/fjdvm/hrms/blob/main/app/(hrms)/applicants/page.tsx) (Applicant list), [`lib/staff-notifications.ts`](https://github.com/fjdvm/hrms/blob/main/lib/staff-notifications.ts) (Staff notifications)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and shell"]
  node_appshell["HRMS shell<br/>[layout.tsx]"]
  node_staffauth["Staff access<br/>[staff.ts]"]
  node_portalaccess["Module access<br/>[access.ts]"]
  node_portalclient["Portal client<br/>[client.ts]"]
end

subgraph group_hiring["Hiring lifecycle"]
  node_applicantlist["Applicant list<br/>[page.tsx]"]
  node_applicationrequest["Application request<br/>[applications.ts]"]
  node_applications["Applications<br/>[applications.ts]"]
  node_applicationview["Application views"]
  node_jobpostings["Job postings<br/>[job-postings.ts]"]
  node_interviews["Interview scheduling"]
  node_offers["Offers<br/>[offers.ts]"]
end

subgraph group_people["Employee operations"]
  node_employees["Employee records<br/>[employees.ts]"]
  node_onboarding["Employee onboarding<br/>[page.tsx]"]
end

subgraph group_operations["Performance and training"]
  node_performance["Performance management<br/>[performance.ts]"]
  node_training["Training management<br/>[trainings.ts]"]
end

subgraph group_platform["Shared services"]
  node_dashboard["Dashboard data<br/>[dashboard-data.ts]"]
  node_database[("Postgres access<br/>[database.ts]")]
  node_audit["Audit delivery<br/>[audit.ts]"]
  node_notifications["Staff notifications"]
end

node_staff(("Staff member"))
node_portal["Staff Portal"]
node_gateway["API gateway"]

node_staff -->|"opens"| node_applicantlist
node_applicantlist -->|"requires module"| node_staffauth
node_applicantlist -->|"loads list"| node_applicationrequest
node_applicationrequest -->|"creates request"| node_applications
node_applications -->|"supplies types"| node_applicationview
node_applications -->|"queries"| node_database
node_applications -->|"checks access"| node_portalaccess
node_applications -->|"lists interviewers"| node_portalclient
node_applications -->|"validates interview"| node_interviews
node_staffauth -->|"checks module"| node_portalaccess
node_portalaccess -->|"validates session"| node_portalclient
node_portalclient -->|"calls integrations"| node_portal
node_applicantlist -->|"formats list"| node_applicationview
node_jobpostings -.->|"reads postings"| node_database
node_jobpostings -->|"counts applications"| node_database
node_appshell -.->|"loads shell access"| node_staffauth
node_onboarding -->|"loads onboarding data"| node_employees
node_employees -->|"queries records"| node_database
node_employees -->|"checks access"| node_portalaccess
node_dashboard -->|"queries metrics"| node_database
node_audit -->|"delivers events"| node_gateway
node_notifications -->|"delivers notifications"| node_gateway
node_notifications -->|"queues events"| node_database
node_staff -->|"opens inbox"| node_notifications
node_gateway -->|"pushes live events"| node_notifications

click node_appshell "https://github.com/fjdvm/hrms/blob/main/app/(hrms)/layout.tsx"
click node_staffauth "https://github.com/fjdvm/hrms/blob/main/lib/portal/staff.ts"
click node_portalaccess "https://github.com/fjdvm/hrms/blob/main/lib/portal/access.ts"
click node_portalclient "https://github.com/fjdvm/hrms/blob/main/lib/portal/client.ts"
click node_applicantlist "https://github.com/fjdvm/hrms/blob/main/app/(hrms)/applicants/page.tsx"
click node_applicationrequest "https://github.com/fjdvm/hrms/blob/main/lib/portal/applications.ts"
click node_applications "https://github.com/fjdvm/hrms/blob/main/lib/applications.ts"
click node_applicationview "https://github.com/fjdvm/hrms/blob/main/lib/application-view.ts"
click node_jobpostings "https://github.com/fjdvm/hrms/blob/main/lib/job-postings.ts"
click node_interviews "https://github.com/fjdvm/hrms/blob/main/lib/interview-booking.ts"
click node_offers "https://github.com/fjdvm/hrms/blob/main/lib/offers.ts"
click node_employees "https://github.com/fjdvm/hrms/blob/main/lib/employees.ts"
click node_onboarding "https://github.com/fjdvm/hrms/blob/main/app/(hrms)/employee-onboarding/page.tsx"
click node_performance "https://github.com/fjdvm/hrms/blob/main/lib/performance.ts"
click node_training "https://github.com/fjdvm/hrms/blob/main/lib/trainings.ts"
click node_dashboard "https://github.com/fjdvm/hrms/blob/main/lib/dashboard-data.ts"
click node_database "https://github.com/fjdvm/hrms/blob/main/lib/database.ts"
click node_audit "https://github.com/fjdvm/hrms/blob/main/lib/audit.ts"
click node_notifications "https://github.com/fjdvm/hrms/blob/main/lib/staff-notifications.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_appshell,node_staffauth,node_portalaccess,node_portalclient toneBlue
class node_applicantlist,node_applicationrequest,node_applications,node_applicationview,node_jobpostings,node_interviews,node_offers toneAmber
class node_employees,node_onboarding,node_gateway toneMint
class node_performance,node_training toneRose
class node_dashboard,node_database,node_audit,node_notifications,node_staff,node_portal toneIndigo
```

## Components

### Access and shell

- [HRMS shell](https://github.com/fjdvm/hrms/blob/main/app/(hrms)/layout.tsx): `app/(hrms)/layout.tsx`
- [Staff access](https://github.com/fjdvm/hrms/blob/main/lib/portal/staff.ts): `lib/portal/staff.ts`
- [Module access](https://github.com/fjdvm/hrms/blob/main/lib/portal/access.ts): `lib/portal/access.ts`
- [Portal client](https://github.com/fjdvm/hrms/blob/main/lib/portal/client.ts): `lib/portal/client.ts`

### Hiring lifecycle

- [Applicant list](https://github.com/fjdvm/hrms/blob/main/app/(hrms)/applicants/page.tsx): `app/(hrms)/applicants/page.tsx`
- [Application request](https://github.com/fjdvm/hrms/blob/main/lib/portal/applications.ts): `lib/portal/applications.ts`
- [Applications](https://github.com/fjdvm/hrms/blob/main/lib/applications.ts): `lib/applications.ts`
- [Application views](https://github.com/fjdvm/hrms/blob/main/lib/application-view.ts): `lib/application-view.ts`
- [Job postings](https://github.com/fjdvm/hrms/blob/main/lib/job-postings.ts): `lib/job-postings.ts`
- [Interview scheduling](https://github.com/fjdvm/hrms/blob/main/lib/interview-booking.ts): `lib/interview-booking.ts`
- [Offers](https://github.com/fjdvm/hrms/blob/main/lib/offers.ts): `lib/offers.ts`

### Employee operations

- [Employee records](https://github.com/fjdvm/hrms/blob/main/lib/employees.ts): `lib/employees.ts`
- [Employee onboarding](https://github.com/fjdvm/hrms/blob/main/app/(hrms)/employee-onboarding/page.tsx): `app/(hrms)/employee-onboarding/page.tsx`

### Performance and training

- [Performance management](https://github.com/fjdvm/hrms/blob/main/lib/performance.ts): `lib/performance.ts`
- [Training management](https://github.com/fjdvm/hrms/blob/main/lib/trainings.ts): `lib/trainings.ts`

### Shared services

- [Dashboard data](https://github.com/fjdvm/hrms/blob/main/lib/dashboard-data.ts): `lib/dashboard-data.ts`
- [Postgres access](https://github.com/fjdvm/hrms/blob/main/lib/database.ts): `lib/database.ts`
- [Audit delivery](https://github.com/fjdvm/hrms/blob/main/lib/audit.ts): `lib/audit.ts`
- [Staff notifications](https://github.com/fjdvm/hrms/blob/main/lib/staff-notifications.ts): `lib/staff-notifications.ts`

### Other components

- **Staff member**
- **Staff Portal**
- **API gateway**

## Connections

- Staff member → Applicant list: opens (evidence: `app/(hrms)/applicants/page.tsx`)
- Applicant list → Staff access: requires module (evidence: `app/(hrms)/applicants/page.tsx`)
- Applicant list → Application request: loads list (evidence: `app/(hrms)/applicants/page.tsx`)
- Application request → Applications: creates request (evidence: `lib/portal/applications.ts`)
- Applications → Application views: supplies types (evidence: `lib/application-view.ts`)
- Applications → Postgres access: queries (evidence: `lib/applications.ts`)
- Applications → Module access: checks access (evidence: `lib/applications.ts`)
- Applications → Portal client: lists interviewers (evidence: `lib/applications.ts`)
- Applications → Interview scheduling: validates interview (evidence: `lib/applications.ts`)
- Staff access → Module access: checks module (evidence: `lib/portal/staff.ts`)
- Module access → Portal client: validates session (evidence: `lib/portal/access.ts`)
- Portal client → Staff Portal: calls integrations (evidence: `lib/portal/client.ts`)
- Applicant list → Application views: formats list (evidence: `app/(hrms)/applicants/page.tsx`)
- Job postings → Postgres access: reads postings
- Job postings → Postgres access: counts applications (evidence: `README.md`)
- HRMS shell → Staff access: loads shell access
- Employee onboarding → Employee records: loads onboarding data (evidence: `app/(hrms)/employee-onboarding/page.tsx`)
- Employee records → Postgres access: queries records (evidence: `lib/employees.ts`)
- Employee records → Module access: checks access (evidence: `lib/employees.ts`)
- Dashboard data → Postgres access: queries metrics (evidence: `lib/dashboard-data.ts`)
- Audit delivery → API gateway: delivers events (evidence: `README.md`)
- Staff notifications → API gateway: delivers notifications (evidence: `README.md`)
- Staff notifications → Postgres access: queues events (evidence: `README.md`)
- Staff member → Staff notifications: opens inbox (evidence: `README.md`)
- API gateway → Staff notifications: pushes live events (evidence: `README.md`)
