A back-end contact management application built using Node.js, Express.js, MongoDB, and JWT authentication. This app allows users to register, log in, and securely manage their contacts with authentication and authorization.
✅ User Authentication (Signup, Login) using JWT tokens
✅ Protected Routes with JWT middleware
✅ CRUD Operations for managing contacts (Create, Read, Update, Delete)
✅ MongoDB Integration using Mongoose
✅ Password Hashing with bcrypt.js for security
✅ Error Handling for better API responses
✅ RESTful API following best practices
Node.js & Express.js – Backend framework
MongoDB & Mongoose – Database and ORM
JWT (JSON Web Token) – Authentication
bcrypt.js – Password hashing
dotenv – Environment variable management
Thunder Client– API testing
Clone the repository:
git clone https://github.com/adarshupadhyay21/Contact_Manager_App.gitcd Contact_Manager_App
npm installCreate a .env file in the root directory and add the following variables:
CONNECTION_STRING = your_mongodb_connection_string
ACCESS_TOKEN_SECRET = your_secret_key
PORT = 5001
Start the server:
npm startThe API will be running in your localhost at: http://localhost:5001
📡 API Endpoints
POST /api/auth/register // Register a new user
POST /api/auth/login // User login
GET /api/auth/current // Get the current logged-in user (Protected)
GET /api/contacts // Get all contacts
POST /api/contacts // Add a new contact
GET /api/contacts/:id // Get a contact by ID
PUT /api/contacts/:id // Update a contact by ID
DELETE /api/contacts/:id // Delete a contact by ID
🤝 Contributing
Contributions are welcome! Feel free to fork this repository, make your changes, and open a pull request for any feature or bug fix.