Go back to projects

Collabix Backend

The real-time API powering Collabix, a team collaboration platform (workspaces, projects, tasks, chat, notifications). Built with NestJS and Clean Architecture, with live updates over Socket.IO.

FrameworkNestJS
Use CaseSaaS Platform
DeploymentDocker / VPS
Collabix Backend

📋 Overview

Collabix API is the NestJS backend powering Collabix, a real-time team collaboration platform structured around a Workspace → Project → Task hierarchy. Built with Clean Architecture (domain, application, infrastructure, and presentation layers), it exposes a REST API plus five Socket.IO gateways — chat, tasks, presence, notifications, and activity — so the frontend gets live updates without polling or manual refreshes.

✨ Features

  • JWT auth (access + refresh) with email verification, Google & GitHub OAuth
  • Workspace → Project → Task hierarchy with role-based access (OWNER/ADMIN/MEMBER)
  • Real-time chat with typing indicators and threaded conversations (Socket.IO)
  • Live in-app notifications with unread counts pushed over WebSocket
  • Online/offline presence broadcast per workspace & project
  • Threaded task comments with cursor pagination
  • Full activity feed / audit trail at workspace, project & task scope
  • Manager promotion requests reviewed by admins
  • Admin, workspace & project overview dashboards with aggregate stats
  • Cloudinary avatar & file uploads
  • Redis-backed caching and refresh token storage
  • Rate limiting on auth routes, Swagger/OpenAPI docs, Dockerized for dev & deploy

🛠️ Technologies Used

NestJSTypeScriptPostgreSQLTypeORMRedisSocket.IOPassport.jsJWTCloudinaryNodemailerSwagger / OpenAPIDockerJest

📋 Prerequisites

  • Node.js (v18+)
  • npm
  • Docker & Docker Compose

💡 Usage

Run the API, then browse the interactive Swagger UI to explore every REST route. Connect a Socket.IO client with { auth: { token: accessToken } } to the /chat, /tasks, /presence, /notifications, or /activity namespaces for live updates.

🚀 Deployment

  1. Provision PostgreSQL & Redis (Docker Compose)
  2. Build the production image from the provided Dockerfile
  3. Configure environment variables
  4. Run the container on the server

🔐 Environment Variables

VariableDescriptionExample
NODE_ENVRuntime environmentdevelopment
APP_PORTPort the API listens on5000
FRONTEND_URLFrontend app URL (CORS, email links)http://localhost:3000
BACKEND_URLBackend's own public URLhttp://localhost:5000
DATABASE_HOSTPostgreSQL hostlocalhost
DATABASE_PORTPostgreSQL port5432
DATABASE_USERNAMEPostgreSQL usernamepostgres
DATABASE_PASSWORDPostgreSQL passwordyour_password
DATABASE_NAMEPostgreSQL database namedb_name
REDIS_HOSTRedis hostlocalhost
REDIS_PORTRedis port6379
JWT_ACCESS_TOKEN_SECRETSecret for signing access tokensyour_access_token_secret
JWT_ACCESS_TOKEN_EXPIRES_INAccess token lifetime15m
JWT_REFRESH_TOKEN_SECRETSecret for signing refresh tokensyour_refresh_token_secret
JWT_REFRESH_TOKEN_EXPIRES_INRefresh token lifetime7d
JWT_RESET_PASSWORD_SECRETSecret for password-reset tokensyour_reset_password_secret
JWT_RESET_PASSWORD_EXPIRES_INPassword-reset token lifetime1h
MAIL_HOSTSMTP hostsmtp.gmail.com
MAIL_PORTSMTP port587
MAIL_USERSMTP usernameyour_email@gmail.com
MAIL_PASSWORDSMTP password / app passwordyour_app_password
MAIL_FROMFrom address for transactional emailnoreply@example.com
GOOGLE_CLIENT_IDGoogle OAuth client IDyour_google_client_id
GOOGLE_CLIENT_SECRETGoogle OAuth client secretyour_google_client_secret
GOOGLE_CALLBACK_URLGoogle OAuth callback URLhttp://localhost:5000/auth/oauth/google/callback
GITHUB_CLIENT_IDGitHub OAuth client IDyour_github_client_id
GITHUB_CLIENT_SECRETGitHub OAuth client secretyour_github_client_secret
GITHUB_CALLBACK_URLGitHub OAuth callback URLhttp://localhost:5000/auth/oauth/github/callback
CLOUDINARY_CLOUD_NAMECloudinary cloud nameyour_cloud_name
CLOUDINARY_API_KEYCloudinary API keyyour_api_key
CLOUDINARY_API_SECRETCloudinary API secretyour_api_secret
USER_PASSWORD_MIN_LENGTHMinimum password length policy8
USER_PASSWORD_REQUIRE_UPPERCASERequire an uppercase charactertrue
USER_PASSWORD_REQUIRE_LOWERCASERequire a lowercase charactertrue
USER_PASSWORD_REQUIRE_NUMBERRequire a numbertrue
USER_PASSWORD_REQUIRE_SPECIALRequire a special charactertrue

📝 Notes

Full REST + WebSocket contract (every route, payload shape, and enum) lives in the project's API_REFERENCE.md, with feature deep-dives on chat, presence, notifications, activity, and invitations in its docs/ folder.