Skip to content

eldhoaby/HBApp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

71 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

🏨 HOMYSTAY

Modern Full-Stack Hotel Booking Platform

Live Demo Backend API

React Node.js MongoDB Vite Tailwind CSS Razorpay License: MIT CI

A production-grade, full-stack MERN hotel reservation platform with role-based access control, real-time availability tracking, and integrated payment processing.

Live Demo Β· API Documentation Β· Report Bug Β· Request Feature


πŸ“Έ Application Preview

🏠 Landing Page

HOMYSTAY Homepage

πŸ›οΈ Room Listing & Filters

Room Listing

πŸ” Room Details & Booking

Room Details

πŸ” Authentication

Login Modal

✨ Key Features

🏨 For Guests

  • πŸ” Smart Search β€” Filter by city, dates, room type, price range
  • πŸ“… Real-Time Availability β€” Conflict-free date-based booking
  • πŸ’³ Secure Payments β€” Razorpay integration with order verification
  • πŸ“„ PDF Invoices β€” Auto-generated booking confirmations
  • πŸ“± Responsive UI β€” Seamless experience on all devices

🏒 For Hotel Owners & Admins

  • πŸ“Š Analytics Dashboard β€” Revenue, occupancy, and booking metrics
  • πŸ›οΈ Room Management β€” Full CRUD with multi-image uploads
  • πŸ‘₯ User Management β€” View registered users and booking history
  • βœ… Booking Control β€” Approve, cancel, and manage reservations
  • πŸ”’ Role-Based Access β€” Secure admin and owner workflows

πŸ›‘οΈ Role-Based Access Control

graph LR
    A[πŸ‘€ Guest] -->|Browse & Book| B[🏨 Rooms]
    C[🏒 Hotel Owner] -->|Manage| B
    C -->|View| D[πŸ“Š Dashboard]
    E[πŸ‘‘ Admin] -->|Full Control| B
    E -->|Manage| F[πŸ‘₯ Users]
    E -->|Analytics| D
    
    style A fill:#4CAF50,color:#fff
    style C fill:#FF9800,color:#fff
    style E fill:#F44336,color:#fff
Loading
Role Capabilities
Guest Browse rooms, search & filter, check availability, book rooms, make payments, view booking history, download invoices
Hotel Owner All guest features + add/edit/delete rooms, upload room images, view booking analytics, manage own listings
Administrator Full platform control + user management, global analytics, booking management (approve/cancel/delete), system metrics

πŸ—οΈ System Architecture

Application Architecture

graph TB
    subgraph Client["🌐 Frontend (Vercel)"]
        React["βš›οΈ React 19 + Vite"]
        TW["🎨 Tailwind CSS + MUI"]
        Router["πŸ”€ React Router v7"]
    end
    
    subgraph Server["βš™οΈ Backend (Render)"]
        Express["πŸš€ Express.js v5"]
        Auth["πŸ” JWT Auth"]
        Multer["πŸ“ Multer (Uploads)"]
    end
    
    subgraph Database["πŸ’Ύ Database (MongoDB Atlas)"]
        Users["πŸ‘₯ Users"]
        Rooms["🏨 Rooms"]
        Bookings["πŸ“‹ Bookings"]
    end
    
    subgraph Payment["πŸ’³ Payment Gateway"]
        Razorpay["Razorpay API"]
    end
    
    React --> Express
    Express --> Auth
    Express --> Database
    Express --> Razorpay
    
    style Client fill:#1a1a2e,color:#fff
    style Server fill:#16213e,color:#fff
    style Database fill:#0f3460,color:#fff
    style Payment fill:#533483,color:#fff
Loading

Deployment Architecture

graph LR
    User((πŸ§‘β€πŸ’» User)) <-->|HTTPS| Vercel["β–² Vercel<br/>React Frontend"]
    Vercel <-->|REST API| Render["πŸ”§ Render<br/>Express Backend"]
    Render <-->|Mongoose| Atlas["πŸƒ MongoDB Atlas<br/>Cloud Database"]
    Render <-->|Payment API| Razorpay["πŸ’³ Razorpay<br/>Payment Gateway"]
    
    style Vercel fill:#000,color:#fff
    style Render fill:#46E3B7,color:#000
    style Atlas fill:#00ED64,color:#000
    style Razorpay fill:#3395FF,color:#fff
Loading

πŸ’» Tech Stack

Layer Technology Version Purpose
FrontendReact19.1UI Components & SPA
Vite6.3Build Tool & Dev Server
Tailwind CSS4.1Utility-First Styling
Material UI7.1Admin Dashboard Components
React Router7.6Client-Side Routing
Axios1.10HTTP Client
BackendNode.js18+Runtime Environment
Express.js5.1REST API Framework
Mongoose8.16MongoDB ODM
Multer2.0File Upload Handling
DatabaseMongoDB Atlasβ€”Cloud NoSQL Database
PaymentsRazorpay2.9Payment Processing
DevOpsVercelβ€”Frontend Hosting & CDN
Renderβ€”Backend Hosting
GitHub Actionsβ€”CI/CD Pipeline

βš™οΈ Getting Started

Prerequisites

  • Node.js v18 or higher
  • MongoDB (local instance or Atlas cluster)
  • Git
  • Razorpay test/live API keys

Installation

# Clone the repository
git clone https://github.com/eldhoaby/HBApp.git
cd HBApp

Backend Setup:

cd backend
npm install

# Create environment file
cp ../.env.example .env
# Edit .env with your credentials (see Environment Variables section)

npm start        # Production
npm run test     # Development with nodemon

Frontend Setup:

cd frontend
npm install

# Create environment file
echo "VITE_API_BASE_URL=http://localhost:3000" > .env
echo "VITE_RAZORPAY_KEY_ID=your_razorpay_key" >> .env

npm run dev      # Development
npm run build    # Production build

Environment Variables

πŸ“‹ Backend Variables (click to expand)
Variable Description Example
PORT Server port 3000
MONGODB_URI MongoDB connection string mongodb+srv://user:pass@cluster.mongodb.net
ADMIN_EMAIL Admin login email admin@example.com
ADMIN_PASSWORD Admin login password securepassword
RAZORPAY_KEY_ID Razorpay API Key rzp_test_xxxxx
RAZORPAY_KEY_SECRET Razorpay Secret your_secret
FRONTEND_URL Allowed CORS origin http://localhost:5173
πŸ“‹ Frontend Variables (click to expand)
Variable Description Example
VITE_API_BASE_URL Backend API URL http://localhost:3000
VITE_RAZORPAY_KEY_ID Razorpay public key rzp_test_xxxxx

πŸ“‚ Project Structure

HBApp/
β”œβ”€β”€ πŸ“ frontend/                # React + Vite Application
β”‚   β”œβ”€β”€ πŸ“ public/              # Static assets & favicon
β”‚   β”œβ”€β”€ πŸ“ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“ assets/          # Images, icons, SVGs
β”‚   β”‚   β”œβ”€β”€ πŸ“ components/      # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ πŸ“ hotelOwner/  # Admin dashboard components
β”‚   β”‚   β”‚   β”œβ”€β”€ Hero.jsx        # Landing page hero
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx      # Navigation bar
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.jsx       # Auth modal
β”‚   β”‚   β”‚   └── Register.jsx    # Registration modal
β”‚   β”‚   β”œβ”€β”€ πŸ“ pages/           # Route-level pages
β”‚   β”‚   β”‚   β”œβ”€β”€ Home.jsx        # Landing page
β”‚   β”‚   β”‚   β”œβ”€β”€ AllRooms.jsx    # Room listing + filters
β”‚   β”‚   β”‚   β”œβ”€β”€ RoomDetails.jsx # Room detail + booking
β”‚   β”‚   β”‚   β”œβ”€β”€ Payment.jsx     # Payment processing
β”‚   β”‚   β”‚   └── MyBookings.jsx  # User booking history
β”‚   β”‚   β”œβ”€β”€ App.jsx             # Root layout & routing
β”‚   β”‚   └── main.jsx            # React DOM entry
β”‚   β”œβ”€β”€ vercel.json             # Vercel SPA rewrites
β”‚   └── package.json
β”œβ”€β”€ πŸ“ backend/                 # Express.js API Server
β”‚   β”œβ”€β”€ πŸ“ configs/             # Database configuration
β”‚   β”œβ”€β”€ πŸ“ models/              # Mongoose schemas
β”‚   β”‚   β”œβ”€β”€ user.js             # User model
β”‚   β”‚   β”œβ”€β”€ room.js             # Room model
β”‚   β”‚   └── booking.js          # Booking model
β”‚   β”œβ”€β”€ πŸ“ routes/              # API route handlers
β”‚   β”‚   β”œβ”€β”€ auth.js             # Authentication routes
β”‚   β”‚   β”œβ”€β”€ rooms.js            # Room CRUD routes
β”‚   β”‚   β”œβ”€β”€ bookings.js         # Booking routes
β”‚   β”‚   β”œβ”€β”€ admin.js            # Admin routes
β”‚   β”‚   β”œβ”€β”€ payment.js          # Stripe payment routes
β”‚   β”‚   └── razorpay.js         # Razorpay payment routes
β”‚   β”œβ”€β”€ server.js               # Express entry point
β”‚   └── package.json
β”œβ”€β”€ πŸ“ docs/                    # Technical documentation
β”œβ”€β”€ πŸ“ screenshots/             # Application screenshots
β”œβ”€β”€ πŸ“ .github/                 # CI/CD & GitHub templates
β”‚   β”œβ”€β”€ πŸ“ workflows/
β”‚   β”‚   └── ci.yml              # GitHub Actions pipeline
β”‚   β”œβ”€β”€ ISSUE_TEMPLATE.md
β”‚   └── PULL_REQUEST_TEMPLATE.md
β”œβ”€β”€ .env.example                # Environment template
β”œβ”€β”€ .gitignore                  # Git exclusion rules
β”œβ”€β”€ CHANGELOG.md                # Version history
β”œβ”€β”€ CODE_OF_CONDUCT.md          # Community guidelines
β”œβ”€β”€ CONTRIBUTING.md             # Contribution guide
β”œβ”€β”€ LICENSE                     # MIT License
β”œβ”€β”€ README.md                   # ← You are here
β”œβ”€β”€ SECURITY.md                 # Security policy
└── render.yaml                 # Render deployment blueprint

πŸ“‘ API Reference

Method Endpoint Description Auth
POST /users/register Register a new user Public
POST /users/login Authenticate user Public
GET /rooms Fetch all rooms Public
GET /rooms/:id Fetch room by ID Public
POST /rooms Create a room Owner
PUT /rooms/:id Update a room Owner
DELETE /rooms/:id Delete a room Owner
POST /rooms/check-availability Check room availability Public
POST /bookings Create a booking User
GET /bookings/user/:id Get user bookings User
PUT /bookings/:id Update booking status Admin
DELETE /bookings/:id Delete a booking Admin
POST /admin/login Admin authentication Admin
GET /admin/metrics Platform analytics Admin
POST /razorpay/create-order Create payment order User

πŸ“– Full API documentation: docs/api.md


πŸš€ Deployment

The application is deployed on a modern cloud infrastructure:

Component Platform URL
Frontend Vercel hb-app-eldho.vercel.app
Backend Render homystay-backend.onrender.com
Database MongoDB Atlas Private cluster

πŸ“– Full deployment guide: docs/deployment_setup.md


πŸ—ΊοΈ Roadmap

  • πŸ”‘ OAuth2 (Google / GitHub) authentication
  • πŸ’¬ Real-time chat (Socket.io) between guests & owners
  • πŸ—ΊοΈ Mapbox integration for geographical hotel search
  • 🌍 Multi-language (i18n) support
  • ⚑ Redis caching for faster queries
  • πŸ“§ Email notifications (booking confirmations, reminders)
  • ⭐ Guest review & rating system
  • πŸ“± Progressive Web App (PWA) support

🀝 Contributing

Contributions make the open-source community thrive! See our Contributing Guidelines for details.

# Fork β†’ Clone β†’ Branch β†’ Code β†’ Push β†’ PR
git checkout -b feature/amazing-feature
git commit -m "feat: add amazing feature"
git push origin feature/amazing-feature

πŸ“„ License

Distributed under the MIT License. See LICENSE for details.


πŸ™ Acknowledgments


⭐ Star this repository if you found it helpful!

Made with ❀️ by Eldho

About

HomyStay is a modern full-stack hotel and homestay booking platform built using the MERN stack. The application supports secure authentication, role-based access for Admins and Hotel Owners, room listing management, booking functionality, and responsive user experience across devices.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages