Skip to content

mddanishh18/CollabFlow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

21 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CollabFlow πŸš€

A modern, real-time team collaboration platform built with the MERN stack, featuring instant messaging, project management, and seamless team coordination.

Live Demo TypeScript Next.js MongoDB Socket.io

Live Demo: collabflow-web.vercel.app


πŸ“‹ Table of Contents


✨ Features

πŸ” Authentication & Authorization

  • JWT-based secure authentication
  • Role-based access control (Owner, Admin, Member, Viewer)
  • Password encryption with bcrypt
  • Protected routes and API endpoints
  • Session management with automatic token refresh

πŸ’¬ Real-Time Chat

  • Instant messaging with Socket.io WebSockets
  • Channel-based communication (Public, Private, Direct Messages)
  • Read receipts with timestamps
  • Unread message counts with real-time updates
  • Typing indicators showing who's typing
  • Message editing & deletion with optimistic updates
  • @mentions for user notifications
  • Mobile-optimized chat interface with sticky headers

πŸ‘₯ Workspace & Team Management

  • Create and manage multiple workspaces
  • Invite team members via email
  • Role-based permissions (Owner β†’ Admin β†’ Member β†’ Viewer)
  • Member management with role updates
  • Workspace settings and customization

πŸ“Š Project Management

  • Create and organize projects within workspaces
  • Assign team members to projects
  • Project-specific permissions
  • Task tracking and management
  • Project settings and configuration

βœ… Task Management

  • Create, assign, and track tasks
  • Task priorities (Low, Medium, High, Urgent)
  • Task status tracking (To Do, In Progress, In Review, Done)
  • Due dates and deadlines
  • Task assignment to team members
  • Real-time task updates

🎨 Modern UI/UX

  • Responsive design - Mobile, tablet, and desktop optimized
  • Dark/Light mode with system preference detection
  • Shadcn UI components for consistent design
  • Smooth animations and transitions
  • Loading states and skeleton screens
  • Toast notifications for user feedback
  • Mobile-first approach with hamburger navigation

πŸ”” Real-Time Features

  • Live connection status indicator
  • Automatic reconnection on network issues
  • Real-time presence detection
  • Instant updates across all connected clients
  • Optimistic UI updates for better UX

πŸ› οΈ Tech Stack

Frontend

  • Framework: Next.js 15 (App Router, React Server Components)
  • Language: TypeScript 5.0
  • Styling: Tailwind CSS v4
  • UI Components: Shadcn UI
  • State Management: Zustand
  • Real-time: Socket.io Client
  • Form Validation: Zod
  • HTTP Client: Fetch API with custom wrapper
  • Deployment: Vercel

Backend

  • Runtime: Node.js with Express.js
  • Language: TypeScript
  • Database: MongoDB with Mongoose ODM
  • Authentication: JWT (jsonwebtoken)
  • Real-time: Socket.io Server
  • Security: Helmet, CORS, bcryptjs
  • Rate Limiting: express-rate-limit
  • Deployment: Render / Railway

DevOps & Tools

  • Version Control: Git & GitHub
  • Package Manager: npm
  • Code Quality: ESLint, Prettier
  • Environment: dotenv for configuration
  • Build Tool: Next.js Turbopack

πŸ—οΈ Architecture

System Design

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Client    │◄───────►│   Server    │◄───────►│  Database   β”‚
β”‚  (Next.js)  β”‚  HTTP   β”‚  (Express)  β”‚  ODM    β”‚  (MongoDB)  β”‚
β”‚             β”‚  REST   β”‚             β”‚ Mongooseβ”‚             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚                       β”‚
       β”‚    WebSocket          β”‚
       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
            (Socket.io)

Key Architectural Decisions

  • Monorepo structure for frontend and backend
  • RESTful API for CRUD operations
  • WebSocket for real-time features
  • JWT tokens stored in memory (not localStorage for security)
  • Optimistic updates for instant UI feedback
  • Server-side validation with Zod schemas
  • Role-based middleware for authorization

πŸš€ Getting Started

Prerequisites

  • Node.js 18+ and npm
  • MongoDB (local or Atlas)
  • Git

Installation

  1. Clone the repository
git clone https://github.com/mddanishh18/CollabFlow.git
cd CollabFlow
  1. Backend Setup
cd backend
npm install

# Create .env file
cp .env.example .env
# Edit .env with your MongoDB URI and JWT secret

# Start backend server
npm run dev

Backend runs on http://localhost:5000

  1. Frontend Setup
cd frontend
npm install

# Create .env.local file
echo "NEXT_PUBLIC_API_URL=http://localhost:5000" > .env.local
echo "NEXT_PUBLIC_SOCKET_URL=http://localhost:5000" >> .env.local

# Start frontend dev server
npm run dev

Frontend runs on http://localhost:3000

Environment Variables

Backend (.env)

NODE_ENV=development
PORT=5000
MONGODB_URI=mongodb://localhost:27017/collabflow
JWT_SECRET=your_super_secret_key_change_this
JWT_EXPIRES_IN=7d
CLIENT_URL=http://localhost:3000

Frontend (.env.local)

NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_SOCKET_URL=http://localhost:5000

πŸ“Έ Screenshots

Dashboard

Dashboard

Real-Time Chat

Chat

Project Management

Projects

Mobile Responsive

Mobile


🎯 Key Highlights (For Recruiters)

Technical Proficiency Demonstrated

βœ… Full-Stack Development

  • Built complete MERN stack application from scratch
  • Implemented both frontend and backend with TypeScript
  • Designed and implemented RESTful APIs
  • Created responsive, mobile-first UI

βœ… Real-Time Systems

  • Implemented WebSocket communication with Socket.io
  • Built real-time chat with typing indicators and read receipts
  • Handled connection management and reconnection logic
  • Optimized for low latency and high concurrency

βœ… Database Design

  • Designed MongoDB schemas with Mongoose
  • Implemented relationships (users, workspaces, projects, tasks, messages)
  • Optimized queries with indexing
  • Handled data validation and constraints

βœ… Authentication & Security

  • Implemented JWT-based authentication
  • Built role-based access control (RBAC)
  • Secured API endpoints with middleware
  • Applied security best practices (Helmet, CORS, rate limiting)

βœ… State Management

  • Managed complex application state with Zustand
  • Implemented optimistic UI updates
  • Handled real-time state synchronization
  • Built custom hooks for reusable logic

βœ… Modern Frontend Practices

  • Used Next.js 15 App Router and React Server Components
  • Implemented TypeScript for type safety
  • Built reusable component library with Shadcn UI
  • Optimized for performance and SEO

βœ… Mobile Responsiveness

  • Mobile-first design approach
  • Fixed complex mobile keyboard issues (iOS/Android)
  • Implemented touch-friendly interactions
  • Optimized for various screen sizes

βœ… DevOps & Deployment

  • Deployed frontend on Vercel with CI/CD
  • Deployed backend on Render/Railway
  • Configured environment variables
  • Implemented production-ready error handling

Problem-Solving Examples

Challenge 1: Mobile Chat Keyboard Issues

  • Problem: Keyboard caused viewport shifting and scroll jumping on mobile
  • Solution: Implemented interactive-widget=resizes-content meta tag, sticky headers, and conditional refocus logic
  • Impact: Seamless mobile chat experience across iOS and Android

Challenge 2: Real-Time Read Receipts

  • Problem: Needed to track who read each message in group chats
  • Solution: Built Socket.io event system with optimistic updates and database persistence
  • Impact: WhatsApp-like read receipt functionality

Challenge 3: Role-Based Permissions

  • Problem: Complex permission hierarchy across workspaces and projects
  • Solution: Implemented middleware-based RBAC with cascading permissions
  • Impact: Secure, scalable authorization system

πŸ“‚ Project Structure

