Skip to content

nancysangani/collabboard-realtime

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

23 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CollabBoard β€” Full Stack Real-time Project Management

A production-ready Kanban board with real-time collaboration, JWT auth, RBAC, Socket.io, bcrypt, and MongoDB Atlas.

License: MIT Node.js React


πŸŽ₯ Demo

Live Demo: https://collabboard-realtime-nwpq.onrender.com

Test Account:

  • Email: admin@gmail.com
  • Password: Admin@123

Tech Stack

Layer Tech
Frontend React 18, Vite, React Router v6
Drag & Drop @hello-pangea/dnd
Real-time Socket.io (client + server)
HTTP client Axios
Backend Node.js, Express
Auth JWT (jsonwebtoken) + bcryptjs
Access Control Role-based (Admin / Manager / Developer)
Database MongoDB Atlas (Mongoose)
Env vars dotenv
Notifications react-hot-toast
Icons lucide-react

🎯 Key Highlights

βœ… Real-time Collaboration β€” Socket.io room-based broadcasting for instant card sync across all connected users
βœ… Role-Based Access Control (RBAC) β€” 3 roles (Admin/Manager/Developer) with middleware-enforced permissions on 12+ endpoints
βœ… Optimistic UI + Server Reconciliation β€” Drag-and-drop with instant client feedback, no blocking on server updates
βœ… Secure Authentication β€” JWT (7-day expiry) + bcrypt password hashing (12 salt rounds)
βœ… MongoDB Relational Data β€” Mongoose with populated references (User β†’ Project β†’ Board β†’ Card)
βœ… Production Deployment β€” Docker containerized, deployed on Render, environment-based configuration
βœ… Error Handling & UX β€” Session expiry detection, auto-redirect, toast notifications, form validation
βœ… Scalable Architecture β€” Modular folder structure, separated concerns (routes, middleware, models, socket handlers)


Folder Structure

collabboard/
β”œβ”€β”€ server/
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── db.js                  # MongoDB Atlas connection
β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   └── auth.js                # JWT protect + RBAC authorize
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ User.js
β”‚   β”‚   β”œβ”€β”€ Project.js
β”‚   β”‚   β”œβ”€β”€ Board.js
β”‚   β”‚   └── Card.js
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ auth.routes.js         # register, login, /me
β”‚   β”‚   β”œβ”€β”€ project.routes.js      # CRUD projects + boards
β”‚   β”‚   └── card.routes.js         # CRUD cards + reorder
β”‚   β”œβ”€β”€ socket/
β”‚   β”‚   └── boardSocket.js         # All Socket.io event handlers
β”‚   β”œβ”€β”€ .env                       # ← fill in your secrets
β”‚   β”œβ”€β”€ index.js                   # Entry point
β”‚   └── package.json
β”‚
└── client/
    β”œβ”€β”€ src/
    β”‚   β”œβ”€β”€ context/
    β”‚   β”‚   β”œβ”€β”€ AuthContext.jsx     # Global user + token state
    β”‚   β”‚   └── SocketContext.jsx   # Global socket connection
    β”‚   β”œβ”€β”€ hooks/
    β”‚   β”‚   └── useBoard.js        # Cards state + socket sync
    β”‚   β”œβ”€β”€ services/
    β”‚   β”‚   └── api.js             # Axios instance + all API calls
    β”‚   β”œβ”€β”€ pages/
    β”‚   β”‚   β”œβ”€β”€ AuthPage.jsx       # Login + Register
    β”‚   β”‚   β”œβ”€β”€ DashboardPage.jsx  # All projects
    β”‚   β”‚   └── ProjectPage.jsx    # Single project + boards
    β”‚   β”œβ”€β”€ components/
    β”‚   β”‚   β”œβ”€β”€ Board/
    β”‚   β”‚   β”‚   β”œβ”€β”€ KanbanBoard.jsx    # DragDropContext
    β”‚   β”‚   β”‚   β”œβ”€β”€ KanbanColumn.jsx   # Droppable column
    β”‚   β”‚   β”‚   └── KanbanCard.jsx     # Draggable card
    β”‚   β”‚   β”œβ”€β”€ Layout/
    β”‚   β”‚   β”‚   └── Navbar.jsx
    β”‚   β”‚   └── UI/
    β”‚   β”‚       └── ProtectedRoute.jsx
    β”‚   β”œβ”€β”€ App.jsx
    β”‚   β”œβ”€β”€ main.jsx
    β”‚   └── index.css
    β”œβ”€β”€ .env
    └── package.json

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • Docker & Docker Compose (optional)
  • MongoDB Atlas account

