Skip to content

siddharthchauhan3128/AtlasRoute

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AtlasRoute 🏠✈️

A full-stack vacation rental marketplace web application built with the MERN stack (MongoDB, Express, React-like EJS templating, Node.js). AtlasRoute allows users to browse, create, and review property listings - similar to Airbnb.

AtlasRoute Node.js Express MongoDB

πŸ“‹ Table of Contents

✨ Features

Core Features

  • User Authentication: Secure signup, login, and logout using Passport.js
  • Listing Management: Create, read, update, and delete property listings
  • Review System: Users can add ratings and comments to listings
  • Image Upload: Cloudinary integration for storing listing images
  • Interactive Maps: MapPLS integration for displaying locations
  • Category Filtering: Browse listings by categories (Trending, Rooms, Mountains, Castles, Amazing Pools, Camping, Farms, Arctic)
  • Price Display: Toggle to show/hide taxes (GST)
  • Flash Notifications: User-friendly flash messages for actions
  • Session Management: Persistent sessions with MongoDB store

Additional Features

  • Server-side validation using Joi
  • Responsive design with Tailwind CSS
  • Protected routes for authenticated users
  • Auto-delete reviews when a listing is deleted

πŸ›  Tech Stack

Backend

  • Runtime: Node.js v25.2.1
  • Framework: Express.js v5.2.1
  • Database: MongoDB with Mongoose ODM v9.0.2
  • Template Engine: EJS v3.1.10
  • Authentication: Passport.js v0.7.0 with passport-local-mongoose

Frontend

  • Styling: Tailwind CSS v4.1.18
  • UI Components: Bootstrap (via CDN)
  • Icons: Font Awesome

Libraries & Tools

  • Image Upload: Multer + Cloudinary
  • Maps: MapPLS Web Maps
  • Validation: Joi
  • Sessions: express-session + connect-mongo
  • Flash Messages: connect-flash
  • Environment Variables: dotenv

πŸ“‚ Project Structure

AtlasRoute/
β”œβ”€β”€ app.js                 # Main application entry point
β”œβ”€β”€ CloudConfig.js         # Cloudinary configuration
β”œβ”€β”€ schema.js              # Joi validation schemas
β”œβ”€β”€ middleware.js          # Custom middleware functions
β”œβ”€β”€ package.json           # Dependencies and scripts
β”œβ”€β”€ controller/            # Route controllers
β”‚   β”œβ”€β”€ listing.js
β”‚   β”œβ”€β”€ review.js
β”‚   └── user.js
β”œβ”€β”€ init/                  # Database initialization
β”‚   β”œβ”€β”€ data.js           # Sample data
β”‚   └── index.js
β”œβ”€β”€ models/                # Mongoose models
β”‚   β”œβ”€β”€ listing.js
β”‚   β”œβ”€β”€ review.js
β”‚   └── user.js
β”œβ”€β”€ public/                # Static files
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   rating.css
β”‚   β”‚   └── style.css
β”‚   β”œβ”€β”€ images/
β”‚   └── JS/
β”‚       └── script.js
β”œβ”€β”€ routes/                # Express routes
β”‚   β”œβ”€β”€ listing.js
β”‚   β”œβ”€β”€ review.js
β”‚   └── user.js
β”œβ”€β”€ uploads/               # Uploaded files (temporary)
β”œβ”€β”€ utils/                 # Utility functions
β”‚   β”œβ”€β”€ ExpressError.js
β”‚   └── wrapAsync.js
└── views/                 # EJS templates
    β”œβ”€β”€ error.ejs
    β”œβ”€β”€ includes/
    β”‚   β”œβ”€β”€ flash.ejs
    β”‚   β”œβ”€β”€ footer.ejs
    β”‚   └── navbar.ejs
    β”œβ”€β”€ layouts/
    β”‚   └── boilerplate.ejs
    β”œβ”€β”€ listings/
    β”‚   β”œβ”€β”€ edit.ejs
    β”‚   β”œβ”€β”€ index.ejs
    β”‚   β”œβ”€β”€ new.ejs
    β”‚   └── show.ejs
    └── users/
        β”œβ”€β”€ home.ejs
        β”œβ”€β”€ login.ejs
        └── signup.ejs

