Backend REST API Human Resource Information System (HRIS) menggunakan Java Spring Boot, Spring Security JWT, MySQL, JPA/Hibernate, Swagger OpenAPI, Audit Log, dan Unit Testing.
- Java 21
- Spring Boot 3.x
- Spring Security
- JWT Authentication
- Spring Data JPA
- MySQL 8
- Swagger / OpenAPI
- Lombok
- JUnit 5
- Mockito
- Docker
- Docker Compose
- User Registration
- User Login
- JWT Access Token
- JWT Refresh Token
- Role Based Access Control (RBAC)
- Spring Security
- Protected API Endpoints
Roles:
- ADMIN
- HR
- EMPLOYEE
- Create Department
- Get All Departments
- Get Department By Id
- Update Department
- Delete Department
- Create Position
- Get All Positions
- Get Position By Id
- Update Position
- Delete Position
- Create Employee
- Get Employee By Id
- Get All Employees
- Update Employee
- Delete Employee
Fields:
- Employee Number
- Full Name
- Phone
- Hire Date
- Salary
- Status
- Department
- Position
- Photo
Employee Search:
- Keyword Search
- Pagination
- Sorting
- Filtering
Example:
GET /api/employees/search?keyword=budi&page=0&size=10&sortBy=fullName&direction=asc
Endpoint:
GET /api/dashboard
Response:
- Total Employees
- Active Employees
- Resigned Employees
- Total Departments
- Total Positions
- Total Activities
- Get Current User Profile
- Update Profile
- Change Password
- Update Role
Endpoints:
GET /api/users/me
PUT /api/users/profile
PUT /api/users/change-password
PUT /api/users/{id}/role
Upload employee photo:
POST /api/employees/{id}/photo
Validation:
- JPG
- PNG
- Max 2 MB
Track all activities:
- CREATE
- UPDATE
- DELETE
Stored Information:
- Username
- Action
- Entity Name
- Entity Id
- Created At
Endpoints:
GET /api/activity-logs
GET /api/activity-logs/search
GET /api/activity-logs/filter
GET /api/activity-logs/date
GET /api/activity-logs/advanced
Features:
- Pagination
- Sorting
- Keyword Search
- Filter By Username
- Filter By Action
- Filter By Date Range
Swagger UI:
http://localhost:8080/swagger-ui/index.html
OpenAPI JSON:
http://localhost:8080/v3/api-docs
src/main/java/com/hris
├── config
├── controller
├── dto
├── entity
├── exception
├── repository
├── response
├── security
└── service
git clone https://github.com/your-username/hris-api.git
cd hris-apiCreate MySQL database:
CREATE DATABASE hris_db;Update:
application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/hris_db
spring.datasource.username=root
spring.datasource.password=your_passwordUsing Maven Wrapper:
mvnw.cmd spring-boot:runOr:
./mvnw spring-boot:runRun all tests:
mvnw.cmd testCurrent Tests:
- DepartmentServiceTest
- PositionServiceTest
- EmployeeServiceTest
- AuthServiceTest
- DepartmentControllerTest
- PositionControllerTest
- EmployeeControllerTest
Build:
docker compose buildRun:
docker compose upSwagger:
http://localhost:8080/swagger-ui/index.html
Authentication:
POST /api/auth/loginResponse:
{
"accessToken": "...",
"refreshToken": "...",
"email": "admin@hris.com",
"role": "ADMIN"
}Use:
Authorization: Bearer <access_token>- Soft Delete
- Global Auditing
- CreatedBy / UpdatedBy
- Docker Registry
- GitHub Actions CI/CD
- Redis Cache
- Email Notification
- Multi Tenant Support
- Kubernetes Deployment
Project ini mencakup kompetensi:
- Java Backend Development
- Spring Boot REST API
- Spring Security JWT
- RBAC Authorization
- File Upload
- Swagger OpenAPI
- JPA / Hibernate
- Unit Testing
- Controller Testing
- Audit Logging
- Docker Fundamentals