This project contains a backend (Node.js + Express + MongoDB) and a React frontend.
- Node.js v16+ (Download)
- MongoDB (local or MongoDB Atlas)
Terminal 1 — Backend:
cd backend
npm install
cp .env.example .env
# Edit .env with your MONGO_URI and JWT_SECRET
npm run devExpected output: MongoDB connected and Server running on port 5000
Terminal 2 — Frontend:
cd frontend
npm install
npm startThis opens http://localhost:3000 in your browser automatically.
cd backend
npm installCopy environment file:
cp .env.example .envEdit .env and configure:
PORT=5000
MONGO_URI=mongodb://localhost:27017/intern_assignment
JWT_SECRET=your_secure_secret_key_here
For MongoDB Atlas:
Replace MONGO_URI with your connection string:
MONGO_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/intern_assignment
Start dev server with auto-reload:
npm run devOr production mode:
npm startcd frontend
npm install
npm startThe app opens at http://localhost:3000
| Field | Value |
|---|---|
demo@test.com |
|
| Password | Demo@123 |
- Open http://localhost:3000
- Click Login
- Enter credentials above
- Create, view, edit, or delete items
POST /api/v1/auth/register— Register new userPOST /api/v1/auth/login— Login and get token
GET /api/v1/items— Fetch all user itemsPOST /api/v1/items— Create new itemPUT /api/v1/items/:id— Update itemDELETE /api/v1/items/:id— Delete item
# Find process on port 5000
netstat -ano | findstr ":5000"
# Kill it (replace <PID>)
taskkill /PID <PID> /F- Ensure MongoDB is running locally:
mongod - Or verify your Atlas connection string in
.env
# Try different port
set PORT=3001
npm startproject/
├── backend/ # Node.js/Express API
│ ├── server.js # Entry point
│ ├── config/db.js # MongoDB config
│ ├── controllers/ # Route logic
│ ├── models/ # Mongoose schemas
│ ├── routes/ # API routes
│ ├── middlewares/ # Auth & error handling
│ ├── package.json
│ └── .env # Environment variables
│
├── frontend/ # React app
│ ├── src/
│ │ ├── App.js # Main component
│ │ ├── pages/ # Pages (Login, Register, Dashboard)
│ │ ├── api/ # API calls
│ │ └── index.js # React entry
│ ├── package.json
│ └── public/
│
├── README.md # This file
└── RUNNING.md # Detailed run guide
cd frontend
npm run build
# Output: build/ folder (ready to deploy)cd backend
npm start- The uploaded assignment doc is included in this project at the root.
- For detailed troubleshooting, see
RUNNING.md - Backend: http://localhost:5000
- Frontend: http://localhost:3000