Skip to content

SiddhiPandey08/Sojourn

Repository files navigation

Sojourn

Sojourn is a full-stack Airbnb-inspired listings platform built exclusively for Indian destinations. Users can explore, list, and review stays across categories with interactive maps, image uploads, and secure authentication.

🔗 Live Demo: sojourn-5dd8.onrender.com


Features

  • Browse & Filter — Explore listings across 8 curated categories (Mountains, Beaches, Farms, Castles, Caves, Arctic, Camping, Heritage) with a category chip filter system using GET query parameters
  • Interactive Maps — Each listing is geocoded on creation and displayed with a MapTiler-powered map marker on the listing detail page
  • User Authentication — Secure signup, login, and logout via Passport.js with session persistence using connect-mongo
  • Image Uploads — Hosts can upload listing photos, stored and served via Cloudinary CDN
  • Reviews — Authenticated users can post and delete reviews on listings
  • Authorization — Listing and review operations are protected; only owners can edit or delete their content
  • Flash Notifications — Real-time success and error feedback across all user actions
  • Responsive UI — Clean, mobile-friendly interface built with Bootstrap 5

Tech Stack

Backend

Technology Role
Node.js Runtime environment
Express.js Web framework and routing
MongoDB NoSQL database
Mongoose ODM for schema modeling and validation
Passport.js Authentication middleware (local strategy)
passport-local-mongoose Simplifies Passport + Mongoose user model integration
express-session Session management
connect-mongo Persists sessions to MongoDB Atlas (survives server restarts)
method-override Enables PUT/DELETE from HTML forms
connect-flash Flash messages for user feedback

Frontend

Technology Role
EJS Server-side templating engine
EJS-Mate Layout and partial support for EJS
Bootstrap 5 Responsive UI components and grid
Custom CSS Brand palette, category chips, polaroid-style hero section

Cloud & Storage

Technology Role
Cloudinary Cloud image storage and delivery CDN
Multer Multipart form handling for file uploads
multer-storage-cloudinary Streams uploads directly from Multer to Cloudinary
MongoDB Atlas Managed cloud database (with SRV DNS connection)

Maps & Geocoding

Technology Role
MapTiler Geocoding API Converts listing addresses to GeoJSON coordinates on creation
MapTiler Maps SDK Renders interactive map with listing markers on the detail page
GeoJSON Geometry stored directly in the Mongoose listing schema

Validation & Error Handling

Technology Role
Joi Server-side schema validation for listings and reviews
wrapAsync Custom utility to propagate async errors to Express error handler
Custom ExpressError Centralized error class with status codes and messages

Developer Tools

Technology Role
dotenv Environment variable management
Prettier Code formatting

Deployment

Technology Role
Render Cloud platform for hosting the Node.js server
MongoDB Atlas Production database
Cloudinary Production image storage

Project Structure

sojourn/
├── controllers/        # Route handler logic (listings, reviews, users)
├── models/             # Mongoose schemas (Listing, Review, User)
├── routes/             # Express routers (listings, reviews, auth)
├── views/              # EJS templates and layouts
│   ├── layouts/        # EJS-Mate base layout
│   ├── listings/       # Index, show, new, edit views
│   └── users/          # Login and signup views
├── public/             # Static assets (CSS, JS, images)
├── init/               # Database seeding scripts
├── utilities/          # wrapAsync, ExpressError
├── middleware.js       # Auth and ownership guards
├── schema.js           # Joi validation schemas
├── cloudConfig.js      # Cloudinary configuration
└── app.js              # Express app entry point

Architecture Highlights

  • MVC Pattern — Clear separation of models, views, and controllers
  • Session Persistence — connect-mongo ensures sessions survive server cold starts on Render's free tier
  • Geocoding on Write — Listing coordinates are resolved at creation time via MapTiler and stored as GeoJSON in MongoDB, keeping map rendering fast
  • Owner-only Authorization — Middleware guards check req.user._id against listing/review ownership before allowing edits or deletes
  • Centralized Error Handling — All async route handlers are wrapped with wrapAsync; errors flow to a single Express error-handling middleware

Demo Credentials

Role Username Password
Host TestHost test1234
Guest TestGuest test1234

Seeded Data

The database includes 12 sample listings across 8 categories, covering Indian destinations from Leh-Ladakh to Kerala backwaters, with test accounts for both host and guest roles.


Built by Siddhi Pandey

About

Project 1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors