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.
- 🔐 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
- Backend: Node.js, Express.js
- Database: MongoDB, Mongoose
- Authentication: JSON Web Token (JWT)
- Security: Bcrypt (Password Hashing)
- Other Tools: CORS, Dotenv
├── 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
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/express-book-store-api.git
cd express-book-store-api- Install dependencies:
npm install- Create a
.envfile:
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
- Run the server:
npm run devServer will run on:
http://localhost:5000
POST /api/auth/register→ Register userPOST /api/auth/login→ Login user
GET /api/profile→ Get profilePOST /api/profile→ Create profilePUT /api/profile→ Update profileDELETE /api/profile→ Delete profile
GET /api/listings→ Get all listingsGET /api/listings/:id→ Get single listingPOST /api/listings→ Create listing (Host only)PUT /api/listings/:id→ Update listingDELETE /api/listings/:id→ Delete listing
POST /api/bookings→ Create bookingGET /api/bookings/my-bookings→ Get user bookingsGET /api/bookings/:id→ Get booking by IDPUT /api/bookings/:id→ Update bookingDELETE /api/bookings/:id→ Delete booking
You can test APIs using:
- Postman
- Thunder Client
- 🗄️ Add Payment Integration
- 🌐 Deploy on Render / Vercel
- 📸 Image Upload (Cloudinary)
- ⭐ Reviews & Ratings System
Shashwat Pandey
If you like this project, give it a ⭐ on GitHub!