A simple RESTful API built with Express.js and MongoDB that allows users to register, log in, and securely manage their personal contact list.
- Backend: Node.js, Express.js
- Database: MongoDB with Mongoose ORM
- Authentication: JSON Web Tokens (JWT) for user registration and login
- Password Security: bcrypt for hashed passwords
- Development Tools: nodemon for live reloading, dotenv, express-async-handler, TypeScript (for IntelliSense support)
- Clone the repository
git clone https://github.com/baraa-elhajj/contacts-api.git
cd contacts-api- Install dependencies
npm install- Set up environment variables
Create a
.envfile in the project root:
PORT=5000
MONGO_URI=your_mongodb_connection_string
ACCESS_TOKEN_SECRET=your_jwt_secret- Run the server
npm run serverYou can test all endpoints easily using the included Postman collection json file: tests/contacts-api.postman_collection.json
- Open Postman
- Import the file
- Set the
{{base_url}}environment variable to your api localhost - Run requests in order: Register → Login → Contacts CRUD
Love this project? Drop a star ⭐ and feel free to fork it or suggest improvements if you find something cool!