Skip to content

vipinishere/User-Task-Management

Repository files navigation

Node.js Express.js MongoDB EJS JWT
License: MIT
Last Commit

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.


Live Project


Table of Contents


Features

  • 🔐 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

Tech Stack

  • Backend: Node.js, Express.js
  • Database: MongoDB + Mongoose
  • Frontend: EJS templating
  • Security: JWT, CORS, Helmet
  • Error Handling: Global middleware for errors

Project Structure

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

---

Installation & Setup

  1. Clone the repository
git clone https://github.com/your-username/user-task-management.git
cd user-task-management
  1. Install Dependancies
npm install
  1. Setup environment veriable in .env
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_secret_key
  1. Run Server
npm start
  1. Access the App

Open http://localhost:5000 in your browser


API Endpoints / Usage

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.

Screenshots / Demo

Add visual references for different roles and key features

CEO Dashboard

CEO Dashboard

Admin Dashboard

Admin Dashboard

User Dashboard

User Dashboard

Optional: You can add GIFs to show task creation or assignment.

Contribution

  1. Fork the repository
  2. Create a new branch: feature/your-feature-name
  3. Commit your changes
  4. Push the branch
  5. Open a Pull Request

Optional:

  • Follow consistent code formatting and linting rules
  • Provide clear commit messages
  • Include screenshots if you add new UI features

License

This project is licensed under the MIT License.

See the LICENSE file for more details.

About

User-Task-Management is a web-application for managing users and their associated tasks. It provides a clean structure for adding, editing, tracking and organizing tasks belonging to different users. With a modular architecture and separation of concerns, the codebase is well-suited as a starter template for CRUD projects.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors