A real-time collaborative whiteboard application where teams can brainstorm, draw, and work together in shared virtual spaces. Built with Next.js, Node.js, Socket.IO, MongoDB, Redis, and RabbitMQ.
Idea Room is a full-stack collaborative whiteboard platform that enables real-time multi-user collaboration. Users can create rooms, draw freehand strokes, add shapes, text, images, and nodes, all synchronized in real-time across all connected clients.
- Real-time Collaboration: Multiple users can work simultaneously with live cursor tracking
- Rich Drawing Tools: Freehand drawing, shapes (rectangles, circles, triangles, diamonds, parallelogram, hexagon, cloud), arrows/edges, text, images
- Room Management: Create, join, and manage collaborative rooms
- User Authentication: Firebase Authentication for secure access
- Persistent Storage: MongoDB for long-term data persistence, Redis for hot caching
- Event-Driven Architecture: RabbitMQ for asynchronous event processing
- Undo/Redo: Full history tracking for collaborative editing
- Pan & Zoom: Navigate large canvases with smooth panning and zooming
- Minimap: Visual overview of the entire canvas
- Export Whiteboard: Download the canvas as PNG or JPEG (via
html2canvas, with a safe color pipeline for modern CSSlab/oklchso exports donβt crash) - Idle Cursor Hint: After 30 seconds without input, a subtle non-interactive ring appears at the last pointer position (does not block drawing)
- Dashboard Network Status: Live online/offline, Network Information API (effective-type, downlink, RTT when available), and API latency via
GET /healthpolling with a small history sparkline - AI Chat (Room): Side panel chat; messages prefixed with
@aican attach a screenshot of the board for context (JPEG, client-side capture)
- Framework: Next.js 16.1.1 (React 19.2.3)
- Styling: Tailwind CSS 4
- Real-time: Socket.IO Client
- UI Components: HeroUI (buttons, dropdowns, toolbars), Framer Motion (home dashboard)
- Canvas export: html2canvas +
app/lib/html2canvasSafe.js(normalizes colors for the library) - Authentication: Firebase Client SDK
-
API Gateway (Port 5000)
- RESTful API for room management
- Firebase token verification
- MongoDB integration for room data
-
Auth Service (Port 8003)
- Token verification endpoint
- Firebase Admin SDK integration
-
Collab Service (Port 4000)
- Socket.IO server for real-time collaboration
- Redis for hot state caching
- MongoDB for persistence
- RabbitMQ for event publishing
-
Snapshot Worker
- Background worker processing room events
- Creates periodic snapshots from RabbitMQ events
- Stores snapshots in MongoDB
- MongoDB: Primary database for rooms and snapshots
- Redis: Hot cache for active room states
- RabbitMQ: Message queue for event processing
IdeaRoom/
βββ backend/
β βββ api-gateway/ # REST API service
β β βββ routes/ # API routes
β β βββ middleware/ # Auth middleware
β β βββ store/ # Data access layer
β β βββ Dockerfile
β βββ auth-service/ # Authentication service
β β βββ Dockerfile
β βββ collab-service/ # Real-time collaboration service
β β βββ db.js # MongoDB connection
β β βββ redis.js # Redis client
β β βββ rabbit.js # RabbitMQ client
β β βββ Dockerfile
β βββ snapshot-worker/ # Background worker
β βββ Dockerfile
βββ frontend/ # Next.js application
β βββ app/
β β βββ auth/ # Authentication page
β β βββ room/[id]/ # Whiteboard room (dynamic)
β β βββ lib/ # api.js, socket.js, html2canvasSafe.js
β β βββ page.js # Home / dashboard
β β βββ layout.js
β β βββ globals.css
β βββ components/ # RoomChat.js, BackgroundAnimation.js, β¦
β βββ context/ # Auth (AuthContext)
β βββ lib/ # firebase.js (client config)
β βββ Dockerfile
βββ docker-compose.yml # Docker orchestration
βββ .env # Environment variables (create this)
For production with MongoDB Atlas, Upstash Redis, Railway RabbitMQ, Railway (backend), and Vercel (frontend), see DEPLOYMENT.md. It covers:
- Where to get each URL (Atlas, Upstash, Railway RabbitMQ, Firebase)
- Step-by-step backend deploy on Railway (api-gateway, auth-service, collab-service, snapshot-worker)
- Frontend deploy on Vercel and which variables to set
- A βWhere to put each URLβ table and a deployment checklist
- Docker and Docker Compose installed
- Firebase project with Authentication enabled
- Firebase Service Account credentials
git clone <repository-url>
cd IdeaRoom- Create a Firebase project at Firebase Console
- Enable Authentication (Google provider recommended)
- Go to Project Settings β Service Accounts
- Generate a new private key (JSON file)
- Extract the following from the JSON:
project_idclient_emailprivate_key
Create a .env file in the idea-room/ directory (same level as docker-compose.yml):
# Firebase Configuration
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_CLIENT_EMAIL=your-client-email@your-project.iam.gserviceaccount.com
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYour\nPrivate\nKey\nHere\n-----END PRIVATE KEY-----\n"Important Notes:
- The
FIREBASE_PRIVATE_KEYmust be wrapped in quotes - Include the
\ncharacters (or use actual newlines) - Include the full key with
-----BEGIN PRIVATE KEY-----and-----END PRIVATE KEY-----markers
Update frontend/lib/firebase.js with your Firebase web app configuration (or use env-based config if you add it):
const firebaseConfig = {
apiKey: "your-api-key",
authDomain: "your-project.firebaseapp.com",
projectId: "your-project-id",
// ... other config
};# Build and start all services
docker-compose up --build
# Or run in detached mode (background)
docker-compose up --build -d- Frontend: http://localhost:3000
- API Gateway: http://localhost:5000
- Auth Service: http://localhost:8003
- Collab Service: http://localhost:4000 (Socket.IO)
- RabbitMQ Management UI: http://localhost:15672 (username:
guest, password:guest)
All backend services receive environment variables from:
.envfile (viaenv_filein docker-compose.yml)- Explicit
environmentsection in docker-compose.yml
API Gateway:
MONGO_URL: MongoDB connection string (default:mongodb://mongodb:27017)FIREBASE_PROJECT_ID: Firebase project IDFIREBASE_CLIENT_EMAIL: Firebase service account emailFIREBASE_PRIVATE_KEY: Firebase private keyNODE_ENV: Environment mode (production/development)
Collab Service:
MONGO_URL: MongoDB connection stringREDIS_URL: Redis connection string (default:redis://redis:6379)RABBITMQ_URL: RabbitMQ connection string (default:amqp://rabbitmq)API_GATEWAY_URL: API Gateway URL for internal calls (default:http://api-gateway:5000)FIREBASE_PROJECT_ID,FIREBASE_CLIENT_EMAIL,FIREBASE_PRIVATE_KEY: Firebase credentialsNODE_ENV: Environment mode
Snapshot Worker:
MONGO_URL: MongoDB connection stringRABBITMQ_URL: RabbitMQ connection stringNODE_ENV: Environment mode
Frontend:
NEXT_PUBLIC_API_BASE: API Gateway URL (default:http://localhost:5000) β used for REST calls and dashboard health / latency checks (GET /health)NEXT_PUBLIC_COLLAB_BASE: Collab/Socket.IO server URL (default:http://localhost:4000)NODE_ENV: Environment mode
SEO / indexing: The frontend does not set noindex by default. Add robots metadata in app/layout.js if you need to block crawlers in production.
- Docker Compose reads the
.envfile from theidea-room/directory - Services receive variables through:
env_file: - .env(loads all variables from.env)environment:section (explicit variables with fallback values)
- In Docker containers, services use environment variables directly (no
.envfile loading needed) - For local development (without Docker), services use
dotenvto load.envfiles
- mongodb: MongoDB 7 database
- redis: Redis 7 cache
- rabbitmq: RabbitMQ 3 with management UI
- api-gateway: REST API service
- auth-service: Authentication service
- collab-service: Real-time collaboration service
- snapshot-worker: Background event processor
- frontend: Next.js frontend application
All services are connected via a Docker bridge network (idea-room-network) and have health checks configured.
If you want to run services locally for development:
-
Start Infrastructure:
# MongoDB mongod # Redis redis-server # RabbitMQ rabbitmq-server
-
Backend Services:
cd backend/api-gateway npm install npm start cd ../auth-service npm install npm start cd ../collab-service npm install npm start cd ../snapshot-worker npm install node index.js
-
Frontend:
cd frontend npm install npm run dev
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f api-gateway
docker-compose logs -f collab-service
docker-compose logs -f frontend# Stop all services
docker-compose down
# Stop and remove volumes (clean slate)
docker-compose down -v- Firebase private keys should never be committed to version control
- The
.envfile is in.gitignore(ensure it's not committed) - In production, use Docker secrets or a secrets management service
- Ensure MongoDB, Redis, and RabbitMQ are not exposed to the public internet in production
- User creates/joins room: Frontend β API Gateway β MongoDB
- Real-time updates: Frontend β Collab Service (Socket.IO) β Redis (hot cache)
- Persistence: Collab Service β MongoDB (when user leaves)
- Event processing: Collab Service β RabbitMQ β Snapshot Worker β MongoDB
-
Check if ports are already in use:
# Windows netstat -ano | findstr :3000 # Linux/Mac lsof -i :3000
-
Check Docker logs:
docker-compose logs <service-name>
- Verify Firebase credentials in
.envfile - Check API Gateway logs:
docker-compose logs api-gateway - Ensure MongoDB is healthy:
docker-compose ps mongodb
- Check Collab Service logs:
docker-compose logs collab-service - Verify Redis connection:
docker-compose exec redis redis-cli ping - Check Socket.IO connection in browser console
- Verify services are on the same Docker network
- Check MongoDB health:
docker-compose exec mongodb mongosh --eval "db.adminCommand('ping')" - Ensure environment variables are correctly set
API Gateway (http://localhost:5000)
GET /health- Health checkGET /room/:id- Get room detailsPOST /room- Create room (requires auth token)GET /room/my- Get user's rooms (requires auth token)DELETE /room/:id- Delete room (requires auth token)
Auth Service (http://localhost:8003)
GET /- Health checkPOST /verify- Verify Firebase token
- Freehand Drawing: Smooth stroke rendering (perfect-freehand) with optional dashed/dotted styles
- Shapes: Rectangle, circle, triangle, diamond, parallelogram, hexagon, cloud, and more
- Edges / Arrows: Connect nodes with rough edges
- Text: Editable text boxes with formatting
- Images: Upload and place images on canvas
- Eraser: Remove any object by clicking on it
- Export: Top bar Export β PNG or JPEG (captures
#canvas-container; useshtml2canvasSafeso modern CSS colors donβt break the exporter)
- Real-time Sync: All changes sync instantly across clients
- Cursor Tracking: See other users' cursors in real-time
- User Presence: View active users in the room
- Join Requests: Non-owners must request permission to join
- Pan & Zoom: Navigate large canvases
- Minimap: Overview of entire canvas
- Selection: Multi-select objects with selection box
- Group Operations: Move, resize, delete multiple objects
- Undo/Redo: Full history tracking
- Idle hint: After 30s without input, a subtle ring at the last cursor position (pointer-events disabled)
- Network Status card: Browser online state, connection quality hints, and measured API round-trip to
GET {NEXT_PUBLIC_API_BASE}/health
Anybody is free to contribute