Skip to content

abhinavxdd/YelpCamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

42 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ•οΈ YelpCamp

A Full-Stack Campground Discovery & Sharing Platform

Node.js Express.js MongoDB Bootstrap MapTiler Docker

Discover, share, and review the best campgrounds around the world. Join a thriving community of outdoor enthusiasts!

Live Demo β€’ Report Bug β€’ Request Feature


πŸ“‹ Table of Contents


🎯 About The Project

YelpCamp is a comprehensive web application that allows users to discover, share, and review campgrounds from around the world. Built with modern web technologies, it provides a seamless experience for camping enthusiasts to find their next adventure.

Note: Any statistics or counts (such as the number of campgrounds) in the UI are currently hardcoded for illustrative purposes.

Why YelpCamp?

  • πŸ—ΊοΈ Interactive Maps: Visualize campground locations with integrated MapTiler mapping
  • ✍️ User Reviews: Read and write authentic reviews from fellow campers
  • πŸ“Έ Photo Sharing: Upload and share beautiful campground photos
  • πŸ” Secure Authentication: Safe and secure user authentication system
  • πŸ“± Responsive Design: Works flawlessly on desktop, tablet, and mobile devices
  • ⭐ Rating System: 5-star rating system for honest campground reviews

✨ Features

Core Functionality

  • πŸ•οΈ Browse Campgrounds: Explore a collection of campgrounds added by the community
  • πŸ“ Add Campgrounds: Share your favorite camping spots with the community
  • ⭐ Review System: Leave ratings and reviews for campgrounds
  • πŸ—ΊοΈ Interactive Maps: View campground locations on an interactive map
  • πŸ” Search & Filter: Find campgrounds by location and amenities
  • πŸ‘€ User Profiles: Create and manage your camping profile

User Authentication

  • βœ… Secure registration and login system
  • πŸ”’ Password encryption with Passport.js
  • πŸ‘₯ Session management
  • πŸ›‘οΈ Authorization for edit/delete actions

Additional Features

  • πŸ“· Multi-image upload with Cloudinary integration
  • πŸ’¬ Flash messages for user feedback
  • 🎨 Modern, responsive UI with Bootstrap 5
  • πŸ”’ Input validation and sanitization
  • 🚫 MongoDB injection prevention
  • πŸ›‘οΈ Helmet.js security headers
  • πŸ“ Geocoding for campground locations

πŸ› οΈ Tech Stack

Backend

  • Node.js - Runtime environment
  • Express.js - Web application framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling
  • Passport.js - Authentication middleware
  • Express Session - Session management
  • Connect Flash - Flash messages

Frontend

  • EJS - Embedded JavaScript templating
  • Bootstrap 5 - CSS framework
  • Bootstrap Icons - Icon library
  • Custom CSS - Modern, responsive styling

Cloud Services

  • Cloudinary - Image hosting and management
  • MapTiler - Interactive maps and geocoding
  • MongoDB Atlas - Cloud database hosting

Security & Validation

  • Helmet.js - Security headers
  • Joi - Schema validation
  • Express Mongo Sanitize - MongoDB injection prevention
  • Sanitize HTML - XSS protection

πŸš€ Getting Started

Prerequisites

Before you begin, ensure you have the following installed:

  • Node.js (v14 or higher)
  • npm or yarn
  • MongoDB (local or Atlas account)

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/YelpCamp.git
    cd YelpCamp
  2. Install dependencies

    npm install
  3. Set up environment variables

    Create a .env file in the root directory:

    # Database
    MONGO_URI=your_mongodb_connection_string
    
    # Cloudinary
    CLOUDINARY_CLOUD_NAME=your_cloudinary_cloud_name
    CLOUDINARY_KEY=your_cloudinary_key
    CLOUDINARY_SECRET=your_cloudinary_secret
    
    # MapTiler
    MAPTILER_API_KEY=your_maptiler_api_key
  4. Seed the database (optional)

    node seeds/index.js
  5. Start the development server

    npm start
  6. Open your browser

    Navigate to http://localhost:8080


πŸ” Environment Variables

Create a .env file with the following variables:

Variable Description Required
MONGO_URI MongoDB connection string Yes
CLOUDINARY_CLOUD_NAME Cloudinary cloud name Yes
CLOUDINARY_KEY Cloudinary API key Yes
CLOUDINARY_SECRET Cloudinary API secret Yes
MAPTILER_API_KEY MapTiler API key Yes

πŸ’» Usage

For Users

  1. Register/Login: Create an account or login to access full features
  2. Browse Campgrounds: Explore campgrounds on the homepage
  3. View Details: Click on any campground to see detailed information
  4. Add Review: Leave a rating and review for campgrounds you've visited
  5. Create Campground: Share your own campground discoveries
  6. Edit/Delete: Manage your own campground listings

For Developers

# Development mode
npm run dev

# Production mode
npm start

# Seed database
node seeds/index.js

πŸ“ Project Structure

YelpCamp/
β”œβ”€β”€ controllers/          # Route controllers
β”‚   β”œβ”€β”€ campgrounds.js
β”‚   β”œβ”€β”€ reviews.js
β”‚   └── users.js
β”œβ”€β”€ models/              # Mongoose models
β”‚   β”œβ”€β”€ campground.js
β”‚   β”œβ”€β”€ review.js
β”‚   └── user.js
β”œβ”€β”€ public/              # Static assets
β”‚   β”œβ”€β”€ javascripts/
β”‚   └── stylesheets/
β”œβ”€β”€ routes/              # Express routes
β”‚   β”œβ”€β”€ campgrounds.js
β”‚   β”œβ”€β”€ reviews.js
β”‚   └── users.js
β”œβ”€β”€ seeds/               # Database seeding
β”‚   β”œβ”€β”€ cities.js
β”‚   └── index.js
β”œβ”€β”€ utils/               # Utility functions
β”‚   β”œβ”€β”€ catchAsync.js
β”‚   └── ExpressError.js
β”œβ”€β”€ views/               # EJS templates
β”‚   β”œβ”€β”€ campgrounds/
β”‚   β”œβ”€β”€ layouts/
β”‚   β”œβ”€β”€ partials/
β”‚   └── users/
β”œβ”€β”€ middleware.js        # Custom middleware
β”œβ”€β”€ schemas.js           # Joi validation schemas
β”œβ”€β”€ app.js              # Express app setup
└── package.json

πŸ”’ Security Features

YelpCamp implements multiple security layers:

  • Authentication: Passport.js with local strategy
  • Authorization: User-specific permissions for CRUD operations
  • Password Security: Encrypted password storage
  • Session Security: Secure session configuration with MongoDB store
  • Input Validation: Joi schema validation on all inputs
  • XSS Protection: HTML sanitization with sanitize-html
  • MongoDB Injection Prevention: Express-mongo-sanitize
  • Security Headers: Helmet.js CSP configuration
  • CSRF Protection: Built-in Express protections

πŸ›£οΈ API Routes

Campgrounds

GET     /campgrounds           - View all campgrounds
GET     /campgrounds/new       - Form to create new campground
POST    /campgrounds           - Create new campground
GET     /campgrounds/:id       - View single campground
GET     /campgrounds/:id/edit  - Form to edit campground
PUT     /campgrounds/:id       - Update campground
DELETE  /campgrounds/:id       - Delete campground

Reviews

POST    /campgrounds/:id/reviews           - Create review
DELETE  /campgrounds/:id/reviews/:reviewId - Delete review

Authentication

GET     /register              - Registration form
POST    /register              - Create new user
GET     /login                 - Login form
POST    /login                 - Authenticate user
GET     /logout                - Logout user

πŸ“Έ Screenshots

image image image image

🀝 Contributing

Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Contribution Guidelines

  • Write clean, documented code
  • Follow the existing code style
  • Test your changes thoroughly
  • Update documentation as needed

πŸ“ License

Distributed under the MIT License. See LICENSE for more information.


πŸ‘€ Contact

Abhinav Rajput - LinkedIn

Project Link: https://github.com/abhinavxdd/YelpCamp


πŸ™ Acknowledgments

This project was built as part of learning full-stack web development. Special thanks to:


Made with β™₯ for campers

Β© 2025 YelpCamp. All rights reserved.

About

YelpCamp - A Full-Stack MERN Web App for Campground Discovery & Sharing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors