Skip to content

kunal-yelgate/White_Board

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 Visual Whiteboard

A real-time collaborative whiteboard application built with React, Fabric.js, and WebSockets. Draw, sketch, and brainstorm together with your team β€” seamlessly and instantly.


✨ Features

  • πŸ–ŠοΈ Freehand Drawing β€” Smooth pen tool with pressure support
  • 🟦 Shapes & Objects β€” Rectangles, circles, lines, arrows, and text
  • 🧽 Eraser Tool β€” Precision erasing with adjustable size
  • 🎨 Color Palette β€” Custom colors, opacity control, and stroke width
  • πŸ‘₯ Real-Time Collaboration β€” See cursors and edits live with WebSockets
  • ↩️ Undo / Redo β€” Full history stack with keyboard shortcuts (Ctrl+Z / Ctrl+Y)
  • πŸ–ΌοΈ Image Upload β€” Drag & drop images onto the canvas
  • πŸ” Zoom & Pan β€” Navigate large boards with ease
  • πŸ’Ύ Auto-Save β€” Persistent storage with MongoDB
  • πŸ”— Shareable Rooms β€” Unique room IDs for instant collaboration
  • πŸ“± Responsive Design β€” Works on desktop and tablet

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                        CLIENT LAYER                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚  React App  │◄──►│  Fabric.js  │◄──►│  Socket.io  β”‚     β”‚
β”‚  β”‚  (UI/State) β”‚    β”‚ (Canvas API)β”‚    β”‚   Client    β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                  β”‚
                                                  β–Ό WebSocket
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                       SERVER LAYER                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚  β”‚  Node.js    │◄──►│  Socket.io  │◄──►│    Redis    β”‚     β”‚
β”‚  β”‚  (Express)  β”‚    β”‚  (WS Hub)   β”‚    β”‚  (Pub/Sub)  β”‚     β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”˜     β”‚
β”‚                                               β”‚              β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”‚              β”‚
β”‚  β”‚  MongoDB    │◄──►│  AWS S3 /   β”‚β—„β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β”‚
β”‚  β”‚  (Metadata) β”‚    β”‚ Cloudinary  β”‚  (Session State)        β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Tech Stack

Layer Technology Purpose
Frontend React 18 UI framework
State Zustand Lightweight global state
Canvas Fabric.js 2D drawing & object manipulation
Styling CSS Modules / Tailwind Component styling
Real-Time Socket.io Client WebSocket communication
Backend Node.js + Express API & WebSocket server
Real-Time Socket.io Bidirectional event handling
Database MongoDB Whiteboard data persistence
Cache Redis Session state & pub/sub
Storage AWS S3 / Cloudinary Image asset storage

πŸš€ Getting Started

Prerequisites

  • Node.js >= 18.0.0
  • npm >= 9.0.0 or yarn
  • MongoDB >= 6.0 (local or Atlas)
  • Redis >= 7.0 (local or cloud)

1. Clone the Repository

git clone https://github.com/yourusername/visual-whiteboard.git
cd visual-whiteboard

2. Install Dependencies

# Install server dependencies
npm install

# Install client dependencies
cd client
npm install
cd ..

3. Environment Setup

Create .env files for both client and server:

Server (server/.env):

PORT=5000
MONGODB_URI=mongodb://localhost:27017/visual-whiteboard
REDIS_URL=redis://localhost:6379
JWT_SECRET=your-super-secret-jwt-key
CORS_ORIGIN=http://localhost:3000
AWS_S3_BUCKET=your-s3-bucket
AWS_ACCESS_KEY_ID=your-access-key
AWS_SECRET_ACCESS_KEY=your-secret-key

Client (client/.env):

REACT_APP_API_URL=http://localhost:5000
REACT_APP_SOCKET_URL=http://localhost:5000

4. Start Development Servers

# Start MongoDB & Redis (if running locally)
# macOS (using Homebrew)
brew services start mongodb-community
brew services start redis

# Linux
sudo systemctl start mongod
sudo systemctl start redis

# Start the backend server
npm run dev

# In a new terminal, start the React client
cd client
npm start

The app will be available at http://localhost:3000.


πŸ“ Project Structure