CollabFlow/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/           # Database & environment config
β”‚   β”‚   β”œβ”€β”€ controllers/      # Business logic (auth, workspace, chat, etc.)
β”‚   β”‚   β”œβ”€β”€ middleware/       # Auth, error handling, validation
β”‚   β”‚   β”œβ”€β”€ models/           # Mongoose schemas (User, Workspace, Message, etc.)
β”‚   β”‚   β”œβ”€β”€ routes/           # Express routes
β”‚   β”‚   β”œβ”€β”€ sockets/          # Socket.io event handlers
β”‚   β”‚   β”œβ”€β”€ utils/            # Helper functions (JWT, logger, etc.)
β”‚   β”‚   β”œβ”€β”€ app.ts            # Express app configuration
β”‚   β”‚   └── server.ts         # Server entry point
β”‚   β”œβ”€β”€ package.json
β”‚   └── tsconfig.json
β”‚
└── frontend/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ app/              # Next.js App Router pages
    β”‚   β”‚   β”œβ”€β”€ (auth)/       # Auth pages (login, register)
    β”‚   β”‚   β”œβ”€β”€ (dashboard)/  # Protected dashboard pages
    β”‚   β”‚   └── layout.tsx    # Root layout
    β”‚   β”œβ”€β”€ components/       # React components
    β”‚   β”‚   β”œβ”€β”€ auth/         # Auth forms
    β”‚   β”‚   β”œβ”€β”€ chat/         # Chat components
    β”‚   β”‚   β”œβ”€β”€ project/      # Project management
    β”‚   β”‚   β”œβ”€β”€ task/         # Task components
    β”‚   β”‚   β”œβ”€β”€ workspace/    # Workspace components
    β”‚   β”‚   └── ui/           # Shadcn UI components
    β”‚   β”œβ”€β”€ hooks/            # Custom React hooks
    β”‚   β”œβ”€β”€ lib/              # Utilities & API client
    β”‚   β”œβ”€β”€ store/            # Zustand stores
    β”‚   └── types/            # TypeScript types
    β”œβ”€β”€ package.json
    └── tsconfig.json

πŸ“‘ API Documentation

Authentication

  • POST /api/auth/register - Register new user
  • POST /api/auth/login - Login user
  • GET /api/auth/me - Get current user

Workspaces

  • GET /api/workspaces - Get user's workspaces
  • POST /api/workspaces - Create workspace
  • GET /api/workspaces/:id - Get workspace details
  • PUT /api/workspaces/:id - Update workspace
  • DELETE /api/workspaces/:id - Delete workspace
  • POST /api/workspaces/:id/members - Add member
  • DELETE /api/workspaces/:id/members/:userId - Remove member

Projects

  • GET /api/projects - Get workspace projects
  • POST /api/projects - Create project
  • GET /api/projects/:id - Get project details
  • PUT /api/projects/:id - Update project
  • DELETE /api/projects/:id - Delete project

Tasks

  • GET /api/tasks - Get project tasks
  • POST /api/tasks - Create task
  • PUT /api/tasks/:id - Update task
  • DELETE /api/tasks/:id - Delete task

Chat

  • GET /api/chat/channels/:workspaceId - Get workspace channels
  • POST /api/chat/channels - Create channel
  • GET /api/chat/messages/:channelId - Get channel messages
  • POST /api/chat/messages - Send message
  • PUT /api/chat/messages/:id - Edit message
  • DELETE /api/chat/messages/:id - Delete message

WebSocket Events

  • connection - Client connects
  • join_channel - Join chat channel
  • leave_channel - Leave chat channel
  • send_message - Send chat message
  • typing_start - User starts typing
  • typing_stop - User stops typing
  • message_read - Mark message as read

πŸ“„ License

This project is licensed under the MIT License.


πŸ‘¨β€πŸ’» Developer

Danish


πŸ™ Acknowledgments


⭐ If you found this project helpful, please consider giving it a star!

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages