YelpCamp is a full-stack web application for sharing and reviewing campgrounds. Users can register, log in, create campgrounds, leave reviews, and view interactive maps. The project demonstrates authentication, CRUD operations, session management, and security best practices using modern JavaScript frameworks.
- User authentication (register, login, logout)
- Create, edit, and delete campgrounds
- Add and manage reviews for campgrounds
- Interactive maps integration
- Secure session management
- Input sanitation and security headers
- Flash messaging for notifications
- Backend: Node.js, Express.js, MongoDB (via Mongoose)
- Authentication: Passport.js (local strategy)
- Templating: EJS with ejs-mate
- Sessions: express-session with connect-mongo
- Security: helmet, input sanitation
- Other: dotenv for environment variables, method-override
- Node.js (v14+ recommended)
- MongoDB (local or Atlas)
- npm (comes with Node.js)
-
Clone the repository
git clone https://github.com/coderMayank69/YELPCAMP.git cd YELPCAMP
-
Install dependencies
npm install
-
Configure environment variables
Create a
.env
file in the root directory with the following:DB_URL=your_mongodb_connection_string SECRET=your_session_secret
If you’re using MongoDB Atlas, use your Atlas connection string for
DB_URL
. -
Run the application
npm start
The app will run on
http://localhost:3000
by default.
app.js
- Main server filemodels/
- Mongoose models (User, Campground, Review)routes/
- Express route definitionsviews/
- EJS templatespublic/
- Static assets (CSS, JS, images)utils/
- Utility modules (error handling, sanitation)
- Sessions stored securely using connect-mongo
- Helmet sets content security policies and HTTP headers
- User input sanitized to protect against NoSQL injection and XSS
Pull requests are welcome! For major changes, please open an issue first to discuss what you would like to change.
If you have any questions or need further documentation, feel free to ask! If you have any questions or need further documentation, feel free to ask!