How to Develop a Real-Time Online Whiteboard with Node.js & React.js? (Code + GitHub)

By Atit Purani

October 15, 2025

Imagine a virtual canvas where teams can draw, brainstorm, and collaborate instantly. You can have that with real-time online whiteboards.

If you are using a collaborative whiteboard, it allows teams to visually communicate ideas, solve problems faster, & work together no matter where they are.

With Node.js as the backend and React.js managing the front-end, you can build a React.js drawing app that’s fast, interactive, and capable of real-time collaboration.

So if you are trying to build an online whiteboard using NodeJs & ReactJs, then you are at the right place.

By the end of this blog, you’ll have a working online whiteboard app with drawing tools, session saving, and GitHub code that you can use, share, or scale.

What Are the Core Components of a Real-Time Whiteboard?

To build a robust Node.js real-time app for online collaboration, it’s important to understand its key components:

  • Canvas Drawing Tools: Enable users to draw, erase, and select colors with tools like pen, eraser, & color picker. This is the heart of any React.js drawing app.
  • Real-Time Updates: Use WebSocket or Socket.io to sync drawings instantly across multiple users. This is what makes your app truly collaborative.
  • Session Management: Save user sessions so users can return to their drawings later. This ensures that your collaborative drawing app maintains continuity even after users disconnect.
  • Front-End vs Back-End Responsibilities
    • Front-End (React.js): Manages the canvas, handles drawing events, and renders changes in real-time.
    • Back-End (Node.js): Handles real-time communication, session saving, and ensures data consistency.

Together, these components make your real-time online whiteboard efficient, scalable, and interactive.

How to Plan Your Whiteboard App? What Are the Features That Matter?

Before you start coding, plan the features that will make your app stand out:

Must-Have Features

  • Multi-user Collaboration: Multiple users can draw simultaneously.
  • Real-Time Drawing Sync: Instant updates across all connected clients using Socket.io.
  • Undo/Redo & Clear Board: Allows users to correct mistakes easily.
  • Session Saving: Store sessions in a database to reload later.
  • User-Friendly UI: Clean interface for easy navigation and drawing.

Optional Features

  • Export Drawings as Images: Users can save their whiteboards as PNG or PDF files.
  • Custom Shapes & Tools: Advanced drawing options for professional use.

By planning these features, you ensure your React.js drawing app is both functional and attractive for businesses, developers, and teams.

Step-by-Step Guide: Building Your Real-Time Whiteboard

Step-by-Step-Guide-Real-Time-Whiteboard

We will build a collaborative whiteboard app using React and Node.js.

By following this tutorial, you can develop a real-time whiteboard & create a fully functional online whiteboard with drawing tools, multi-user collaboration, & session saving.

We’ll use Node.js for the backend, React.js for the front-end, and Socket.io for real-time communication.

Step 1: Set up Node.js Server & WebSocket (Socket.io)

First, let’s create the backend server using Node.js and Socket.io for real-time updates.

Install Dependencies:

        
            mkdir whiteboard-server
            cd whiteboard-server
            npm init -y
            npm install express socket.io cors
        
    

Createserver.js:

        
            const express = require('express');
            const http = require('http');
            const { Server } = require('socket.io');
            const cors = require('cors');
            
            const app = express();
            app.use(cors());
            
            const server = http.createServer(app);
            const io = new Server(server, {
            cors: { origin: '*' }
            });
            
            let sessions = {};
            
            io.on('connection', (socket) => {
            console.log('User connected:', socket.id);
            
            // Listen for drawing data
            socket.on('drawing', (data) => {
                socket.broadcast.emit('drawing', data);
            });
            
            // Save session data
            socket.on('save-session', ({ sessionId, drawingData }) => {
                sessions[sessionId] = drawingData;
            });
            
            // Load session
            socket.on('load-session', (sessionId, callback) => {
                callback(sessions[sessionId] || []);
            });
            
            socket.on('disconnect', () => {
                console.log('User disconnected:', socket.id);
            });
            });
            
            server.listen(5000, () => console.log('Server running on port 5000'));
        
    

This sets up a Node.js real-time app ready to handle multiple users and sessions.

Step 2: Initialize React.js Front-End with Canvas

Create a new React app for the drawing interface.

        
            npx create-react-app whiteboard-client
            cd whiteboard-client
            npm install socket.io-client
        
    

Create Whiteboard.js:

        
            import React, { useRef, useEffect, useState } from 'react';
            import { io } from 'socket.io-client';
            
            const socket = io('http://localhost:5000');
            
            const Whiteboard = ({ sessionId }) => {
            const canvasRef = useRef(null);
            const [drawing, setDrawing] = useState(false);
            const [color, setColor] = useState('#000000');
            
            useEffect(() => {
                const canvas = canvasRef.current;
                const context = canvas.getContext('2d');
            
                // Load session
                socket.emit('load-session', sessionId, (data) => {
                data.forEach(line => drawLine(context, line));
                });
            
                // Listen for drawing from other users
                socket.on('drawing', (line) => drawLine(context, line));
            
                return () => socket.off('drawing');
            }, [sessionId]);
            
            const drawLine = (context, { x0, y0, x1, y1, color }) => {
                context.strokeStyle = color;
                context.lineWidth = 2;
                context.beginPath();
                context.moveTo(x0, y0);
                context.lineTo(x1, y1);
                context.stroke();
                context.closePath();
            };
            
            const handleMouseDown = (e) => setDrawing(true);
            const handleMouseUp = (e) => setDrawing(false);
            const handleMouseMove = (e) => {
                if (!drawing) return;
                const canvas = canvasRef.current;
                const context = canvas.getContext('2d');
                const rect = canvas.getBoundingClientRect();
                const x = e.clientX - rect.left;
                const y = e.clientY - rect.top;
            
                const line = { x0: x, y0: y, x1: x, y1: y, color };
                drawLine(context, line);
                socket.emit('drawing', line);
            };
            
            const saveSession = () => {
                const canvas = canvasRef.current;
                const dataURL = canvas.toDataURL();
                socket.emit('save-session', { sessionId, drawingData: dataURL });
                alert('Session saved!');
            };
            
            return (
                <div>
                <canvas
                    ref={canvasRef}
                    width={800}
                    height={600}
                    style={{ border: '1px solid #000' }}
                    onMouseDown={handleMouseDown}
                    onMouseUp={handleMouseUp}
                    onMouseMove={handleMouseMove}
                />
                <div style={{ marginTop: 10 }}>
                    <input type="color" value={color} onChange={(e) => setColor(e.target.value)} />
                    <button onClick={saveSession}>Save Session</button>
                </div>
                </div>
            );
            };
            
            export default Whiteboard

        
    

This creates a React.js drawing app with basic tools and session saving.

Step 3: Connect Front-End & Back-End for Live Drawing

The Socket.io connection in Whiteboard.js already handles real-time updates. When a user draws, the drawing event is emitted to the server, which broadcasts it to all connected clients.

This is the core of your Node.js real-time app for collaborative drawing.

Step 4: Implement Multi-User Collaboration

Multiple users can draw on the same canvas simultaneously. Just share the same sessionId among all users:

<Whiteboard sessionId=”team-session-1″ />

  • Socket.io ensures that every line drawn by one user is visible to others instantly.
  • This is how a collaborative drawing app works in real-time.

Step 5: Add Session Saving & Loading

We already included session saving:

  • socket.emit(‘save-session’, { sessionId, drawingData }) saves the current drawing.
  • socket.emit(‘load-session’, sessionId, callback) loads previous drawings.

This allows users to save and restore sessions, making your whiteboard business-ready.

Step 6: Optional Improvements (Color Tools, Shapes, Eraser)

You can improve the app with:

  • Color Picker (already added)
  • Eraser Tool:

const erase = () => setColor(‘#FFFFFF’);

  • Shapes (circle, rectangle, line) by modifying the drawLine function.
  • Undo/Redo: Maintain a stack of drawing actions and allow users to revert.

These improvements make your whiteboard app with drawing tools and session saving in Node.js and React.js more professional and business-ready.

Here’s the Complete GitHub Code to Build a Real-Time Online Whiteboard with Node.js & React.js.

Our Expertise in Real-Time Solutions

Expertise-in-Real-Time-Solutions

We have been creating different types of real-time solutions that are scalable, interactive, and reliable.

  • Advanced Drawing Tools: From pens and erasers to color pickers and shapes, our React.js drawing apps are fully functional and user-friendly.
  • Session Saving & Management: Keep track of your work with secure session saving, allowing users to resume collaboration anytime.
  • Scalable Architecture: Our Node.js real-time apps are designed to handle multiple users without lag, ensuring smooth collaboration for teams of any size.
  • Customizable Solutions: Personalized collaborative drawing apps for startups, businesses, and educational platforms.
  • Performance Optimization: Using React hooks and Node.js best practices, we ensure fast, responsive, and high-quality online whiteboards.
  • Business-Focused: We create tools that not only attract developers but also help entrepreneurs and businesses enhance team collaboration and productivity.

Want a Real-Time and Collaborative Solution? Contact Us Today!

What Are the Advanced Tips to Improve Your Whiteboard App?

Once your app is working, you can optimize and add advanced features to make it professional:

  • Optimize Performance for Multiple Users: Ensure low-latency updates even with many users.
  • Add Authentication for Private Sessions: Protect sensitive whiteboards for teams or clients.
  • Allow Exporting Boards to Images or PDFs: Offer users the ability to save their work.
  • Use React Hooks & Node.js Optimization Techniques: Improved performance and maintainability.

These improvements make your whiteboard app with drawing tools & session saving in Node.js and React.js suitable for anyone who wants a reliable & scalable solution.

Bring Your Collaborative Ideas to Life

Real-time online whiteboards transform how teams collaborate, brainstorm, and visualize ideas.

By building your own Node.js + React.js collaborative drawing app, you get complete control over features like session saving, live updates, and drawing tools.

As a business owner, this whiteboard app is your starting point to improve your team collaboration.

FAQs

  • It’s a web-based collaborative canvas where multiple users can draw, write, & interact simultaneously with technologies like Node.js & React.js.

  • Yes, with Node.js back-end and database integration, you can save and restore user sessions for continuous collaboration.

  • React.js handles the front-end drawing canvas, while Node.js manages real-time communication with Socket.io and session saving on the server.

  • Yes, using WebSocket or Socket.io, updates are synchronized in real-time for all connected users.

Get in Touch

Got a project idea? Let's discuss it over a cup of coffee.

    Get in Touch

    Got a project idea? Let's discuss it over a cup of coffee.

      COLLABORATION

      Got a project? Let’s talk.

      We’re a team of creative tech-enthus who are always ready to help business to unlock their digital potential. Contact us for more information.