Skip to content

waqas1412/YelpCamp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏕️ YelpCamp

Node.js Express MongoDB EJS Bootstrap License

A full-stack web application for discovering and reviewing campgrounds, built with Node.js, Express, and MongoDB.

📋 Table of Contents

✨ Features

  • 🏕️ Campground Management: Create, read, update, and delete campground listings
  • ⭐ Review System: Add and manage reviews with ratings (1-5 stars)
  • 🔍 Data Validation: Server-side validation using Joi schemas
  • 💾 Database Integration: MongoDB with Mongoose ODM
  • 🎨 Modern UI: Responsive design with Bootstrap 5
  • ⚡ Error Handling: Custom error handling with ExpressError class
  • 🔄 Flash Messages: User feedback with connect-flash
  • 📱 Responsive Design: Mobile-friendly interface
  • 🔒 Form Validation: Client-side form validation with Bootstrap

🛠️ Tech Stack

Backend

  • Node.js - JavaScript runtime environment
  • Express.js - Web application framework
  • MongoDB - NoSQL database
  • Mongoose - MongoDB object modeling tool
  • Joi - Data validation library
  • EJS - Templating engine
  • Express Session - Session middleware
  • Connect Flash - Flash message middleware

Frontend

  • Bootstrap 5 - CSS framework for responsive design
  • EJS Templates - Server-side templating
  • Custom JavaScript - Form validation and interactivity

Development Tools

  • Method Override - HTTP method override middleware
  • EJS Mate - Layout support for EJS

🚀 Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • MongoDB (running locally or cloud instance)
  • npm or yarn package manager

Installation

  1. Clone the repository

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

    npm install
  3. Set up MongoDB

    • Ensure MongoDB is running on mongodb://127.0.0.1:27017/yelp-camp
    • Or update the connection string in app.js
  4. Seed the database (optional)

    node seeds/index.js
  5. Start the application

    node app.js
  6. Open your browser Navigate to http://localhost:3000

📁 Project Structure

YelpCamp/
├── app.js                 # Main application entry point
├── package.json           # Project dependencies and scripts
├── models/                # Database models
│   ├── campground.js      # Campground model with reviews
│   └── review.js          # Review model
├── routes/                # Express routes
│   ├── campground.js      # Campground CRUD operations
│   └── reviews.js         # Review operations
├── views/                 # EJS templates
│   ├── layouts/           # Layout templates
│   ├── partials/          # Reusable components
│   └── campgrounds/       # Campground-specific views
├── public/                # Static assets
│   └── javascripts/       # Client-side JavaScript
├── utils/                 # Utility functions
│   ├── catchAsync.js      # Async error handler
│   └── ExpressError.js    # Custom error class
├── seeds/                 # Database seeding
│   ├── index.js           # Main seed script
│   ├── cities.js          # City data
│   └── seedHelpers.js     # Seed helper functions
└── schemas.js             # Joi validation schemas

🔧 API Endpoints

Campgrounds

  • GET /campgrounds - Display all campgrounds
  • GET /campgrounds/new - Show create campground form
  • POST /campgrounds - Create new campground
  • GET /campgrounds/:id - Show specific campground
  • GET /campgrounds/:id/edit - Show edit campground form
  • PUT /campgrounds/:id - Update campground
  • DELETE /campgrounds/:id - Delete campground

Reviews

  • POST /campgrounds/:id/reviews - Add review to campground
  • DELETE /campgrounds/:id/reviews/:reviewId - Delete review

🎨 Screenshots

Screenshots will be added here once the application is running

🤝 Contributing

  1. Fork the repository
  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

📄 License

This project is licensed under the ISC License - see the LICENSE file for details.


Made with ❤️ using Node.js, Express, and MongoDB

GitHub stars GitHub forks GitHub issues

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors