StaySphere is a full-stack vacation rental marketplace web application (Airbnb alternative) engineered with Node.js, Express, MongoDB, EJS, and Bootstrap 5. It features full property listing CRUD, dynamic cloud image uploads with Cloudinary, interactive geolocation maps with Mapbox & Leaflet, an end-to-end booking & reservation engine, payment processing with Razorpay & Sandbox, star ratings, category filtering, and robust role-based authentication.
Deploy your own live instance of StaySphere in seconds:
- User Roles: Supports Guest, Host, and Admin permissions.
- Passport.js Integration: Secure salted-and-hashed authentication with persistent session cookies.
- Granular Authorization Middleware:
isLoggedIn: Guard for protected actions (booking, listing, writing reviews).isOwner: Restricts property edits and deletions to verified listing owners.isBookingOwner: Authorizes only the reserving guest, host, or admin to access booking invoices or perform cancellations.isReviewAuthor: Restricts review deletion to original author and listing host.
- User & Host Profile Dashboard (
/profile):- Manage user profile details, phone number, and avatar.
- View and manage hosted properties.
- Live Host Revenue Metrics (total bookings, net earnings).
- Interactive Booking Widget on Listing Show Page:
- Dynamic Check-In and Check-Out date selection with automated minimum-date validation.
- Guest quantity selector.
- Live Real-time Price Calculator: Computes night stay subtotal, cleaning fees, 18% GST government tax, and total payable amount on the fly.
- "My Trips & Bookings" Portal (
/bookings):- View all active, upcoming, and past reservations.
- Live status tracking (
Confirmed,Pending,Cancelled).
- Printable Reservation Ticket & Invoice (
/bookings/:id):- Printable boarding-pass style invoice with unique booking reference ID, stay schedule, host contact info, and itemized billing.
- Host Reservations Management (
/listings/:id/reservations):- Dedicated portal for hosts to view all incoming guest reservations and track gross payouts.
- Razorpay Integration: Official Razorpay checkout supporting Debit/Credit Cards, UPI, QR, and NetBanking.
- Instant Test Sandbox Mode: Seamless testing environment allowing full checkout simulation and verified order receipts without requiring live payment credentials.
- Cryptographic Signature Verification: Server-side HMAC SHA-256 signature verification ensuring fraud protection.
- Zero-Setup Leaflet / OpenStreetMap Fallback: Interactive map with custom branding pins works out of the box with zero external API key requirements.
- Mapbox GL JS Upgrade: Automatically upgrades to high-definition vector map tiles with fly-to zoom animations and popup cards when
MAP_TOKENis supplied.
- Full CRUD Management: Create, view, edit, and delete accommodation listings with rich descriptions, pricing, and amenities.
- Multi-Category Quick Filters: Real-time filtering by categories (Rooms, Iconic cities, Mountains, Castles, Amazing pools, Camping, Farms, Arctic, Domes, Boats).
- Multi-Field Search: Real-time search by Title, City, Country, Category, and Maximum Price.
- Price Tax Switcher: Instant toggle to preview night rates inclusive of 18% GST.
- Cloudinary Storage: Automated image optimization and cloud upload handling with Multer.
- Starability Star Ratings: User feedback system with interactive animated star ratings and review moderation.
ββββββββββββββββββββββββββ
β Client / Browser β
β (EJS, Bootstrap, JS) β
βββββββββββββ¬βββββββββββββ
β HTTP / REST
βββββββββββββΌβββββββββββββ
β Express.js & Node.js β
β (MVC Controller Core) β
ββββ¬βββββββ¬βββββββββ¬ββββ¬ββ
βββββββββββββββββββββββββ β β βββββββββββββββββββββββββ
βββββββββββΌβββββββββ βββββββββΌβββββ βββΌββββββββββββββββ βββββββββββΌβββββββββ
β Passport.js & β β MongoDB β β Cloudinary β β Mapbox GL & β
β Session Store β β Atlas β β (Media Upload) β β Leaflet β
ββββββββββββββββββββ ββββββββββββββ βββββββββββββββββββ ββββββββββββββββββββ
- Backend: Node.js, Express.js
- Database: MongoDB, Mongoose ODM
- Templating & UI: EJS, EJS-Mate, Bootstrap 5, FontAwesome 6
- Authentication: Passport.js, Passport-Local, Passport-Local-Mongoose
- Payments: Razorpay Node SDK, Client Checkout Modal, Test Sandbox
- Cloud Storage: Cloudinary, Multer, Multer-Storage-Cloudinary
- Maps & Geolocation: Leaflet, OpenStreetMap, Mapbox GL JS, Mapbox Geocoding SDK
- Session & Flash: Express-Session, Connect-Mongo, Connect-Flash
- Validation: Joi Object Schema Validation
StaySphere/
βββ controllers/ # MVC Controllers
β βββ bookings.js # Booking reservations & payment handlers
β βββ listings.js # Listing CRUD, search & filtering
β βββ reviews.js # Review creation & deletion
β βββ users.js # Authentication & user profile dashboard
βββ models/ # Mongoose Schemas
β βββ booking.js # Booking model with billing & payment status
β βββ listing.js # Listing model with GeoJSON & cascade delete
β βββ review.js # Review model with author relation
β βββ user.js # User model with roles (guest, host, admin)
βββ routes/ # Express Routes
β βββ booking.js # /bookings endpoints
β βββ listing.js # /listings endpoints
β βββ review.js # /listings/:id/reviews endpoints
β βββ static.js # Static /terms and /privacy routes
β βββ user.js # /login, /signup, /profile routes
βββ views/ # EJS UI Templates
β βββ bookings/ # My Bookings, Checkout, Invoice Receipt views
β βββ includes/ # Navbar, Footer, Flash notification alerts
β βββ layouts/ # Boilerplate HTML layout
β βββ listings/ # Index, Show, New, Edit, Reservations views
β βββ users/ # Login, Signup, Profile views
βββ public/ # Static Client Assets
β βββ css/ # style.css, rating.css, loader.css, staysphere.css
β βββ js/ # map.js, script.js
β βββ icon/ # Screenshots, logos, favicon
βββ init/ # Seed data sets
βββ cloudConfig.js # Cloudinary & Multer configuration
βββ middleware.js # Authorization & validation middlewares
βββ schema.js # Joi input validation schemas
βββ seed.js # Database seeding utility
βββ app.js # Main Express Application entry point
βββ render.yaml # Render Blueprint configuration
βββ vercel.json # Vercel serverless configuration
βββ .env.example # Environment variables template
βββ README.md # Project documentation
git clone https://github.com/PREM-A261/StaySphere.git
cd StaySphere
npm installCreate a .env file in the root directory:
# MongoDB Connection URL (Local or Atlas)
ATLASDB_URL=mongodb://127.0.0.1:27017/staysphere
# Express Session Secret
SECRET=your_super_secret_session_key_2026
# Cloudinary Credentials (Optional for local test)
CLOUD_NAME=your_cloudinary_cloud_name
CLOUD_API_KEY=your_cloudinary_api_key
CLOUD_API_SECRET=your_cloudinary_api_secret
# Mapbox Token (Optional: Leaflet will work automatically if omitted)
MAP_TOKEN=your_mapbox_public_token
# Razorpay (Optional: Sandbox test checkout works automatically if omitted)
RAZORPAY_KEY_ID=your_razorpay_key_id
RAZORPAY_KEY_SECRET=your_razorpay_key_secret
# Server Port (default 8080)
PORT=8080Run the seeding script to initialize sample hosts, guests, listings, and reservations:
npm run seedDefault Seed Demo Accounts:
Role Username Password Host Admin staysphere_adminAdmin@12345Demo Guest demo_guestGuest@12345
npm startVisit http://localhost:8080 in your browser.
- Click the Deploy to Render button:
- Connect your GitHub account and select this repository.
- Configure the following environment variables:
ATLASDB_URL: Your MongoDB Atlas connection URI (mongodb+srv://...)SECRET: Random session secret stringCLOUD_NAME,CLOUD_API_KEY,CLOUD_API_SECRET: (Optional) Cloudinary credentialsMAP_TOKEN: (Optional) Mapbox public access tokenRAZORPAY_KEY_ID,RAZORPAY_KEY_SECRET: (Optional) Razorpay credentials
- Click Create Web Service. Render will automatically build and deploy the app.
- Import
PREM-A261/StaySphereon Vercel. - Under Project Settings > Environment Variables, add
ATLASDB_URL,SECRET, and cloud credentials. - Deploy via vercel.json.
This project is licensed under the ISC License.
Prem Pawar
- GitHub: @PREM-A261
- Project Repository: StaySphere