πŸ”§ Prerequisites

Before running the application, make sure you have:

  1. Node.js (v18 or higher) installed
  2. MongoDB (local or Atlas cloud) running
  3. Cloudinary account for image storage
  4. MapPLS API key for maps

πŸ“₯ Installation

  1. Clone the repository

    git clone <repository-url>
    cd AtlasRoute
  2. Install dependencies

    npm install
  3. Create environment file Create a .env file in the root directory:

    # Database
    ATLASDB_URL=mongodb://localhost:27017/atlasroute
    
    # Session
    SECRET=your-secret-key-here
    
    # Cloudinary
    CLOUD_NAME=your-cloud-name
    CLOUD_API=your-cloud-api-key
    CLOUD_API_SECRET=your-cloud-api-secret
    
    # MapPLS
    MAP_SDK_KEY=your-mappls-api-key

βš™οΈ Configuration

Environment Variables

Variable Description
ATLASDB_URL MongoDB connection string
SECRET Secret key for session encryption
CLOUD_NAME Cloudinary cloud name
CLOUD_API Cloudinary API key
CLOUD_API_SECRET Cloudinary API secret
MAP_SDK_KEY MapPLS API key

Database

The application uses MongoDB for data storage. The database schema includes:

  • Listings: Property listings with title, description, price, location, images, and coordinates
  • Reviews: User reviews with ratings and comments
  • Users: User accounts with email and authentication data

πŸš€ Running the Application

  1. Start MongoDB (if running locally)

    mongod
  2. Run the application

    node app.js
    # or
    npm start
  3. Access the application Open your browser and navigate to:

    http://localhost:8080
    

πŸ”— API Routes

Listing Routes

Method Route Description
GET /listing List all listings
GET /listing/new Show new listing form (auth required)
POST /listing Create new listing (auth required)
GET /listing/:id Show listing details
GET /listing/:id/edit Show edit form (owner only)
PUT /listing/:id Update listing (owner only)
DELETE /listing/:id Delete listing (owner only)

Review Routes

Method Route Description
POST /listing/:id/reviews Add review to listing
DELETE /listing/:id/reviews/:reviewId Delete review

User Routes

Method Route Description
GET /signup Show signup form
POST /signup Create new user
GET /login Show login form
POST /login Authenticate user
GET /logout Logout user

Category Routes

Method Route Description
GET /listing?category=<name> Filter listings by category

Available Categories: Trending, Rooms, Mountains, Castles, Amazing pools, Camping, Farms, Arctic

πŸ—„ Database Schema

Listing Schema

{
  title: String (required),
  description: String,
  image: { url: String, filename: String },
  price: Number,
  location: String,
  country: String,
  geometry: { type: "Point", coordinates: [longitude, latitude] },
  reviews: [ObjectId ref: Review],
  owner: ObjectId ref: User,
  category: String
}

Review Schema

{
  rating: Number (1-5),
  comment: String,
  createdAt: Date
}

User Schema

{
  email: String (required, unique),
  username: String (unique, provided by passport-local-mongoose)
}

πŸ“Έ Screenshots

The application includes the following views:

  • Home Page (/) - Landing page with welcome message
  • Listings Index (/listing) - Browse all listings with category filters
  • Listing Show (/listing/:id) - Detailed view with map and reviews
  • New Listing (/listing/new) - Form to create new listing
  • Edit Listing (/listing/:id/edit) - Form to edit existing listing
  • Login (/login) - User login form
  • Signup (/signup) - User registration form

πŸ“„ License

ISC License


Built with ❀️ using Node.js, Express, and MongoDB

About

Built a full-stack hotel booking platform where users can search hotels, view room details, and book rooms online. Implemented server-side rendering using EJS templates, REST APIs with Express.js, and database management with MongoDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors