A full-stack web application for discovering and reviewing campgrounds, built with Node.js, Express, and MongoDB.
- ✨ Features
- 🛠️ Tech Stack
- 🚀 Getting Started
- 📁 Project Structure
- 🔧 API Endpoints
- 🎨 Screenshots
- 🤝 Contributing
- 📄 License
- 🏕️ 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
- 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
- Bootstrap 5 - CSS framework for responsive design
- EJS Templates - Server-side templating
- Custom JavaScript - Form validation and interactivity
- Method Override - HTTP method override middleware
- EJS Mate - Layout support for EJS
- Node.js (v16 or higher)
- MongoDB (running locally or cloud instance)
- npm or yarn package manager
-
Clone the repository
git clone https://github.com/yourusername/yelpcamp.git cd yelpcamp -
Install dependencies
npm install
-
Set up MongoDB
- Ensure MongoDB is running on
mongodb://127.0.0.1:27017/yelp-camp - Or update the connection string in
app.js
- Ensure MongoDB is running on
-
Seed the database (optional)
node seeds/index.js
-
Start the application
node app.js
-
Open your browser Navigate to
http://localhost:3000
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
GET /campgrounds- Display all campgroundsGET /campgrounds/new- Show create campground formPOST /campgrounds- Create new campgroundGET /campgrounds/:id- Show specific campgroundGET /campgrounds/:id/edit- Show edit campground formPUT /campgrounds/:id- Update campgroundDELETE /campgrounds/:id- Delete campground
POST /campgrounds/:id/reviews- Add review to campgroundDELETE /campgrounds/:id/reviews/:reviewId- Delete review
Screenshots will be added here once the application is running
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the ISC License - see the LICENSE file for details.