You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A real-time messaging backend inspired by Slack, built with Node.js, Express, Socket.io, MongoDB, BullMQ and Redis. This project demonstrates core backend concepts including WebSocket authentication, real-time communication, background job processing, and clean architecture patterns.
Note: This is a feature implementation showcasing key backend concepts, not a full Slack clone.
Features
Authentication & Authorization
JWT-based authentication for REST APIs
Socket.io connection authentication via JWT handshake
Role-based access control (Admin/Member) for workspaces
Real-Time Messaging (Socket.io)
Channel Messages — Send and receive messages in workspace channels
Direct Messages — Private 1:1 conversations between users
Typing Indicators — Real-time typing status for channels and DMs
Auto-Join Rooms — Users automatically join all their channels/DM rooms on connection (Slack-like behavior)
Workspace Management
Create workspaces with unique join codes
Add members with role assignment
Create channels within workspaces
Workspace-scoped messaging
Background Job Processing (BullMQ + Redis)
Asynchronous email delivery via job queue
Retry mechanism with exponential backoff (3 attempts)
Job monitoring via Bull Board dashboard (/admin/queues)
API Design
RESTful API with versioning (/api/v1)
Request validation using Zod schemas
Centralized error handling with custom error classes
Client connects with JWT token
│
▼
┌─────────────────────────────────┐
│ Socket Auth Middleware │
│ - Validates JWT │
│ - Attaches user to socket │
└─────────────────────────────────┘
│
▼
┌─────────────────────────────────┐
│ Auto-Join Rooms │
│ - Fetches user's workspaces │
│ - Joins all channel rooms │
│ - Joins all DM conversation │
│ rooms │
└─────────────────────────────────┘
│
▼
User receives messages from
ALL their channels & DMs
Message Flow
User A sends message
│
▼
┌─────────────────────────────────┐
│ Validate with Zod │
│ Save to MongoDB │
│ Broadcast to Socket.io room │
└─────────────────────────────────┘
│
▼
All users in channel/DM
receive the message instantly