A role-based task management application built with Node.js, Express, MongoDB, and EJS.
It supports CEO, Admin, and User roles, task assignments, and includes JWT authentication, CORS, Helmet security, and global error handling.
- Features
- Tech Stack
- Project Structure
- Installation & Setup
- API Endpoints / Usage
- Screenshots / Demo
- Contribution
- License
- Optional Extras
- 🔐 JWT Authentication for secure login
- 👤 Role-based Access Control: CEO, Admin, User
- 📋 CRUD Operations for tasks
- 🛡️ Security: CORS, Helmet
- ⚡ Global Error Handling with centralized error page
- ✅ Assign tasks to users (Admin/CEO)
- 📊 View dashboard for tasks based on roles
- Backend: Node.js, Express.js
- Database: MongoDB + Mongoose
- Frontend: EJS templating
- Security: JWT, CORS, Helmet
- Error Handling: Global middleware for errors
user-task-management/
├── config/ # Database Connection & Constants
├── controllers/ # Business logic for auth, tasks, users
├── middlewares/ # Auth, role-based access, error handling
├── models/ # MongoDB Schemas (User, Task)
├── public/ # Public files
├── routes/ # Route definitions
├── utils/ # Helper functions
├── views/ # EJS templates
├── app.js # Express app configuration
├── server.js # Server entry point
└── .env # Environment variables
---
- Clone the repository
git clone https://github.com/your-username/user-task-management.git
cd user-task-management- Install Dependancies
npm install- Setup environment veriable in .env
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key- Run Server
npm start- Access the App
Open http://localhost:5000 in your browser
| Method | Endpoint | Description | Access Role |
|---|---|---|---|
| POST | /auth/register | Register a new user | Public |
| POST | /auth/login | Login & get JWT | Public |
| GET | /tasks | Get own tasks | User |
| POST | /tasks | Create new task | User/Admin |
| PUT | /tasks/:id | Update a task | User/Admin |
| DELETE | /tasks/:id | Delete a task | User/Admin |
| GET | /users | Get all users | Admin/CEO |
| POST | /tasks/assign | Assign task to user | Admin/CEO |
| GET | /all-tasks | Get all tasks | CEO |
| GET | /all-users | Get all users | CEO |
Optional: You can use Postman or Insomnia to test these endpoints.
Add visual references for different roles and key features
Optional: You can add GIFs to show task creation or assignment.
- Fork the repository
- Create a new branch:
feature/your-feature-name - Commit your changes
- Push the branch
- Open a Pull Request
Optional:
- Follow consistent code formatting and linting rules
- Provide clear commit messages
- Include screenshots if you add new UI features
This project is licensed under the MIT License.
See the LICENSE file for more details.


