A comprehensive task management API built using Node.js, Express, Sequelize ORM, and MySQL. This API allows users to manage tasks, projects, and team members, with robust authentication and role-based access control (RBAC) features. The API supports CRUD operations for tasks and projects, user management within projects, and assignment of tasks to users.
Redis is also required for session management and caching to improve performance.
- User Authentication: Login system based on sessions.
- Project Management: Create, update, delete, and retrieve projects.
- Task Management: Create, update, delete, and retrieve tasks.
- User Management: Manage users within a project and assign tasks to users.
- Project Members: Add members to specific projects.
- RBAC System: Role-based access control ensures secure and granular permission handling.
The application fully implements an RBAC (Role-Based Access Control) system with the following components:
- Roles: Defines the role of each user (e.g., Admin, User).
- Permissions: Defines the actions that can be performed within the system (e.g., Create Task, Edit Project).
- RolePermissions: Maps roles to permissions.
Upon application startup, predefined permissions and roles are automatically populated into the database, ensuring consistent and reliable access control.
Authentication is session-based and includes routes for login (via OTP or password), updating user credentials, and logout. Redis is used to manage and store session data for improved performance.
- POST
/api/authentication
- Validates user session.
- Request Body Example:
{ "username": "" }
- POST
/api/login/otp
- Request Body Example:
{ "phone": "", "otp": "" }
- POST
/api/login/password
- Request Body Example:
{ "username": "", "password": "" }
- POST
/api/username/update
- Request Body Example:
{ "first_name": "", "last_name": "" }
- POST
/api/email/update
- Request Body Example:
{ "email": "" }
- POST
/api/password/update
- Request Body Example:
{ "current_password": "", "new_password": "", "repeat_password": "" }
- GET
/api/user/logout
- GET
/api/projects
- POST
/api/projects
- Request Body Example:
{ "title": "", "description": "", "created_by": "" }
- PUT
/api/projects/{project_id}
- Request Body Example:
{ "description": "" }
- DELETE
/api/projects/{project_id}
- POST
/api/projects/{project_id}/members
- Request Body Example:
{ "user_id": "" }
- POST
/api/tasks
- Request Body Example:
{ "title": "", "description": "", "status": "", "priority": "", "due_date": "", "project_id": "", "user_id": "" }
- GET
/api/tasks/{task_id}
- PUT
/api/tasks/{task_id}
- Request Body Example:
{ "title": "updated task" }
- DELETE
/api/tasks/{task_id}
- GET
/api/projects/{project_id}/users/{user_id}/tasks
- GET
/api/users/{user_id}/tasks
- GET
/api/users
- GET
/api/projects/{project_id}/users
- Clone the repository.
- Install dependencies:
npm install
- Create a
.env
file and set up the required environment variables. - Start the server:
npm start
bash <(curl -Ls https://raw.githubusercontent.com/mohsen104/Task-Manager/master/install.sh)
- Node.js: JavaScript runtime.
- Express: Web framework for Node.js.
- Sequelize ORM: ORM for MySQL database interaction.
- MySQL: Database for storing project, task, and user data.
- Winston: Logging library.