Skip to content

Repository files navigation

🏨 Hotel Booking System

NestJS + PostgreSQL + Redis + RabbitMQ

A scalable and production-ready Hotel Booking System built with modern backend technologies, focusing on clean architecture, concurrency safety, and event-driven design.

🚀 Project Overview

This project is a backend system for managing hotel room reservations.

It supports secure authentication, room availability search, booking with concurrency control, caching, and asynchronous event processing.

The goal of this project is to simulate a real-world booking system similar to those used by hotels and travel platforms.

🧱 Tech Stack

Framework: NestJS

Database: PostgreSQL + TypeORM

Cache & Locking: Redis

Message Broker: RabbitMQ

Authentication: JWT (Role-based)

Architecture: Modular & Clean Architecture

✨ Core Features

User Authentication (JWT)

Role-based Authorization (Guest / Admin)

Hotel & Room Management

Room Availability Search

Safe Booking (No Double Booking)

Distributed Locking with Redis

Event-driven communication with RabbitMQ

Scalable & production-oriented design

👥 Roles

Guest

Register / Login

Search available rooms

Book a room

Cancel booking

View own bookings

Admin

Create & manage hotels

Create & manage rooms

View all bookings

🧠 Domain Model (High Level)

User

Hotel

Room

Booking

🗺️ Project Roadmap

This project is developed step by step, each phase building on the previous one.

✅ Phase 1 – Project Setup & Authentication

[x] NestJS project setup

[x] PostgreSQL integration with TypeORM

[x] User entity

[x] Register & Login

[x] Password hashing (bcrypt)

[x] JWT authentication

[x] Role-based authorization (Guest / Admin)

[x] Register & Login

[x] Password hashing (bcrypt)

[x] JWT authentication

[x] Role-based authorization (Guest / Admin)

⏳ Phase 2 – Hotel & Room Management

[x] Hotel CRUD (Admin only)

[x] Room CRUD (Admin only)

[x] Room types & pricing

[x] Validation & access control

⏳ Phase 3 – Booking System

[x] Search available rooms by date

[x] Booking creation

[x] Prevent overlapping bookings

[x] Database transactions

[x] Booking cancellation

⏳ Phase 4 – Redis Integration

[x] Distributed locking for bookings

[x] Cache room availability

[x] Cache frequently accessed data

⏳ Phase 5 – RabbitMQ (Event-Driven)

[x] BookingCreated event

[x] BookingCancelled event

[x] Async consumers (email, logs, analytics)

⏳ Phase 6 – Optimization & Production Readiness

[x] Environment configuration

[x] Security hardening

[x] Performance optimizations

[x] API documentation (Swagger)

[x] Basic testing

📂 Project Structure

Copy code

Text

src/

├── auth/

├── users/

├── hotels/

├── rooms/

├── bookings/

├── common/

│   ├── decorators/

│   ├── guards/

│   ├── enums/

│   └── constants/

├── config/

│   ├── database.config.ts

│   └── jwt.config.ts

├── app.module.ts

└── main.ts

⚠️ Important Notes

This project is designed as a learning + portfolio project

Focus is on real-world backend problems like:

Concurrency

Data consistency

Scalability

synchronize: true is enabled only for development

📌 Future Improvements

Refresh tokens

Payment integration

Multi-hotel search

Microservices split

CI/CD pipeline

📄 License

<<<<<<< HEAD MIT License

MIT License

caaff3f9623cd8b56064b64169811fbc8586bd2a

About

A scalable and production-ready Hotel Booking System built with modern backend technologies, focusing on clean architecture, concurrency safety, and event-driven design

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages