This is a Human Resources (HR) management system API built with Java and Spring Boot. The project demonstrates a well-structured backend application with features for managing job vacancies and candidates.
The project follows a clean architecture with the following main directories:
services
: Contains business logic and service layer classesentitys
: Defines the data models (Candidates and Vacancies)exceptions
: Custom exception classesDTOs
: Data Transfer Objects for input/outputdocker
: Docker-related files for containerizationcontrollerAdvice
: Global exception handlingrepositiry
: Data access layer interfacescontrollers
: REST API endpoints
- CRUD operations for Candidates and Vacancies
- Assigning Candidates to Vacancies
- Search functionality for Candidates and Vacancies
- Error handling with custom exceptions
- Containerization using Docker
- PostgreSQL database integration
- Framework: Spring Boot
- Language: Java
- Database: PostgreSQL
- Containerization: Docker
GET /Vacancies
: Retrieve all vacanciesPOST /Vacancies
: Create a new vacancyGET /Candidates
: Retrieve all candidatesPOST /Candidates
: Create a new candidateGET /search/Vacancies
: Search vacancies by nameGET /search/candidates
: Search candidates by namePOST /asign
: Assign a candidate to a vacancy
- SOLID Principles: The project adheres to SOLID principles, particularly the Single Responsibility Principle (SRP) by separating concerns into different services and controllers.
- DRY (Don't Repeat Yourself): Code duplication is minimized through proper abstraction and modularization.
- Exception Handling: Custom exceptions and global exception handling using
@ControllerAdvice
for consistent error responses. - DTO Pattern: Data Transfer Objects are used to decouple the API contract from internal data models.
- Repository Pattern: JPA repositories are used for data access abstraction.
The docker
directory contains:
Dockerfile
: For building the Java application imagedocker-compose.yml
: For orchestrating the application and database containers
To run the application using Docker:
cd docker docker-compose up
plainText
The application uses PostgreSQL, which runs in a Docker container. The connection details can be found in the application.properties
file.
The API is thoroughly tested using JUnit and Mockito. Test cases cover various scenarios including happy paths and error conditions.
I'm extremely happy with this project as it was entirely conceptualized by me. It provided an excellent opportunity to learn and implement new technologies and best practices. Some key learnings include:
- Containerization with Docker
- Comprehensive error handling
- API testing and validation
- Implementing a clean and scalable project structure
The project structure is comprehensive, including DTOs, controller advice for error handling, custom exceptions, and well-defined entities (Candidates and Vacancies) that form the core of the system.
I'm particularly proud of how I refactored the controllers to respect the Single Responsibility Principle, moving business logic to service classes. This project has been a great learning experience, and I look forward to applying these concepts in future endeavors.
- Clone the repository
- Navigate to the
docker
directory - Run
docker-compose up
- The API will be available at
http://localhost:8080
Enjoy exploring the HR System API!