Skip to content

Repository files navigation

flowboard

flowboard is a backend project management system built with NestJS, Prisma, and PostgreSQL. It allows users to manage workspaces, projects, tasks, comments, and team roles through a secure REST API.

Features

  • User registration and login
  • JWT-based authentication
  • Protected routes using guards
  • Workspace management
  • Workspace member management
  • Role-based access control with OWNER, ADMIN, and MEMBER roles
  • Project management inside workspaces
  • Task management inside projects
  • Task filtering and pagination
  • Task assignment to workspace members
  • Comment system for tasks
  • Global error response formatting
  • Global success response formatting
  • Swagger API documentation
  • Prisma seed script for demo data
  • Unit and E2E testing setup

Tech Stack

  • NestJS
  • TypeScript
  • Prisma ORM
  • PostgreSQL
  • Neon Database
  • JWT
  • Passport
  • bcrypt
  • class-validator
  • class-transformer
  • Swagger
  • Jest
  • Supertest

Project Structure

src/
  auth/
    dto/
    guards/
    strategies/
    auth.controller.ts
    auth.service.ts
    auth.module.ts

  users/
    users.controller.ts
    users.service.ts
    users.module.ts

  workspaces/
    dto/
    workspaces.controller.ts
    workspaces.service.ts
    workspaces.module.ts

  projects/
    dto/
    projects.controller.ts
    projects.service.ts
    projects.module.ts

  tasks/
    dto/
    tasks.controller.ts
    tasks.service.ts
    tasks.module.ts

  comments/
    dto/
    comments.controller.ts
    comments.service.ts
    comments.module.ts

  prisma/
    prisma.service.ts
    prisma.module.ts

  common/
    decorators/
    filters/
    interceptors/
    selects/
    services/

  app.module.ts
  main.ts

Database Models

The main database models are:

  • User
  • Workspace
  • WorkspaceMember
  • Project
  • Task
  • Comment

Relationship overview:

User
  -> WorkspaceMember
  -> Workspace
  -> Project
  -> Task
  -> Comment

A workspace can have many members. A user can belong to many workspaces. This is handled through the WorkspaceMember table, which also stores the user's role inside each workspace.

Role Permissions

OWNER

Can:

  • Update workspace
  • Delete workspace
  • Add members
  • Remove members
  • Change member roles
  • Create, update, and delete projects
  • Create, update, and delete tasks
  • Delete comments

ADMIN

Can:

  • Add members
  • Create, update, and delete projects
  • Create, update, and delete tasks
  • Delete comments

MEMBER

Can:

  • View workspace data
  • View projects
  • Create and update tasks
  • Add comments
  • Delete their own comments

API Endpoints

Auth

POST /api/auth/register
POST /api/auth/login
GET  /api/auth/me

Workspaces

POST   /api/workspaces
GET    /api/workspaces
GET    /api/workspaces/:workspaceId
PATCH  /api/workspaces/:workspaceId
DELETE /api/workspaces/:workspaceId

Workspace Members

POST   /api/workspaces/:workspaceId/members
GET    /api/workspaces/:workspaceId/members
PATCH  /api/workspaces/:workspaceId/members/:memberId
DELETE /api/workspaces/:workspaceId/members/:memberId

Projects

POST   /api/workspaces/:workspaceId/projects
GET    /api/workspaces/:workspaceId/projects
GET    /api/projects/:projectId
PATCH  /api/projects/:projectId
DELETE /api/projects/:projectId

Tasks

POST   /api/projects/:projectId/tasks
GET    /api/projects/:projectId/tasks
GET    /api/tasks/:taskId
PATCH  /api/tasks/:taskId
DELETE /api/tasks/:taskId

Task filtering example:

GET /api/projects/:projectId/tasks?status=TODO&priority=HIGH&page=1&limit=10

Comments

POST   /api/tasks/:taskId/comments
GET    /api/tasks/:taskId/comments
DELETE /api/comments/:commentId

API Documentation

Swagger documentation is available at:

http://localhost:3000/api/docs

After logging in, copy the access token and use the Swagger Authorize button to test protected endpoints.

Environment Variables

Create a .env file in the project root:

DATABASE_URL="your_neon_pooled_database_url"
DIRECT_URL="your_neon_direct_database_url"

JWT_SECRET="your_jwt_secret"
JWT_EXPIRES_IN="7d"

Do not commit .env to GitHub.

Installation

npm install

Prisma Setup

Generate Prisma Client:

npx prisma generate

Run migrations:

npx prisma migrate dev

Seed the database:

npx prisma db seed

Running the App

Development mode:

npm run start:dev

Production build:

npm run build
npm run start:prod

Testing

Run unit tests:

npm run test

Run E2E tests:

npm run test:e2e

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages