This repository gives you a simple and clean starting point to create a full-stack MERN application (MongoDB, Express, React, Node.js).
Make sure you have installed on your system:
- Node.js (LTS version recommended)
- npm (comes with Node.js)
- MongoDB Atlas account (or a MongoDB cluster URI)
All commands below are run from a terminal in the project root folder MERN_PROJECT_BMSCE.
cd my_first_mern_app
cd client
npm install
npm run devThen open the localhost link shown in the terminal (Vite dev server URL).
Open a new terminal (or tab) and from the project root run:
cd my_first_mern_app
cd server
npm installNow configure your MongoDB connection:
- Open
my_first_mern_app/server/index.js. - Find the line with:
mongoose.connect(
- Paste your MongoDB cluster connection string (URI) there.
- Append the query parameter
appName=Cluster0if required by your setup.
Finally, start the server:
node index.js- The backend will listen on
http://localhost:3001(as used in the React app). - The React frontend (Vite) runs on another port (usually
5173by default).
my_first_mern_app/client– React frontend (forms, tables, UI)my_first_mern_app/server– Node.js + Express + Mongoose backendmy_first_mern_app/server/models– Mongoose models (e.g.,users.js)docs/– HTML files for teaching/explaining MERN and MongoDB basicsjs_warmup/– JavaScript basics and small practice files
-
Instagram (for people not on LinkedIn :P):
nikhil_sk24