Option 1: Quick Start with Docker (Recommended)

# Backend + MongoDB (in one command)
docker-compose up

# Frontend (in another terminal)
cd client
npm run dev

Visit: http://localhost:5173

Option 2: Manual Setup

Step 1: MongoDB Atlas

  1. Go to https://cloud.mongodb.com β†’ Create free cluster
  2. Create a database user (username + password)
  3. Whitelist your IP (or use 0.0.0.0/0 for dev)
  4. Copy the connection string

Step 2: Server Setup

cd server
npm install

Create server/.env:

PORT=5000
MONGO_URI=mongodb+srv://<user>:<password>@cluster0.mongodb.net/collabboard?retryWrites=true&w=majority
JWT_SECRET=your_super_secret_key_minimum_32_chars
JWT_EXPIRES_IN=7d
CLIENT_URL=http://localhost:5173
npm run dev    # starts with nodemon on port 5000

Step 3: Client Setup

cd client
npm install
npm run dev    # starts on port 5173

Visit: http://localhost:5173

Roles on First Login

  • Register as Admin to create projects
  • Register as Manager to manage cards
  • Register as Developer to create and view cards

RBAC Permissions

Action Admin Manager Developer
Create/delete projects βœ… ❌ ❌
Create boards βœ… βœ… ❌
Create cards βœ… βœ… βœ…
Edit any card βœ… βœ… ❌
Delete cards βœ… βœ… ❌
Assign cards βœ… βœ… ❌

Socket.io Events

Event Direction Description
board:join client β†’ server Join a board room
board:leave client β†’ server Leave a board room
card:move client β†’ server Card dragged to new column
card:moved server β†’ clients Broadcast move to others
card:update client β†’ server Card content updated
card:updated server β†’ clients Broadcast update to others
card:created client β†’ server New card created
card:deleted client β†’ server Card deleted
cards:reordered client β†’ server Bulk reorder after drag
user:joined server β†’ clients User joined the board
user:left server β†’ clients User disconnected

API Endpoints

Auth

Method Route Access
POST /api/auth/register Public
POST /api/auth/login Public
GET /api/auth/me Protected

Projects

Method Route Access
GET /api/projects Protected
POST /api/projects Admin only
GET /api/projects/:id Protected
DELETE /api/projects/:id Admin only
GET /api/projects/:id/boards/:boardId/cards Protected

Cards

Method Route Access
POST /api/cards Protected
PATCH /api/cards/:id Protected
DELETE /api/cards/:id Admin / Manager
PATCH /api/cards/reorder/bulk Protected

πŸ” Security

  • Passwords hashed using bcrypt
  • JWT stored securely on client
  • Environment variables protected via .env
  • Sensitive data excluded via .gitignore

πŸ“Œ Future Improvements

  • Add unit & integration tests
  • Implement notifications (email / in-app)
  • Add file attachments to cards
  • Improve mobile responsiveness

🐳 Production Deployment

Docker Build

Build image:

docker build -t collabboard .

Run with environment file:

docker run -p 5000:5000 --env-file .env.production collabboard

Or pass variables directly:

docker run -p 5000:5000 \
  -e NODE_ENV=production \
  -e MONGO_URI=mongodb+srv://user:pass@cluster.mongodb.net/collabboard \
  -e JWT_SECRET=your_secret_key \
  -e JWT_EXPIRES_IN=7d \
  -e CLIENT_URL=https://your-domain.com \
  collabboard

Deploy to Render.com

  1. Push code to GitHub
  2. Create new service on Render.com
  3. Connect your GitHub repository
  4. Set environment variables:
    NODE_ENV=production
    MONGO_URI=<your_mongodb_uri>
    JWT_SECRET=<32_char_secret>
    JWT_EXPIRES_IN=7d
    CLIENT_URL=<your_render_url>
    PORT=5000
    
  5. Deploy!

The app automatically serves:

  • React frontend from /
  • API endpoints from /api/*
  • Static files with proper caching

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

About

CollabBoard is a full-stack real-time project management tool. The frontend is built with React (Vite) and communicates with a Node.js + Express backend. MongoDB Atlas is used for persistence, JWT handles authentication, RBAC manages permissions, and Socket.IO enables real-time collaboration on boards.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages