# sprint-4team/sb13-hrbank-team04 architecture

> Architecture diagram of the GitHub repository sprint-4team/sb13-hrbank-team04, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sprint-4team/sb13-hrbank-team04
- Repository: https://github.com/sprint-4team/sb13-hrbank-team04

## Overview

#### Purpose and Entry Points
HR Bank is an employee-management system with a React/TypeScript frontend and Spring Boot REST backend. The backend starts at `src/main/java/com/codeit/hrbank/HrBankApplication.java`; its built frontend is also served as static content under `src/main/resources/static/index.html`. Frontend development starts from `frontend/src/main.tsx`.

#### Frontend Application Shell
The Vite React client organizes the UI around page-level modules for dashboard, employees, departments, attendance, history, and backups. Shared layout/navigation establishes the application frame, while page components compose feature tables, filters, charts, and modals.
- `frontend/src/components/layout/Layout.tsx`
- `frontend/src/components/layout/Navigation.tsx`
- `frontend/src/pages/Dashboard.tsx`

#### Frontend API and State Boundary
Feature-specific API adapters isolate HTTP calls from UI components; centralized client plumbing is at `frontend/src/api/client.ts`. Per-domain stores hold fetched lists/dashboard data and coordinate filtering, cursor/infinite-scroll pagination, mutations, and toast feedback for views.
- `frontend/src/api/employee/employeeApi.ts`
- `frontend/src/store/employeeStore.ts`
- `frontend/src/store/historyStore.ts`

#### Employee and Department Core Domain
Employees are the primary managed records, associated with departments and status. REST controllers accept request DTOs, delegate to services, and persist through Spring Data/JPA repositories; custom repository implementations support richer searches. Employee changes are a likely cross-domain event source for history.
- `src/main/java/com/codeit/hrbank/employee/controller/EmployeeController.java`
- `src/main/java/com/codeit/hrbank/employee/service/EmployeeService.java`
- `src/main/java/com/codeit/hrbank/department/service/DepartmentServiceImpl.java`

#### Attendance and Change-History Domains
Attendance records are independently created and updated for employees. The changelog subsystem stores employee change logs and detailed diffs, exposes cursor-paged search and detail retrieval, and backs the frontend History screen.
- `src/main/java/com/codeit/hrbank/attendance/controller/AttendanceController.java`
- `src/main/java/com/codeit/hrbank/changelog/service/ChangeLogServiceImpl.java`
- `src/main/java/com/codeit/hrbank/changelog/repository/EmployeeChangeLogRepositoryCustomImpl.java`

#### Backup and File Boundaries
Backup history is a scheduled subsystem with explicit progress/status and a guard against concurrent backups. File handling is separately layered and uses local filesystem storage, exposing upload/download concerns outside employee persistence.
- `src/main/java/com/codeit/hrbank/backup/scheduler/BackupScheduler.java`
- `src/main/java/com/codeit/hrbank/backup/service/BackupHistoryCreationService.java`
- `src/main/java/com/codeit/hrbank/file/storage/LocalFileStorage.java`

#### Persistence, API Contracts, and Runtime
The runtime is JVM/Spring Boot, built with Gradle, using Spring Web and Spring Data JPA. Domain entities are persistence models; request/response DTOs form the REST contract boundary. Querydsl/JPA configuration supports custom query implementations. Global exception handling maps domain failures to API errors; Swagger configuration provides API documentation.
- `build.gradle`
- `src/main/resources/application.yaml`
- `src/main/java/com/codeit/hrbank/common/GlobalExceptionHandler.java`

Main entry points: [`src/main/java/com/codeit/hrbank/HrBankApplication.java`](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/HrBankApplication.java) (Spring Boot application), [`src/main/resources/application.yaml`](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/resources/application.yaml) (JPA persistence), [`src/main/java/com/codeit/hrbank/employee/service/EmployeeService.java`](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/employee/service/EmployeeService.java) (Employee service), [`frontend/src/pages/Dashboard.tsx`](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/pages/Dashboard.tsx) (Dashboard page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React Frontend"]
  node_vite["Vite entry<br/>frontend bootstrap<br/>[main.tsx]"]
  node_shell["App layout &amp; navigation<br/>UI shell<br/>[Layout.tsx]"]
  node_dashboard["Dashboard page<br/>page module<br/>[Dashboard.tsx]"]
  node_api_client["HTTP client<br/>API plumbing<br/>[client.ts]"]
  node_employee_api["Employee API adapter<br/>feature API<br/>[employeeApi.ts]"]
  node_employee_store["Employee store<br/>domain state<br/>[employeeStore.ts]"]
  node_history_store["History store<br/>domain state<br/>[historyStore.ts]"]
end

subgraph group_api["Spring REST API"]
  node_spring_app{{"Spring Boot application<br/>backend entry"}}
  node_employee_controller["Employee REST controller"]
  node_attendance_controller["Attendance REST controller"]
  node_exception_handler["Global exception handler<br/>API error boundary"]
end

subgraph group_domains["Domain Services"]
  node_employee_service["Employee service<br/>domain service"]
  node_department_service["Department service<br/>domain service"]
  node_changelog_service["Change-log service<br/>domain service"]
  node_backup_scheduler["Backup scheduler<br/>scheduled job"]
  node_backup_service["Backup history service<br/>backup service"]
  node_file_storage["Local file storage<br/>file boundary"]
end

subgraph group_platform["Persistence &amp; Runtime"]
  node_changelog_queries["Change-log custom queries<br/>JPA repository"]
  node_database[("JPA persistence<br/>database<br/>[application.yaml]")]
  node_static_frontend["Built frontend<br/>static content<br/>[index.html]"]
  node_gradle["Gradle build<br/>build runtime<br/>[build.gradle]"]
end

node_vite -->|"boots"| node_shell
node_shell -->|"frames pages"| node_dashboard
node_dashboard -->|"uses state"| node_employee_store
node_dashboard -->|"uses state"| node_history_store
node_employee_store -->|"loads and mutates"| node_employee_api
node_employee_api -->|"uses"| node_api_client
node_history_store -->|"queries history"| node_api_client
node_api_client -->|"REST requests"| node_spring_app
node_spring_app -->|"routes"| node_employee_controller
node_spring_app -->|"routes"| node_attendance_controller
node_spring_app -.->|"maps failures"| node_exception_handler
node_spring_app -->|"serves"| node_static_frontend
node_employee_controller -->|"delegates"| node_employee_service
node_attendance_controller -->|"persists attendance"| node_database
node_employee_service -->|"resolves departments"| node_department_service
node_employee_service -->|"persists employees"| node_database
node_employee_service -.->|"records changes"| node_changelog_service
node_changelog_service -->|"searches"| node_changelog_queries
node_changelog_queries -->|"queries"| node_database
node_backup_scheduler -->|"triggers"| node_backup_service
node_backup_service -->|"records status"| node_database
node_file_storage -.->|"kept separate from"| node_database
node_gradle -->|"builds and runs"| node_spring_app

click node_vite "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/main.tsx"
click node_shell "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/components/layout/Layout.tsx"
click node_dashboard "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/pages/Dashboard.tsx"
click node_api_client "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/api/client.ts"
click node_employee_api "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/api/employee/employeeApi.ts"
click node_employee_store "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/store/employeeStore.ts"
click node_history_store "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/store/historyStore.ts"
click node_spring_app "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/HrBankApplication.java"
click node_employee_controller "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/employee/controller/EmployeeController.java"
click node_attendance_controller "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/attendance/controller/AttendanceController.java"
click node_exception_handler "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/common/GlobalExceptionHandler.java"
click node_employee_service "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/employee/service/EmployeeService.java"
click node_department_service "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/department/service/DepartmentServiceImpl.java"
click node_changelog_service "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/changelog/service/ChangeLogServiceImpl.java"
click node_backup_scheduler "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/backup/scheduler/BackupScheduler.java"
click node_backup_service "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/backup/service/BackupHistoryCreationService.java"
click node_file_storage "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/file/storage/LocalFileStorage.java"
click node_changelog_queries "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/changelog/repository/EmployeeChangeLogRepositoryCustomImpl.java"
click node_database "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/resources/application.yaml"
click node_static_frontend "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/resources/static/index.html"
click node_gradle "https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/build.gradle"

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_vite,node_shell,node_dashboard,node_api_client,node_employee_api,node_employee_store,node_history_store toneBlue
class node_spring_app,node_employee_controller,node_attendance_controller,node_exception_handler toneAmber
class node_employee_service,node_department_service,node_changelog_service,node_backup_scheduler,node_backup_service,node_file_storage toneMint
class node_changelog_queries,node_database,node_static_frontend,node_gradle toneRose
```

## Components

### React Frontend

- [Vite entry](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/main.tsx): frontend bootstrap · `frontend/src/main.tsx`
- [App layout & navigation](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/components/layout/Layout.tsx): UI shell · `frontend/src/components/layout/Layout.tsx`
- [Dashboard page](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/pages/Dashboard.tsx): page module · Representative of dashboard, employee, department, attendance, history, and backup pages. · `frontend/src/pages/Dashboard.tsx`
- [HTTP client](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/api/client.ts): API plumbing · `frontend/src/api/client.ts`
- [Employee API adapter](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/api/employee/employeeApi.ts): feature API · `frontend/src/api/employee/employeeApi.ts`
- [Employee store](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/store/employeeStore.ts): domain state · Coordinates lists, filtering, pagination, mutations, and feedback. · `frontend/src/store/employeeStore.ts`
- [History store](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/frontend/src/store/historyStore.ts): domain state · `frontend/src/store/historyStore.ts`

### Spring REST API

- [Spring Boot application](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/HrBankApplication.java): backend entry · Serves REST endpoints and the built frontend. · `src/main/java/com/codeit/hrbank/HrBankApplication.java`
- [Employee REST controller](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/employee/controller/EmployeeController.java): REST controller · `src/main/java/com/codeit/hrbank/employee/controller/EmployeeController.java`
- [Attendance REST controller](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/attendance/controller/AttendanceController.java): REST controller · `src/main/java/com/codeit/hrbank/attendance/controller/AttendanceController.java`
- [Global exception handler](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/common/GlobalExceptionHandler.java): API error boundary · `src/main/java/com/codeit/hrbank/common/GlobalExceptionHandler.java`

### Domain Services

- [Employee service](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/employee/service/EmployeeService.java): domain service · Manages employee records, departments, and status changes. · `src/main/java/com/codeit/hrbank/employee/service/EmployeeService.java`
- [Department service](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/department/service/DepartmentServiceImpl.java): domain service · `src/main/java/com/codeit/hrbank/department/service/DepartmentServiceImpl.java`
- [Change-log service](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/changelog/service/ChangeLogServiceImpl.java): domain service · Provides cursor-paged change history and detailed diffs. · `src/main/java/com/codeit/hrbank/changelog/service/ChangeLogServiceImpl.java`
- [Backup scheduler](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/backup/scheduler/BackupScheduler.java): scheduled job · Guards against concurrent backups. · `src/main/java/com/codeit/hrbank/backup/scheduler/BackupScheduler.java`
- [Backup history service](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/backup/service/BackupHistoryCreationService.java): backup service · Creates backup history with progress and status. · `src/main/java/com/codeit/hrbank/backup/service/BackupHistoryCreationService.java`
- [Local file storage](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/file/storage/LocalFileStorage.java): file boundary · Handles upload and download storage outside employee persistence. · `src/main/java/com/codeit/hrbank/file/storage/LocalFileStorage.java`

### Persistence & Runtime

- [Change-log custom queries](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/java/com/codeit/hrbank/changelog/repository/EmployeeChangeLogRepositoryCustomImpl.java): JPA repository · Implements richer cursor-paged history searches. · `src/main/java/com/codeit/hrbank/changelog/repository/EmployeeChangeLogRepositoryCustomImpl.java`
- [JPA persistence](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/resources/application.yaml): database · Entities and Spring Data repositories persist domain records. · `src/main/resources/application.yaml`
- [Built frontend](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/src/main/resources/static/index.html): static content · `src/main/resources/static/index.html`
- [Gradle build](https://github.com/sprint-4team/sb13-hrbank-team04/blob/develop/build.gradle): build runtime · Builds the JVM service with Spring Web, Data JPA, and Querydsl support. · `build.gradle`

## Connections

- Vite entry → App layout & navigation: boots
- App layout & navigation → Dashboard page: frames pages
- Dashboard page → Employee store: uses state
- Dashboard page → History store: uses state
- Employee store → Employee API adapter: loads and mutates
- Employee API adapter → HTTP client: uses
- History store → HTTP client: queries history
- HTTP client → Spring Boot application: REST requests
- Spring Boot application → Employee REST controller: routes
- Spring Boot application → Attendance REST controller: routes
- Spring Boot application → Global exception handler: maps failures
- Spring Boot application → Built frontend: serves
- Employee REST controller → Employee service: delegates
- Attendance REST controller → JPA persistence: persists attendance
- Employee service → Department service: resolves departments
- Employee service → JPA persistence: persists employees
- Employee service → Change-log service: records changes
- Change-log service → Change-log custom queries: searches
- Change-log custom queries → JPA persistence: queries
- Backup scheduler → Backup history service: triggers
- Backup history service → JPA persistence: records status
- Local file storage → JPA persistence: kept separate from
- Gradle build → Spring Boot application: builds and runs
