A MERN (MongoDB, Express.js,ejs, Node.js) stack project involves both frontend and backend development. Here's a basic guide to executing a MERN stack project:
Setting Up the Project
git clone https://github.com/username/repo-name.git
cd repo-name
Backend (Node.js + Express)
cd backend
npm install
.env
file to store environment variables such as database URIs, API keys, and ports.
MONGO_URI=your_mongodb_connection_string
PORT=5000
npm start
The server will typically run on http://localhost:5000
.Frontend (React.js)
cd frontend
npm install
npm start
The frontend will usually run on http://localhost:3000
.Connecting Frontend and Backend
http://localhost:5000/api/
.Running Both Frontend and Backend
concurrently
to run both with a single command.
npm install concurrently --save-dev
Then modify your root package.json
scripts:
"scripts": {
"start": "concurrently \"npm run server\" \"npm run client\"",
"server": "cd backend && npm start",
"client": "cd frontend && npm start"
}
Building for Production
npm run build
## YelpCamp
YelpCamp is a full-stack web application designed to allow users to browse, review, and manage campgrounds. Built with the MERN stack, YelpCamp offers a robust and interactive experience, featuring:
- **User Authentication**: Secure user login and registration using Passport.js.
- **Interactive Maps**: Integration with Mapbox for displaying campground locations on an interactive map.
- **Campground Management**: Users can create, edit, and delete their own campgrounds.
- **Review System**: Users can leave reviews and ratings for campgrounds.
- **Responsive Design**: A mobile-friendly interface built with modern CSS techniques.
### Tech Stack
- **MongoDB**: NoSQL database for storing campground and user data.
- **Express.js**: Backend framework to build a RESTful API.
- **ejs**: Frontend library for building dynamic user interfaces.
- **Node.js**: JavaScript runtime for handling server-side operations.
This project demonstrates a range of skills including frontend development, backend API creation, database management, and user authentication.
This description provides an overview of the project, highlighting the key features and technologies used in YelpCamp, making it easier for others to understand the project's scope and functionality.