https://github.com/mcyldz/hr-inventory
Human Resource Inventory Management Project
https://github.com/mcyldz/hr-inventory
java jpa-hibernate jwt-authentication mapstruct maven postgresql rest-api spring spring-boot
Last synced: about 2 months ago
JSON representation
Human Resource Inventory Management Project
- Host: GitHub
- URL: https://github.com/mcyldz/hr-inventory
- Owner: mcyldz
- Created: 2025-07-08T10:16:17.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2025-09-01T18:02:33.000Z (9 months ago)
- Last Synced: 2025-09-01T20:21:04.391Z (9 months ago)
- Topics: java, jpa-hibernate, jwt-authentication, mapstruct, maven, postgresql, rest-api, spring, spring-boot
- Language: Java
- Homepage:
- Size: 148 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# HR Inventory Management System API
## π Project Description
**HR Inventory Management System API** is a backend application developed for managing a companyβs Human Resources (HR) and inventory processes.
This API provides the following core functionalities:
- Personnel Management
- Inventory Tracking
- Asset Assignment and Return
The project is built with best practices and design patterns from the Java and Spring Boot ecosystem, structured to follow enterprise-level software architecture.
---
## π Tech Stack & Tools
- **Backend:** Java 21, Spring Boot 3.x
- **Data Access:** Spring Data JPA, Hibernate
- **Database:** PostgreSQL
- **Security:** Spring Security, JWT (JSON Web Token)
- **API & Documentation:** RESTful API, Springdoc-openapi (Swagger UI)
- **Object Mapping:** MapStruct
- **Utilities:** Lombok
- **Build Tool:** Apache Maven
- **Database Management:** DBeaver
- **API Testing Tools:** Postman, Swagger UI
---
## π§± Architecture & Design Principles
### Layered Architecture
The application is structured in clearly separated layers:
- **Controller:** Handles HTTP requests and routing.
- **Service:** Contains business logic.
- **Repository:** Manages database operations.
- **Entity:** Represents database tables.
- **DTO (Data Transfer Object):** Defines data structures for requests/responses.
- **Mapper:** Converts between Entities and DTOs.
### DTO Pattern
- Ensures sensitive data is hidden from API consumers.
- Decouples API contracts from the database schema.
- Uses structures such as `Request` and `Response`.
### Centralized Exception Handling
- Implemented with `@RestControllerAdvice` and a `GlobalExceptionHandler`.
- Returns consistent error responses using a standardized `ErrorResponse` DTO and `ErrorCode` enum.
### Programming to an Interface
- Service layer is abstracted with interfaces.
- Enhances testability, modularity, and scalability.
---
## βοΈ Getting Started
### Prerequisites
- Java Development Kit (JDK) 21
- Apache Maven
- PostgreSQL
### Clone the Repository
```bash
git clone
cd hr-inventory
```
### Database Setup
Create a PostgreSQL database named hr_inventory_db:
```bash
CREATE DATABASE hr_inventory_db;
```
### Configuration
Update the database credentials in src/main/resources/application-dev.yml:
```bash
spring:
datasource:
url: jdbc:postgresql://localhost:5432/hr_inventory_db
username: ${DB_USER}
password: ${DB_PASSWORD}
driver-class-name: org.postgresql.Driver
```
### Run the Application
Using an IDE (e.g., IntelliJ IDEA):
Open the project.
Run HrInventoryManagementApplication.java.
Via Command Line:
```bash
mvn spring-boot:run
```
# π API Reference
ACCESS INTERACTIVE API DOCUMENTATION AT:
http://localhost:8080/swagger-ui.html
# π Security
The API is secured using JWT (JSON Web Token) authentication.
After successful login, the token must be provided in the request header:
Authorization: Bearer
Role-based access control is enforced using @PreAuthorize.
# π« Contact
For questions or contributions, please open an issue or contact the developer via the GitHub repository.