A Spring Boot REST API application for managing employee data with authentication and CRUD operations.
- Java 17 (or your version)
- Spring Boot 3.x
- Spring Data JDBC
- PostgreSQL Database
- Gradle - Dependency Management
- Swagger/OpenAPI - API Documentation
- Lombok - Reduce boilerplate code
Before running this application, make sure you have the following installed:
- Java JDK 17 or higher
- Maven 3.6 or higher
- Docker Desktop
- DBeaver(Opinional)
- Your preferred IDE (IntelliJ IDEA, Eclipse, VS Code)
git clone <your-repository-url>
cd employee-management-backendUpdate the src/main/resources/application.properties file with your database credentials:
#Database Configuration
spring.datasource.url=jdbc:db2://localhost:50000/your_database_name
spring.datasource.username=your_username
spring.datasource.password=your_password
# JPA/Hibernate Properties
spring.jpa.hibernate.ddl-auto=update
spring.jpa.show-sql=true
# Server Configuration
server.port=8080Please look at docker-compose.yml, look/edit the settings and run
docker-compose up
mvn clean install- Open the project in your IDE
- Navigate to
src/main/java/com/example/demo/DemoApplication.java - Right-click and select "Run 'DemoApplication'"
Once the application is running, you can access:
- Application: http://localhost:8080
- Swagger UI: http://localhost:8080/swagger-ui.html
- API Docs: http://localhost:8080/v3/api-docs
POST /api/v1/users/register- Register new userPOST /api/v1/users/login- User loginGET /api/v1/users/{username}- Get user detailsPUT /api/v1/users/{username}/password- Update password
GET /api/v1/employees/getAllEmployees- Get all employeesGET /api/v1/employees/{email}- Get employee by emailPOST /api/v1/employees- Create new employeePUT /api/v1/employees- Update employeeDELETE /api/v1/employees/{email}- Delete employeeGET /api/v1/employees/search/firstname/{firstname}- Search by firstnameGET /api/v1/employees/search/experience/{experience}- Find by experienceGET /api/v1/employees/exists/{email}- Check if email exists
- Register a new user:
curl -X POST http://localhost:8080/api/v1/users/register \
-H "Content-Type: application/json" \
-d '{
"userName": "john.doe@example.com",
"firstName": "John",
"lastName": "Doe",
"email": "john.doe@example.com",
"password": "password123",
"dateOfBirth": "1990-01-01",
"mobileNumber": 1234567890,
"domain": "backend",
"experience": 5
}'- Login:
curl -X POST http://localhost:8080/api/v1/users/login \
-H "Content-Type: application/json" \
-d '{
"userName": "john.doe@example.com",
"password": "password123"
}'src/
├── main/
│ ├── java/com/example/demo/
│ │ ├── controller/ # REST Controllers
│ │ ├── service/ # Business Logic
│ │ ├── dao/ # Data Access Layer
│ │ ├── dto/ # Data Transfer Objects
│ │ ├── exception/ # Custom Exceptions
│ │ └── DemoApplication.java
│ └── resources/
│ ├── application.properties
│ └── data.sql # Initial data (if any)
└── test/ # Unit and Integration tests
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Chunkit Yip (CK) - Initial work