Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏡 Stay Booking Backend API

A full-featured RESTful backend for a stay booking platform built using Node.js, Express.js, and MongoDB. This API supports user authentication, profile management, property listings, and booking functionality with a modular and scalable architecture.


🚀 Features

  • 🔐 JWT-based Authentication (Register/Login)
  • 👤 User Profile Management
  • 🏠 Property Listings (Create, Update, Delete)
  • 📅 Booking System
  • 🛡️ Protected Routes using Middleware
  • 🔎 Search & Filter Listings
  • 🧩 Modular Backend Architecture

🛠 Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB, Mongoose
  • Authentication: JSON Web Token (JWT)
  • Security: Bcrypt (Password Hashing)
  • Other Tools: CORS, Dotenv

📂 Project Structure

├── server.js
├── package.json
├── .gitignore
│
├── routes/
│   ├── auth.js
│   ├── bookings.js
│   ├── listing.js
│   ├── profile.js
│
├── models/
│   ├── User.js
│   ├── Booking.js
│   ├── Listing.js
│   ├── profile.js
│
├── middleware/
│   └── auth.js
│
└── vercel.json

⚙️ Installation & Setup

  1. Clone the repository:
git clone https://github.com/YOUR_USERNAME/express-book-store-api.git
cd express-book-store-api
  1. Install dependencies:
npm install
  1. Create a .env file:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
  1. Run the server:
npm run dev

Server will run on:

http://localhost:5000

📡 API Endpoints

🔐 Authentication

  • POST /api/auth/register → Register user
  • POST /api/auth/login → Login user

👤 Profile

  • GET /api/profile → Get profile
  • POST /api/profile → Create profile
  • PUT /api/profile → Update profile
  • DELETE /api/profile → Delete profile

🏠 Listings

  • GET /api/listings → Get all listings
  • GET /api/listings/:id → Get single listing
  • POST /api/listings → Create listing (Host only)
  • PUT /api/listings/:id → Update listing
  • DELETE /api/listings/:id → Delete listing

📅 Bookings

  • POST /api/bookings → Create booking
  • GET /api/bookings/my-bookings → Get user bookings
  • GET /api/bookings/:id → Get booking by ID
  • PUT /api/bookings/:id → Update booking
  • DELETE /api/bookings/:id → Delete booking

🧪 Testing

You can test APIs using:

  • Postman
  • Thunder Client

🚀 Future Improvements

  • 🗄️ Add Payment Integration
  • 🌐 Deploy on Render / Vercel
  • 📸 Image Upload (Cloudinary)
  • ⭐ Reviews & Ratings System

👨‍💻 Author

Shashwat Pandey


⭐ Support

If you like this project, give it a ⭐ on GitHub!

About

A full-featured RESTful backend for a stay booking platform, built with Node.js, Express.js, and MongoDB. Implements authentication (JWT), user profiles, listings, and booking management with secure and modular architecture.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages