A full-featured Notes Management REST API built with Node.js, Express, and MongoDB, designed for seamless note-taking experiences with robust authentication, authorization, and role-based access control.
- JWT Authentication (Login / Signup)
- User Roles:
user&admin - Notes CRUD: Create, Read, Update, Delete
- Role-based Access Control:
- Admins can add users
- Users manage only their own notes
- Data Validation using Joi
- Clean structure (controllers, services, routes)
User-Notes/ ├── config/ → MongoDB connection ├── controllers/ → Logic for users & notes ├── middleware/ → Auth & validation middleware ├── models/ → Mongoose schemas ├── routes/ → Express routes ├── services/ → Business logic ├── utils/ → Utility functions └── index.js → App entry point
-
Clone the repo: git clone https://github.com/mody19765/User-Notes.git cd User-Notes
-
Install dependencies: npm install
-
Create a
.envfile: PORT=3000
MONGO_URI=your_mongo_connection_string
JWT_SECRET=your_jwt_secret -
Start the app: npm start
POST /signup→ Register a new userPOST /login→ Login and receive token
POST /notes→ Create a note (user only)GET /notes→ Get your notesGET /notes/user/:id→ Admin fetches any user notesPATCH /notes/:id→ Update a noteDELETE /notes/:id→ Delete a note
POST /users/add→ Admin adds user
User
- name: String
- email: String
- password: String (hashed)
- age: Number
- role: 'user' | 'admin'
Note
- title: String
- description: String
- createdBy: ObjectId (User)
- Password reset with email
- Dashboard stats
- Note search and filters
- Swagger docs
Mohamed Ehab
Email: mody.19765@gmail.com
GitHub: https://github.com/mody19765
If you like this project, please consider giving it a ⭐️ on GitHub!