Skip to content

naiih001/protask

Repository files navigation

ProTask

ProTask is a NestJS task-management API with JWT authentication, organization membership, project and task workflows, comments, invitations, activity logs, Prisma/PostgreSQL persistence, and Redis-backed queues.

Stack

  • NestJS 11
  • Prisma + PostgreSQL
  • Redis + BullMQ
  • Jest + ts-jest
  • Swagger at /docs

What the API supports

  • User signup, login, and refresh-token exchange
  • Organization creation, lookup, and member invitations
  • Project listing, creation, and soft deletion
  • Task listing with pagination and filters
  • Task creation, editing, status transitions, and soft deletion
  • Comment creation, listing, and deletion
  • Activity feed listing
  • Health checks for PostgreSQL and Redis

Requirements

  • Node.js
  • npm
  • PostgreSQL
  • Redis

The repository also includes a docker-compose.yml that starts the API, PostgreSQL, and Redis together.

Environment

Create .env from .env.example.

PORT=3000
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/protask?schema=public
REDIS_URL=redis://localhost:6379
JWT_ACCESS_SECRET=access-secret
JWT_REFRESH_SECRET=refresh-secret
JWT_ACCESS_TTL=15m
JWT_REFRESH_TTL_DAYS=7
APP_URL=http://localhost:3000
INVITATION_EXPIRY_HOURS=72

Local Development

Install dependencies and prepare Prisma:

npm install
npm run prisma:generate
npm run prisma:push

Start the API:

npm run start:dev

The server listens on http://localhost:3000 by default, and Swagger is available at http://localhost:3000/docs.

Docker

Run the full local stack:

docker compose up --build

The compose setup runs Prisma generation, pushes the schema, and starts the app in watch mode.

Deployment

The repository is set up for container-based deployment. The production Dockerfile now:

  • installs dependencies
  • generates the Prisma client
  • builds the NestJS app
  • starts the compiled server from dist/
  • runs prisma db push on container startup so the database schema is applied

Build and run the production image locally with:

docker build -t protask .
docker run --env-file .env -p 3000:3000 protask

Required deployment environment variables:

  • PORT
  • DATABASE_URL
  • REDIS_URL
  • JWT_ACCESS_SECRET
  • JWT_REFRESH_SECRET
  • JWT_ACCESS_TTL
  • JWT_REFRESH_TTL_DAYS
  • APP_URL
  • INVITATION_EXPIRY_HOURS

Any platform that can deploy a Docker container will work cleanly here, including Render, Railway, Fly.io, ECS, or a VPS.

Scripts

npm run build
npm run start:dev
npm run lint
npm run test
npm run test:cov
npm run test:e2e
npm run prisma:generate
npm run prisma:push

Main Routes

Authentication

  • POST /auth/signup
  • POST /auth/login
  • POST /auth/refresh

Users

  • GET /users/me
  • PATCH /users/me

Organizations and Invitations

  • POST /orgs
  • GET /orgs/:orgId
  • POST /orgs/:orgId/invite
  • POST /invites/accept/:token

Projects

  • GET /orgs/:orgId/projects
  • POST /orgs/:orgId/projects
  • DELETE /projects/:projectId

Tasks

  • GET /projects/:projectId/tasks
  • POST /projects/:projectId/tasks
  • PATCH /tasks/:taskId
  • PATCH /tasks/:taskId/status
  • DELETE /tasks/:taskId

Comments

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

Activity and Health

  • GET /orgs/:orgId/activity
  • GET /health

Testing

Unit tests run with:

npm run test -- --runInBand

The test:e2e command currently covers lightweight controller validation only. Full end-to-end coverage against live PostgreSQL and Redis is not wired into this repository yet.

About

ProTask is a NestJS task management API with JWT auth, multi-tenant organizations, projects, tasks, comments, activity logs, PostgreSQL via Prisma, and Redis-backed queues.

Topics

Resources

Stars

Watchers

Forks

Contributors