Skip to content

BuddhadebKoner/book-your-hotel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Hotel Booking SaaS Platform

A full-stack hotel booking SaaS application built with MERN stack and integrated with LiteAPI.

πŸ—οΈ Project Structure

book-your-hotel/
β”œβ”€β”€ backend/               # Express.js backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/       # Database and other configurations
β”‚   β”‚   β”œβ”€β”€ controllers/  # Route controllers
β”‚   β”‚   β”œβ”€β”€ models/       # Mongoose models
β”‚   β”‚   β”œβ”€β”€ routes/       # API routes
β”‚   β”‚   β”œβ”€β”€ middleware/   # Custom middleware
β”‚   β”‚   β”œβ”€β”€ services/     # Business logic & external APIs
β”‚   β”‚   └── utils/        # Utility functions
β”‚   β”œβ”€β”€ .env              # Environment variables
β”‚   β”œβ”€β”€ .env.example      # Environment variables template
β”‚   β”œβ”€β”€ package.json
β”‚   └── server.js         # Entry point
β”‚
β”œβ”€β”€ frontned/             # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/   # React components
β”‚   β”‚   β”‚   └── ui/       # Shadcn UI components
β”‚   β”‚   β”œβ”€β”€ pages/        # Page components
β”‚   β”‚   β”œβ”€β”€ hooks/        # Custom React hooks
β”‚   β”‚   β”œβ”€β”€ services/     # API services
β”‚   β”‚   β”œβ”€β”€ utils/        # Utility functions
β”‚   β”‚   β”œβ”€β”€ lib/          # Libraries (utils for Shadcn)
β”‚   β”‚   β”œβ”€β”€ App.jsx       # Main App component
β”‚   β”‚   β”œβ”€β”€ main.jsx      # Entry point
β”‚   β”‚   └── index.css     # Global styles (Tailwind)
β”‚   β”œβ”€β”€ .env              # Environment variables
β”‚   β”œβ”€β”€ .env.example      # Environment variables template
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ vite.config.js    # Vite configuration
β”‚   β”œβ”€β”€ tailwind.config.js # Tailwind CSS configuration
β”‚   └── components.json   # Shadcn UI configuration
β”‚
└── postman/              # Postman collection for API testing

πŸš€ Tech Stack

Backend

  • Node.js & Express.js - Server framework
  • MongoDB & Mongoose - Database
  • Axios - HTTP client for LiteAPI
  • Helmet - Security headers
  • CORS - Cross-origin resource sharing
  • Express Rate Limit - Rate limiting
  • Morgan - HTTP request logger

Frontend

  • React 19 - UI library
  • Vite - Build tool
  • Tailwind CSS - Styling
  • Shadcn UI - UI components
  • React Router - Routing
  • Axios - HTTP client

πŸ“‹ Prerequisites

  • Node.js (v18 or higher)
  • MongoDB (local or Atlas)
  • LiteAPI Key (Get one here)

πŸ› οΈ Installation

1. Clone the repository

git clone <your-repo-url>
cd book-your-hotel

2. Backend Setup

cd backend
npm install

# Create .env file (copy from .env.example)
cp .env.example .env

# Edit .env and add your configurations:
# - MONGODB_URI
# - LITEAPI_KEY
# - etc.

3. Frontend Setup

cd frontned
npm install

# Create .env file (copy from .env.example)
cp .env.example .env

# Edit .env and add your configurations:
# - VITE_API_URL
# - VITE_LITEAPI_KEY (if needed)

πŸƒβ€β™‚οΈ Running the Application

Development Mode

Terminal 1 - Backend:

cd backend
npm run dev

Server runs on: http://localhost:3000

Terminal 2 - Frontend:

cd frontned
npm run dev

Frontend runs on: http://localhost:5173

Production Mode

Backend:

cd backend
npm start

Frontend:

cd frontned
npm run build
npm run preview

πŸ”Œ API Endpoints (To be implemented)

Hotels

  • GET /api/hotels/search - Search hotels
  • GET /api/hotels/:id - Get hotel details
  • POST /api/hotels/availability - Check availability

Bookings

  • POST /api/bookings - Create booking
  • GET /api/bookings - Get user bookings
  • GET /api/bookings/:id - Get booking details
  • DELETE /api/bookings/:id - Cancel booking

🎨 Adding Shadcn UI Components

To add Shadcn UI components to your project:

cd frontned

# Example: Add button component
npx shadcn@latest add button

# Add card component
npx shadcn@latest add card

# Add input component
npx shadcn@latest add input

Components will be added to src/components/ui/

πŸ“ Environment Variables

Backend (.env)

NODE_ENV=development
PORT=3000
MONGODB_URI=mongodb://localhost:27017/hotel-booking-saas
FRONTEND_URL=http://localhost:5173
LITEAPI_KEY=your_liteapi_key_here
LITEAPI_BASE_URL=https://api.liteapi.travel/v3.0

Frontend (.env)

VITE_API_URL=http://localhost:3000/api
VITE_LITEAPI_KEY=your_liteapi_key_here

πŸ§ͺ Testing

Backend Health Check

curl http://localhost:3000/health

πŸ“š LiteAPI Documentation

🀝 Contributing

  1. Create a feature branch
  2. Commit your changes
  3. Push to the branch
  4. Create a Pull Request

πŸ“„ License

ISC

πŸ‘¨β€πŸ’» Author

Your Name


Note: This is a starter template with folder structure in place. Controllers, routes, models, and components need to be implemented based on your requirements.

About

A hotel booking system by liteapi.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors