WanderLust is a simple MERN travel blog website ✈ This project is aimed to help people to contribute in open source, upskill in react and also master git.
At its core, this project embodies two important aims:
- Start Your Open Source Journey: It's aimed to kickstart your open-source journey. Here, you'll learn the basics of Git and get a solid grip on the MERN stack and I strongly believe that learning and building should go hand in hand.
- React Mastery: Once you've got the basics down, a whole new adventure begins of mastering React. This project covers everything, from simple form validation to advanced performance enhancements. And I've planned much more cool stuff to add in the near future if the project hits more number of contributors.
I'd love for you to make the most of this project - it's all about learning, helping, and growing in the open-source world.
-
Fork and Clone the Repository
git clone https://github.com/{your-username}/wanderlust.git
-
Navigate to the Backend Directory
cd backend
-
Install Required Dependencies
# installs NVM (Node Version Manager) curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash # download and install Node.js nvm install 20 # verifies the right Node.js version is in the environment node -v # should print `v20.12.1` # verifies the right NPM version is in the environment npm -v # should print `10.5.0` npm i
-
Set up your MongoDB Database
- Open MongoDB Compass and connect MongoDB locally at
mongodb://localhost:27017
.
- Open MongoDB Compass and connect MongoDB locally at
-
Import sample data
To populate the database with sample posts, you can copy the content from the
backend/data/sample_posts.json
file and insert it as a document in thewanderlust/posts
collection in your local MongoDB database using either MongoDB Compass ormongoimport
.mongoimport --db wanderlust --collection posts --file ./data/sample_posts.json --jsonArray
-
Configure Environment Variables
cp .env.sample .env
-
Start the Backend Server
npm start
You should see the following on your terminal output on successful setup.
[BACKEND] Server is running on port 5000 [BACKEND] Database connected: mongodb://127.0.0.1/wanderlust
-
Open a New Terminal
cd frontend
-
Install Dependencies
npm i
-
Configure Environment Variables
cp .env.sample .env.local
-
Launch the Development Server
npm run dev
MONGODB_URI="mongodb://127.0.0.1/wanderlust"
CORS_ORIGIN="http://localhost:5173"
#MONGODB_URI="mongodb://mongo/wanderlust" //database container name, like my mongo container name is mongo
#CORS_ORIGIN="http://ec2-ip-address:5173" // add here public ip address, and add frontend port