IdentityVault is a modern MERN authentication app with:
- React + Vite frontend
- Node.js + Express backend
- MongoDB Atlas database
- secure password hashing with
bcrypt - JWT-based authentication and protected routes
- Clone the repo:
git clone https://github.com/tharun0135/WebDev-Projects.git
cd WebDev-Projects- Install frontend dependencies:
cd frontend
npm install- Install backend dependencies:
cd ../backend
npm install- Create
backend/.envwith:
PORT=5000
MONGO_URI=<your-mongodb-atlas-connection-string>
JWT_SECRET=<your-secret-key>- Create
frontend/.envusing the example file:
cd frontend
copy .env.example .env- Start backend:
cd backend
npm start- Start frontend:
cd frontend
npm run dev- Open the frontend in browser:
http://localhost:5173
From the repository root:
git add .
git commit -m "Update MERN auth app with deployment docs"
git push origin mainIf your local repo does not have the remote configured, add it with:
git remote add origin https://github.com/tharun0135/WebDev-Projects.git- Create a free MongoDB Atlas cluster.
- Create a database user and password.
- Allow your app IP or enable access from anywhere during testing.
- Copy the connection string and replace
<password>and database name.
Example:
mongodb+srv://<user>:<password>@cluster0.69ik4ny.mongodb.net/practice_mern?retryWrites=true&w=majority
- Create a Render account.
- Choose Web Service and connect your GitHub repo.
- Set build command:
npm install- Set start command:
npm start- Add environment variables in Render:
PORT=5000MONGO_URI=<your MongoDB Atlas URI>JWT_SECRET=<your strong secret>
- Create a Vercel account.
- Import the repository from GitHub.
- If you configure the project with the repository root, use the root build command below.
- Set build command:
npm run build- Set output directory:
dist
- Add an environment variable in Vercel:
VITE_API_BASE=https://<your-render-backend-url>/api/auth
If you configured the Vercel project to use the
frontend/folder as the root, you can still usenpm run buildthere.
The frontend uses VITE_API_BASE to locate the backend API. After your backend is live, set that variable in Vercel to:
https://<your-render-backend-url>/api/auth
No code change is needed in Login.jsx, Register.jsx, or Home.jsx after deployment because the app reads the API host from the environment.
- Keep
backend/.envprivate and never push it to GitHub. - Use strong random values for
JWT_SECRET. - Use
RenderorRailwayfor the backend andVercelfor the frontend. - For production, allow only required CORS origins and secure MongoDB Atlas IP access.
- React + Vite
- Express + Node.js
- MongoDB Atlas
- bcrypt password hashing
- JSON Web Tokens (JWT)
- Bootstrap for UI