Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Kaaldut8/Employee_Management_REST_API_SpringBoot

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

👨‍💼 Employee Management REST API

A production-style RESTful backend built with Spring Boot and MySQL — featuring full CRUD operations, layered architecture, input validation, and comprehensive unit testing.


🚀 Tech Stack

Layer Technology
Language Java 17+
Framework Spring Boot
ORM Spring Data JPA (Hibernate)
Database MySQL
Testing JUnit 5
Build Tool Maven
API Testing Postman

🏗️ Architecture

Clean layered architecture following industry best practices:

├── Controller Layer   → Handles HTTP requests & responses
├── Service Layer      → Business logic & validations
├── Repository Layer   → Database interactions via JPA
├── Model (Entity)     → Data structure definitions
└── Exception Handler  → Global error handling

✨ Key Features

  • ✅ Full CRUD operations for employee records
  • JPA-optimized queries — reduced redundancy by 25%
  • Input validation with meaningful error messages
  • Custom 404 handling with proper HTTP status codes
  • JUnit unit tests with high endpoint coverage
  • ✅ Clean separation of concerns across all layers

📡 API Endpoints

Method Endpoint Description
POST /api/employees Create a new employee
GET /api/employees Fetch all employees
GET /api/employees/{id} Get employee by ID
PUT /api/employees/{id} Update employee details
DELETE /api/employees/{id} Delete an employee

📥 Sample Requests

Create Employee (POST)

{
  "name": "Raghav Maheshwari",
  "email": "raghav@example.com",
  "department": "Engineering",
  "salary": 75000
}

Success Response (201 Created)

{
  "id": 1,
  "name": "Raghav Maheshwari",
  "email": "raghav@example.com",
  "department": "Engineering",
  "salary": 75000
}

Validation Error Response (400 Bad Request)

{
  "email": "Email should be valid",
  "salary": "Salary must be a positive number"
}

⚙️ How to Run

Prerequisites: Java 17+, MySQL, Maven

# 1. Clone the repository
git clone https://github.com/Kaaldut8/Employee_Management_REST_API_SpringBoot.git
cd Employee_Management_REST_API_SpringBoot

# 2. Configure MySQL in src/main/resources/application.properties
spring.datasource.url=jdbc:mysql://localhost:3306/employee_db
spring.datasource.username=your_username
spring.datasource.password=your_password

# 3. Run the application
mvn spring-boot:run

Server starts at: http://localhost:8080

Run Tests

mvn test

📁 Project Structure

src/
├── main/java/com/example/
│   ├── controller/      # REST controllers
│   ├── service/         # Business logic
│   ├── repository/      # JPA repositories
│   ├── model/           # Entity classes
│   └── exception/       # Global exception handling
└── test/                # JUnit test cases

👨‍💻 Author

Raghav Maheshwari

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.