##📇 ContactManager App
ContactManager is a simple yet powerful MERN stack application that helps users manage their contacts efficiently.
🚀 Built while following a YouTube tutorial, this project helped me learn how routing, authentication, and CRUD operations work in a real-world Node + Mongo backend — as someone who already knows React!
mycontacts-backend/
│
├── config/
│ └── dbConnection.js # MongoDB connection setup
│
├── controllers/
│ ├── contactController.js # Contact operations logic
│ └── userController.js # User auth logic
│
├── middleware/
│ ├── errorHandler.js # Custom error middleware
│ └── validateTokenHandler.js # JWT token validation
│
├── models/
│ ├── contactModel.js # Mongoose contact schema
│ └── userModel.js # Mongoose user schema
│
├── routes/
│ ├── contactRoutes.js # Contact routes
│ └── userRoutes.js # Auth routes
│
├── .gitignore
├── constants.js
├── package.json
├── server.js # App entry point
└── README.md
- 🔐 JWT-based authentication
- 🔑 Secure password hashing with bcrypt
- 📇 Create, Read, Update, Delete (CRUD) for contacts
- 🔒 Protected routes so users only access their own data
⚠️ Custom error handling for clean API responses
| Tool | Role |
|---|---|
| 🟢 Node.js | Backend runtime |
| ⚙️ Express.js | REST API framework |
| 🍃 MongoDB | NoSQL database |
| 📦 Mongoose | MongoDB ODM |
| 🔑 bcrypt | Password hashing |
| 🔐 jsonwebtoken | Auth token generation & validation |
| 📁 dotenv | Environment variable management |
git clone <repository-url>
cd mycontacts-backendnpm installCreate a .env file in the root directory:
PORT=5000
MONGO_URI=<your_mongodb_connection_string>
ACCESS_TOKEN_SECRET=<your_jwt_secret>
npm start📍 Server will be live at: http://localhost:5000
POST /api/users/register→ Register a new userPOST /api/users/login→ Login & receive JWTGET /api/users/current→ Get current user (protected)
GET /api/contacts→ Get all contacts for logged-in userPOST /api/contacts→ Create new contactGET /api/contacts/:id→ Get contact by IDPUT /api/contacts/:id→ Update contactDELETE /api/contacts/:id→ Delete contact
- 💻 Frontend with React UI (coming soon!)
- 🔄 Refresh token implementation
- 🔍 Pagination & search for large contact lists
- 👤 User profile management
- 🧪 Unit & integration tests
- 🚫 Improved error responses with validation
I followed a YouTube tutorial to get hands-on experience with backend development as a React developer. This helped me understand backend routing, REST APIs, JWT authentication, and working with MongoDB — all through practical application. 🙌