Skip to content

usmanshaikh/nestjs-multi-tenant-task-manager

Repository files navigation

NestJS Multi-Tenant Task Manager

Backend API for a multi-tenant task management system similar to Jira / Trello.

Built with:

  • NestJS
  • PostgreSQL
  • Sequelize

Each organization has its own users, projects, boards, tasks, and comments.


Setup

1. Install dependencies

npm install

2. Create environment file

Create .env and update values. You can refer to .env.example.

3. Create database

Using terminal:

psql -U postgres -c "CREATE DATABASE multi_tenant_task_db;"

Or create it using pgAdmin.

4. Run the server

npm run start:dev

Server runs at:

http://localhost:3000/api/v1

API Usage Flow

Recommended order while testing APIs.


1. Authentication

Register first. This creates organization + admin user.

POST /auth/register

Copy the token from response and use it as:

Authorization: Bearer <token>

Other auth endpoints:

POST /auth/login
POST /auth/join
GET  /auth/me

/auth/join creates a member user inside the organization.


2. Organization

Organization is created automatically during registration.

Endpoints:

GET   /organization
PATCH /organization
GET   /organization/members

Admin can update organization details.


3. Projects

Create a project first.

A default board is automatically created inside the project.

POST  /projects
GET   /projects
GET   /projects/:id
PATCH /projects/:id

Project members management:

POST   /projects/:id/members
DELETE /projects/:id/members/:userId

4. Boards

Each project contains boards.

POST   /projects/:projectId/boards
GET    /projects/:projectId/boards
GET    /projects/:projectId/boards/:id
PATCH  /projects/:projectId/boards/:id
DELETE /projects/:projectId/boards/:id

5. Tasks

Tasks are created inside boards.

POST   /boards/:boardId/tasks
GET    /boards/:boardId/tasks
GET    /boards/:boardId/tasks/:id
PATCH  /boards/:boardId/tasks/:id
DELETE /boards/:boardId/tasks/:id

Task filtering supported via query params:

?status=todo
?status=in_progress
?priority=high
?search=login bug
?assigneeId=<uuid>
?page=1&limit=10

Assign users to tasks:

POST   /boards/:boardId/tasks/:id/assignees
DELETE /boards/:boardId/tasks/:id/assignees/:userId

6. Comments

Tasks support comments.

POST   /tasks/:taskId/comments
GET    /tasks/:taskId/comments
PATCH  /tasks/:taskId/comments/:id
DELETE /tasks/:taskId/comments/:id

Users can edit their own comments. Admin can delete any comment.


7. Users

GET   /users/:id
PATCH /users/me
PATCH /users/me/password
PATCH /users/:id/role
DELETE /users/:id

Only Admin can change roles or deactivate users.


Postman Collection

A Postman collection is included in the repo. Import it and start testing the APIs.


About

Multi-tenant task management backend built with NestJS, PostgreSQL, and Sequelize. Supports organizations, projects, boards, tasks, comments, role-based access, and task assignment similar to Jira/Trello.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors