This guide will walk you through the process of setting up the MERN Booking App on your local machine.
Before you begin, ensure you have Node.js installed on your system.
Start by cloning the repository to your local machine:
git clone https://github.com/chrisblakely01/mern-booking-app.git
cd mern-booking-app
Environment Files: Navigate to the backend
folder and create two files: .env
and .env.e2e
. Add the following contents to both files:
MONGODB_CONNECTION_STRING=
JWT_SECRET_KEY=
FRONTEND_URL=
# Cloudinary Variables
CLOUDINARY_CLOUD_NAME=
CLOUDINARY_API_KEY=
CLOUDINARY_API_SECRET=
# Stripe
STRIPE_API_KEY=
MongoDB Setup:
MONGODB_CONNECTION_STRING
variable in your .env
files..env.e2e
setup see "running automated tests" belowCloudinary Setup:
CLOUDINARY_*
variables in your .env
files.Stripe Setup:
STRIPE_API_KEY
variable in your .env
files.JWT_SECRET_KEY:
Frontend URL:
FRONTEND_URL
should point to the URL where your frontend application is running (typically http://localhost:3000
if you're running it locally).Environment Files: Navigate to the frontend
folder and create a file: .env
:
VITE_API_BASE_URL=
VITE_STRIPE_PUB_KEY=
VITE_API_BASE_URLL:
VITE_API_BASE_URL
should point to the URL where your backend application is running (typically http://localhost:7000
if you're running it locally).Backend:
backend
directory.npm install
.npm start
.Frontend:
frontend
directory.npm install
.npm run dev
.http://localhost:5173
but verify this in your command line terminalMongoDB Setup:
MONGODB_CONNECTION_STRING
variable in your .env.e2e
file.Importing Test Data into MongoDB:
data
folder at the root, which includes JSON files for a test user and a test hotel. You can import these into your MongoDB collections to quickly set up test data.data
folder, find the file containing the test user data (likely named something like test-users.json
).users
collection within your database. Create it if it doesn't existtest-users.json
file and select it.users
collection.hotels
collection within your database. Create it if it doesn't existtest-hotel.json
file.hotels
collection.Running tests
e2e-tests
directory.npm install
.