https://github.com/sayammishra3/h_b_m_s_-project
A Java 8 Spring Boot-based Hotel Booking System with microservices architecture, JWT authentication, AWS S3 integration, Apache Kafka, Hibernate, and MySQL β built for scalable, secure backend development.
https://github.com/sayammishra3/h_b_m_s_-project
agile-methodologies apache-kafka api-gateway aws-s3 data-transfer-object er-diagram event-driven-architecture exception-handling hibernate-jpa java java-8 jwt-authentication maven microservices mysql postman rest-api spring-boot spring-security validation
Last synced: 3 months ago
JSON representation
A Java 8 Spring Boot-based Hotel Booking System with microservices architecture, JWT authentication, AWS S3 integration, Apache Kafka, Hibernate, and MySQL β built for scalable, secure backend development.
- Host: GitHub
- URL: https://github.com/sayammishra3/h_b_m_s_-project
- Owner: SayamMishra3
- Created: 2025-07-06T11:23:10.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-07-06T13:18:18.000Z (3 months ago)
- Last Synced: 2025-07-06T13:44:45.579Z (3 months ago)
- Topics: agile-methodologies, apache-kafka, api-gateway, aws-s3, data-transfer-object, er-diagram, event-driven-architecture, exception-handling, hibernate-jpa, java, java-8, jwt-authentication, maven, microservices, mysql, postman, rest-api, spring-boot, spring-security, validation
- Language: JavaScript
- Homepage:
- Size: 60.9 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
β Summary for Project:-
π Project Title := Hotel Booking Management System:,
π Description:_
β© Hotel Booking Management System is a Java-based web application developed using Spring Boot and microservices architecture. It includes separate services for user authentication, room management, and bookings, with secure RESTful communication via an API Gateway. Features include JWT-based login, role-based access, AWS S3 image upload, and MySQL integration.---
π§ Tech Stack:
β Backend Language: Java 8
β Framework: Spring Boot 2.4.x (Microservices Architecture)
β Architecture: Microservices with RESTful APIs
β Security: Spring Security with JWT Token
β Service Discovery: Netflix Eureka
β Inter-Service Communication: OpenFeign Clients
β Persistence: Hibernate + Spring Data JPA
β Database: MySQL 8.x
β View Layer (if used): JSP + JSTL (tomcat-embed-jasper)
β File Storage: AWS S3 (for image uploads)
β API Support: @RestController-based endpoints
β Validation: Hibernate Validator (@Valid, Bean Validation - JSR 380)
β API Gateway: Spring Cloud Gateway
β Logging: SLF4J / Logback
β Build Tool: Maven
β IDE: STS
β Dev Tools: Spring Boot DevTools (for hot reload)---
π‘ Key Features:
β Microservices-based modular architecture.
β Role-Based Login (Admin, Receptionist) with JWT security.
β Room Booking (Create, Update, Delete, View).
β Customer Details Management with proper validations.
β Invoice Generation with auto bill calculation.
β Room Availability & Status Tracking.
β Add / View / Remove Hotel Staff (Employee Management).
β AWS S3 integration for image upload (e.g., hotel images, customer docs).
β REST APIs for frontend/mobile use (@RestController-based).
β JSP-based front-end UI using Bootstrap + JSTL (where applicable).
β Global Exception Handling using @ControllerAdvice.
β Validation on all forms using @Valid (Hibernate Validator).
β Logging & Error Tracking via SLF4J and Logback.
β Seamless service communication via OpenFeign clients.
β Service registration & discovery via Netflix Eureka.
β Centralized routing and security with Spring Cloud Gateway.---
## π Business Flow β Hotel Booking Management System:-
This section explains how the business process works from a user and hotel staff perspective.### π₯ Actors Involved:
- **Customer** β User who wants to book a hotel room.
- **Receptionist / Hotel Staff** β Handles room bookings and manages customer records.
- **Admin** β Manages rooms, staff, and has full control of the system.### π Business Flow Steps:-
1. **Customer Enquiry / Walk-in / Online Access**
- Customer checks available rooms either online or at the hotel counter.2. **Room Search & Selection**
- Staff or customer filters rooms based on room type, availability, and date range.3. **Customer Details Entry**
- Staff adds customer name, contact info, ID proof, check-in/check-out dates.4. **Room Booking**
- Booking entry is created in the system.
- Room status is marked as βBookedβ.
- Confirmation is generated (can be printed or viewed in UI).5. **Invoice Generation**
- After check-out, the system calculates billing details (duration, price per night, taxes).
- Invoice is generated and stored against customer record.6. **Room Status Update**
- After checkout, room is marked as βAvailableβ again.7. **Admin Operations**
- Add/edit/delete rooms.
- Manage hotel staff accounts.
- Monitor all bookings and customers.
- Download reports or check logs.### π Access Control (Role-Based):
| Role | Allowed Modules |
|--------------|-------------------------------------------|
| Admin | All modules (rooms, staff, booking, logs) |
| Receptionist | Bookings, Customer, Invoice |
| Customer | View availability (if public) |π‘ This flow ensures:-
- Efficient tracking of room usage
- No double-booking issues
- Full control via Admin panel
- Accurate billing & customer history---
## β βοΈ Technical Flow β Hotel Booking Management System:-
This section explains how the application works behind the scenes β from the moment a request hits the system to how data is processed and stored.
### π§ Request Lifecycle:-
Client (Browser / Postman) -> Spring MVC Controller (@Controller / @RestController) -> Service Layer (@Service) -> Data Access Layer (Repository / DAO) -> Database (MySQL)### π Component Breakdown:
#### 1οΈβ£ Controller Layer (`@RestController` or `@Controller`):-
- Handles incoming HTTP requests.
- Maps URLs to Java methods using `@GetMapping`, `@PostMapping`, etc.
- Calls service layer methods.
- Returns views (for JSP) or JSON response (for REST).``java
@GetMapping("/rooms")
public List getAllRooms() {
return roomService.getAllRooms();
}#### 2οΈβ£ Service Layer (@Service):-
Contains business logic.
Handles validations, calculations, and transformations.
Interacts with repository (DAO) to access DB.
Ensures separation of concerns.''java
public List getAllRooms() {
return roomRepository.findAll();
}#### 3οΈβ£ Repository Layer (@Repository):-
Interfaces extending Spring Data JPAβs JpaRepository.
Handles CRUD operations with zero SQL code.
Automatically translates method names into SQL queries.''java
public interface RoomRepository extends JpaRepository {
List findByStatus(String status);
}#### 4οΈβ£ Database Layer (MySQL):-
Stores all persistent data (rooms, bookings, customers, users, etc.).
Schema usually created using JPA annotations or schema.sql.#### π Data Flow Example: Room Booking:-
User submits booking form from frontend (/bookings)
Controller receives request and passes it to service layer
Service performs validations, updates room status, and saves booking
Repository saves data to MySQL
Response is returned to the user (confirmation page or API response)#### π§° Tools Involved:-
Layer Technology Used
Controller Spring MVC (@Controller, @RestController)
Service Spring Framework (@Service)
Repository Spring Data JPA (@Repository)
View (Web) JSP + JSTL
Persistence Hibernate + JPA
Database MySQLπ‘ This structure follows MVC + Service + DAO pattern, ensuring scalability, readability, and separation of concerns.
---
π Access Points:-
β Web App: `http://localhost:8080`
β REST API (Sample): `http://localhost:8080/bookings`---
π API Examples:
| Method | Endpoint | Description |
|--------|--------------------|---------------------------|
| GET | `/rooms` | Get all rooms |
| GET | `/bookings` | View all bookings |
| POST | `/bookings` | Create a new booking |
| DELETE | `/bookings/{id}` | Delete booking by ID |
| PUT | `/rooms/{id}` | Update room status |---
π Folder Structure Highlights:
Hotel_Management_System_Project/
βββ src/main/java/
β βββ controller/ # Handles web/API requests
β βββ model/ # Entity classes
β βββ repository/ # JPA repositories
β βββ service/ # Business logic
βββ src/main/webapp/
β βββ WEB-INF/jsp/ # JSP view templates
βββ src/main/resources/
β βββ application.properties
β βββ static/ # Static assets (if any)
βββ pom.xml # Maven project dependencies
βββ .project/.classpath # Eclipse config---
π§© Basic Swagger Configuration:-
@Configuration
@EnableOpenApi
public class SwaggerConfig {
@Bean
public Docket api() {
return new Docket(DocumentationType.OAS_30)
.select()
.apis(RequestHandlerSelectors.basePackage("com.example.hotel"))
.paths(PathSelectors.any())
.build();
}
}βοΈ Usage in Controller:-
@RestController
@RequestMapping("/bookings")
@Api(value = "Booking Controller", tags = "Bookings")
public class BookingController {
@ApiOperation(value = "Get all bookings", response = List.class)
@GetMapping
public List getAllBookings() {
return bookingService.getAllBookings();
}
}---
π Swagger UI Integration (API Testing):-
## π Swagger UI β API Documentation
This project supports API documentation using **Swagger**.
β Swagger UI helps test, document, and visualize all REST endpoints in the system.
### π Access URL:- http://localhost:8080/swagger-ui/### π§ Maven Dependency (Add in `pom.xml`) β©``xml
io.springfox
springfox-boot-starter
3.0.0---
𧬠ER Diagram (Entity Relationship):-
## 𧬠Entity Relationship Diagram:-
The following is a simplified ER Diagram for the Hotel Management System.```text
βββββββββββββββ ββββββββββββββββ ββββββββββββββ
β Customer βββββββΆβ Booking ββββββββΆβ Room β
βββββββββββββββ ββββββββββββββββ ββββββββββββββ
β β²
β β
βΌ β
ββββββββββββββ ββββββββββββββββ
β Invoice β β Staff β
ββββββββββββββ ββββββββββββββββ---
π Bonus:
π Suitable for showcasing Java Full-Stack Web Development
π Demonstrates real-world usage of Spring MVC + JSP + Hibernate
π Easy to deploy on any Apache Tomcat-compatible server---
β© Ensure that your local MySQL server is running and the hotel_db database exists before running the app.
β© Use a tool like Postman to test REST endpoints separately if required.---
π’βΌοΈ Some Important Notes:
β© After cloning or downloading the project, make sure to update your `application.properties` file with the correct MySQL credentials:
```properties
spring.datasource.url=jdbc:mysql://localhost:3306/hotel_db
spring.datasource.username=your_username
spring.datasource.password=your_password