visual-whiteboard/
β”œβ”€β”€ client/                          # React Frontend
β”‚   β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/              # React components
β”‚   β”‚   β”‚   β”œβ”€β”€ Canvas/              # Fabric.js canvas wrapper
β”‚   β”‚   β”‚   β”œβ”€β”€ Toolbar/             # Drawing tools & controls
β”‚   β”‚   β”‚   β”œβ”€β”€ Collaboration/       # User cursors & presence
β”‚   β”‚   β”‚   └── UI/                  # Layout components
β”‚   β”‚   β”œβ”€β”€ hooks/                   # Custom React hooks
β”‚   β”‚   β”‚   β”œβ”€β”€ useFabric.js         # Fabric.js initialization
β”‚   β”‚   β”‚   β”œβ”€β”€ useWebSocket.js      # Socket connection
β”‚   β”‚   β”‚   β”œβ”€β”€ useWhiteboardState.js # Global state
β”‚   β”‚   β”‚   └── useHistory.js        # Undo/redo logic
β”‚   β”‚   β”œβ”€β”€ store/                   # Zustand stores
β”‚   β”‚   β”œβ”€β”€ utils/                   # Helpers & serializers
β”‚   β”‚   └── App.jsx
β”‚   └── package.json
β”‚
β”œβ”€β”€ server/                          # Node.js Backend
β”‚   β”œβ”€β”€ config/                      # DB & Socket config
β”‚   β”œβ”€β”€ handlers/                    # Socket event handlers
β”‚   β”‚   β”œβ”€β”€ drawHandler.js
β”‚   β”‚   β”œβ”€β”€ objectHandler.js
β”‚   β”‚   β”œβ”€β”€ cursorHandler.js
β”‚   β”‚   └── historyHandler.js
β”‚   β”œβ”€β”€ middleware/                  # Auth & rate limiting
β”‚   β”œβ”€β”€ models/                      # Mongoose schemas
β”‚   β”œβ”€β”€ rooms/                       # Room management
β”‚   β”œβ”€β”€ routes/                      # REST API routes
β”‚   └── index.js                     # Entry point
β”‚
β”œβ”€β”€ shared/                          # Shared types & constants
β”œβ”€β”€ docker-compose.yml               # Docker setup
└── README.md

πŸ”Œ WebSocket Events

Event Direction Description
room:join Client β†’ Server Join a whiteboard room
room:leave Client β†’ Server Leave current room
draw:start Client β†’ Server Begin drawing stroke
draw:move Client β†’ Server Drawing in progress (throttled)
draw:end Client β†’ Server Complete drawing stroke
object:modify Client β†’ Server Move, resize, or rotate object
object:delete Client β†’ Server Delete selected objects
cursor:move Client β†’ Server Mouse position update
user:draw:start Server β†’ Client Another user started drawing
user:draw:move Server β†’ Client Another user is drawing
object:created Server β†’ Client New object added to canvas
object:modified Server β†’ Client Object was modified
objects:deleted Server β†’ Client Objects were removed
user:joined Server β†’ Client New user entered room
user:left Server β†’ Client User disconnected
user:cursor Server β†’ Client Remote cursor position

πŸ› οΈ Development

Running Tests

# Client tests
cd client
npm test

# Server tests
cd server
npm test

Building for Production

# Build React app
cd client
npm run build

# Start production server
cd ../server
npm start

Docker Setup

# Start all services with Docker Compose
docker-compose up -d

# Services:
# - App: http://localhost:3000
# - API: http://localhost:5000
# - MongoDB: localhost:27017
# - Redis: localhost:6379

🎯 Roadmap

  • Basic drawing tools (pen, shapes, text)
  • Real-time collaboration with WebSockets
  • Undo / Redo functionality
  • Image upload & drag-drop
  • Zoom & pan navigation
  • Sticky Notes β€” Add and edit sticky notes
  • Templates β€” Pre-made board templates
  • Comments β€” Add comments to specific areas
  • Version History β€” Time-travel through board states
  • Export β€” PDF, PNG, SVG export
  • Auth & Teams β€” OAuth login and team workspaces
  • Mobile App β€” React Native companion app
  • Offline Support β€” Service worker & local sync

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Please read our Contributing Guide for details on code style, testing, and commit conventions.


πŸ“„ License

This project is licensed under the MIT License β€” see the LICENSE file for details.


πŸ™ Acknowledgments

  • Fabric.js β€” Powerful canvas library
  • Socket.io β€” Real-time bidirectional communication
  • React β€” UI library
  • Zustand β€” State management

Made with ❀️ by Kunal Yelgate

About

Platform which provide text-to-diagram AI integration, the board summarizer, or the core drawing canvas itself.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors