# seruyange-jojo/hrms-project architecture

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

- Interactive diagram: https://gitdiagram.com/seruyange-jojo/hrms-project
- Repository: https://github.com/seruyange-jojo/hrms-project

## Overview

This HRMS supports employee, manager, and HR/admin workflows: users sign in, reach role-appropriate screens, and use them to manage employee and department records or view and act on attendance, leave, and payroll information. The React app sends API requests to a Go/Gin service, whose routes apply authentication and role checks before dispatching to domain controllers backed by PostgreSQL through GORM. The README documents dashboard analytics and manager team overviews; the sampled manager dashboard confirms attendance, leave, and team-data use, but does not establish persistence for its announcements or task UI.

Main entry points: [`backend/routes/routes.go`](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/routes/routes.go) (API routes), [`frontend/src/App.jsx`](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/App.jsx) (React app), [`frontend/src/services/api.js`](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/services/api.js) (API client), [`backend/models/models.go`](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/models/models.go) (Domain models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web application"]
  node_app["React app<br/>[App.jsx]"]
  node_authstate["Auth state<br/>[useAuth.jsx]"]
  node_dashboards["Role dashboards<br/>[Dashboard.jsx]"]
  node_employeeui["Employee pages<br/>[Employees.jsx]"]
  node_departmentui["Department pages<br/>[Departments.jsx]"]
  node_leaveui["Leave pages"]
  node_payrollui["Payroll pages<br/>[MyPayroll.jsx]"]
  node_profileui["Profile page<br/>[Profile.jsx]"]
  node_attendanceui["Attendance actions"]
  node_apiservice["API client<br/>[api.js]"]
end

subgraph group_api["API and access"]
  node_server["Gin API server<br/>[main.go]"]
  node_routes["API routes<br/>[routes.go]"]
  node_authmw["JWT middleware<br/>[auth.go]"]
  node_rbac["Role checks<br/>[rbac.go]"]
  node_jwt["JWT utilities<br/>[jwt.go]"]
end

subgraph group_hrdomains["HR workflows"]
  node_authcontroller["Authentication<br/>[auth.go]"]
  node_userscontroller["User management<br/>[user.go]"]
  node_employeescontroller["Employee records<br/>[employee.go]"]
  node_departmentscontroller["Departments<br/>[department.go]"]
  node_attendancecontroller["Attendance<br/>[attendance.go]"]
  node_leavecontroller["Leave requests<br/>[leave.go]"]
  node_payrollcontroller["Payroll<br/>[payroll.go]"]
end

subgraph group_persistence["Persistence"]
  node_dbinit["Database setup<br/>[database.go]"]
  node_models["Domain models<br/>[models.go]"]
end

node_staff(("HRMS users"))
node_postgres[("PostgreSQL")]

node_staff -->|"uses"| node_app
node_app -->|"provides auth"| node_authstate
node_app -->|"routes to"| node_dashboards
node_app -->|"routes to"| node_employeeui
node_app -->|"routes to"| node_departmentui
node_app -->|"routes to"| node_leaveui
node_app -->|"routes to"| node_payrollui
node_app -->|"routes to"| node_profileui
node_authstate -->|"requests auth"| node_apiservice
node_dashboards -->|"loads HR data"| node_apiservice
node_employeeui -->|"manages records"| node_apiservice
node_departmentui -->|"manages units"| node_apiservice
node_leaveui -->|"submits requests"| node_apiservice
node_payrollui -->|"loads payslips"| node_apiservice
node_profileui -->|"updates profile"| node_apiservice
node_attendanceui -->|"logs attendance"| node_apiservice
node_apiservice -->|"HTTP requests"| node_server
node_server -->|"initializes"| node_dbinit
node_server -->|"registers routes"| node_routes
node_routes -->|"protects routes"| node_authmw
node_routes -->|"applies role checks"| node_rbac
node_routes -->|"dispatches auth"| node_authcontroller
node_routes -->|"dispatches users"| node_userscontroller
node_routes -->|"dispatches employees"| node_employeescontroller
node_routes -->|"dispatches departments"| node_departmentscontroller
node_routes -->|"dispatches attendance"| node_attendancecontroller
node_routes -->|"dispatches leave"| node_leavecontroller
node_routes -->|"dispatches payroll"| node_payrollcontroller
node_authcontroller -->|"generates tokens"| node_jwt
node_authcontroller -->|"loads user"| node_models
node_userscontroller -->|"reads/writes"| node_models
node_employeescontroller -->|"reads/writes"| node_models
node_departmentscontroller -->|"reads/writes"| node_models
node_attendancecontroller -->|"reads/writes"| node_models
node_leavecontroller -->|"reads/writes"| node_models
node_payrollcontroller -->|"reads/writes"| node_models
node_dbinit -->|"migrates"| node_models
node_dbinit -->|"connects"| node_postgres

click node_app "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/App.jsx"
click node_authstate "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/hooks/useAuth.jsx"
click node_dashboards "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/Dashboard.jsx"
click node_employeeui "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/Employees.jsx"
click node_departmentui "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/Departments.jsx"
click node_leaveui "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/LeaveRequestNew.jsx"
click node_payrollui "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/MyPayroll.jsx"
click node_profileui "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/Profile.jsx"
click node_attendanceui "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/components/AttendanceCheckModal.jsx"
click node_apiservice "https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/services/api.js"
click node_server "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/main.go"
click node_routes "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/routes/routes.go"
click node_authmw "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/middleware/auth.go"
click node_rbac "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/middleware/rbac.go"
click node_authcontroller "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/auth.go"
click node_userscontroller "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/user.go"
click node_employeescontroller "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/employee.go"
click node_departmentscontroller "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/department.go"
click node_attendancecontroller "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/attendance.go"
click node_leavecontroller "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/leave.go"
click node_payrollcontroller "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/payroll.go"
click node_jwt "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/utils/jwt.go"
click node_dbinit "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/database/database.go"
click node_models "https://github.com/seruyange-jojo/hrms-project/blob/main/backend/models/models.go"

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_authstate,node_dashboards,node_employeeui,node_departmentui,node_leaveui,node_payrollui,node_profileui,node_attendanceui,node_apiservice,node_staff toneBlue
class node_server,node_routes,node_authmw,node_rbac,node_jwt,node_postgres toneAmber
class node_authcontroller,node_userscontroller,node_employeescontroller,node_departmentscontroller,node_attendancecontroller,node_leavecontroller,node_payrollcontroller toneMint
class node_dbinit,node_models toneRose
```

## Components

### Web application

- [React app](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Auth state](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/hooks/useAuth.jsx): `frontend/src/hooks/useAuth.jsx`
- [Role dashboards](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/Dashboard.jsx): `frontend/src/pages/Dashboard.jsx`
- [Employee pages](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/Employees.jsx): `frontend/src/pages/Employees.jsx`
- [Department pages](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/Departments.jsx): `frontend/src/pages/Departments.jsx`
- [Leave pages](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/LeaveRequestNew.jsx): `frontend/src/pages/LeaveRequestNew.jsx`
- [Payroll pages](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/MyPayroll.jsx): `frontend/src/pages/MyPayroll.jsx`
- [Profile page](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/pages/Profile.jsx): `frontend/src/pages/Profile.jsx`
- [Attendance actions](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/components/AttendanceCheckModal.jsx): `frontend/src/components/AttendanceCheckModal.jsx`
- [API client](https://github.com/seruyange-jojo/hrms-project/blob/main/frontend/src/services/api.js): `frontend/src/services/api.js`

### API and access

- [Gin API server](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/main.go): `backend/main.go`
- [API routes](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/routes/routes.go): `backend/routes/routes.go`
- [JWT middleware](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/middleware/auth.go): `backend/middleware/auth.go`
- [Role checks](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/middleware/rbac.go): `backend/middleware/rbac.go`
- [JWT utilities](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/utils/jwt.go): `backend/utils/jwt.go`

### HR workflows

- [Authentication](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/auth.go): `backend/controllers/auth.go`
- [User management](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/user.go): `backend/controllers/user.go`
- [Employee records](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/employee.go): `backend/controllers/employee.go`
- [Departments](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/department.go): `backend/controllers/department.go`
- [Attendance](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/attendance.go): `backend/controllers/attendance.go`
- [Leave requests](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/leave.go): `backend/controllers/leave.go`
- [Payroll](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/controllers/payroll.go): `backend/controllers/payroll.go`

### Persistence

- [Database setup](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/database/database.go): `backend/database/database.go`
- [Domain models](https://github.com/seruyange-jojo/hrms-project/blob/main/backend/models/models.go): `backend/models/models.go`

### Other components

- **HRMS users**
- **PostgreSQL**

## Connections

- HRMS users → React app: uses
- React app → Auth state: provides auth
- React app → Role dashboards: routes to
- React app → Employee pages: routes to
- React app → Department pages: routes to
- React app → Leave pages: routes to
- React app → Payroll pages: routes to
- React app → Profile page: routes to
- Auth state → API client: requests auth
- Role dashboards → API client: loads HR data
- Employee pages → API client: manages records
- Department pages → API client: manages units
- Leave pages → API client: submits requests
- Payroll pages → API client: loads payslips
- Profile page → API client: updates profile
- Attendance actions → API client: logs attendance
- API client → Gin API server: HTTP requests
- Gin API server → Database setup: initializes
- Gin API server → API routes: registers routes
- API routes → JWT middleware: protects routes
- API routes → Role checks: applies role checks
- API routes → Authentication: dispatches auth
- API routes → User management: dispatches users
- API routes → Employee records: dispatches employees
- API routes → Departments: dispatches departments
- API routes → Attendance: dispatches attendance
- API routes → Leave requests: dispatches leave
- API routes → Payroll: dispatches payroll
- Authentication → JWT utilities: generates tokens
- Authentication → Domain models: loads user
- User management → Domain models: reads/writes
- Employee records → Domain models: reads/writes
- Departments → Domain models: reads/writes
- Attendance → Domain models: reads/writes
- Leave requests → Domain models: reads/writes
- Payroll → Domain models: reads/writes
- Database setup → Domain models: migrates
- Database setup → PostgreSQL: connects
