<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dhruv Jain</title>
    <description>The latest articles on DEV Community by Dhruv Jain (@notdj01).</description>
    <link>https://dev.to/notdj01</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3772585%2F595fead1-4a5c-4f62-b3dd-0b49533dfc9e.jpg</url>
      <title>DEV Community: Dhruv Jain</title>
      <link>https://dev.to/notdj01</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/notdj01"/>
    <language>en</language>
    <item>
      <title>I Built a Real-Time Collaborative Whiteboard in One Day — Here's How</title>
      <dc:creator>Dhruv Jain</dc:creator>
      <pubDate>Sun, 03 May 2026 19:20:56 +0000</pubDate>
      <link>https://dev.to/notdj01/i-built-a-real-time-collaborative-whiteboard-in-one-day-heres-how-3nfa</link>
      <guid>https://dev.to/notdj01/i-built-a-real-time-collaborative-whiteboard-in-one-day-heres-how-3nfa</guid>
      <description>&lt;p&gt;&lt;strong&gt;It started at midnight&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I had 24 hours, a free Replit subscription, and an idea: what if I could build something like Miro — but actually understand every line of code in it?&lt;br&gt;
That's how CollabCanvas was born. A real-time collaborative whiteboard where multiple users can draw, drop sticky notes, build flowcharts, and see each other's cursors move live — all synced instantly over WebSockets.&lt;br&gt;
I'm a third-year AI &amp;amp; Data Science student, and most of my projects live in Python and ML pipelines. So building a full-stack multiplayer canvas app in a day was genuinely outside my comfort zone. This is the story of how it went.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The core problem I had to solve first&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Multiplayer sync sounds simple until you actually build it. The hard part isn't sending a canvas update — it's figuring out what to send.&lt;br&gt;
I tried syncing the full Fabric.js canvas JSON on every change. It worked, but at 30+ objects it became sluggish. The fix was delta syncing — only emitting the changed object's state, not the entire canvas. This cut the payload size dramatically and made the sync feel instant.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;object:modified&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;canvas:update&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;roomId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;delta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;target&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toObject&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;left&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;top&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;scaleX&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;scaleY&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On the server, the room state is held in memory and rebroadcast to all other clients in the room. New joiners receive a canvas:init event with the full current state so they're immediately in sync.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What CollabCanvas actually does&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Live multiplayer canvas — real-time drawing sync with color-coded cursor presence for every connected user&lt;br&gt;
Full drawing toolkit — freehand pen, rectangles, circles, lines, arrows, text, and sticky notes&lt;br&gt;
Flowchart maker — connectable shapes in a Figma-style node system&lt;br&gt;
Admin controls — room creator gets an admin panel to assign Editor or Viewer roles, and set draw zone restrictions per user&lt;br&gt;
Hover attribution — hover any object to see who drew it&lt;br&gt;
Voice notes — record and embed audio annotations directly onto the board&lt;br&gt;
AI assistant — generate and place shapes via natural language (powered by Claude API)&lt;br&gt;
Export — download the full canvas as PNG or PDF&lt;br&gt;
Undo/redo — full history stack, synced across the room&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The technical stack&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;React + Vite — frontend&lt;br&gt;
Fabric.js v7 — canvas rendering and object model&lt;br&gt;
Socket.io + Express — real-time WebSocket server&lt;br&gt;
pnpm monorepo — client and server in one repo&lt;br&gt;
Deployed on Replit&lt;/p&gt;

&lt;p&gt;The architecture is intentionally simple: no database, canvas state lives in server memory per room, cleared after an hour of inactivity. This kept the scope tight for a one-day build while still being fully functional.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What surprised me&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cursor sync was the feature I almost skipped — and it ended up being the most impressive thing in the demo. Seeing three colored cursors moving independently on the same canvas makes the multiplayer feel real in a way that just synced drawing doesn't.&lt;br&gt;
It's also just 10 lines of code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mouse:move&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getPointer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;socket&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;emit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cursor:move&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;roomId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;userId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The lesson: polish the presence features. They're what make multiplayer feel alive.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Try it&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The live demo is deployed on Replit — open it in two tabs, click on the link for the first tab, and then use the "Share" button to share the room id with the link and start drawing, and you'll see exactly what I mean.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://collab-canvas--dhruvaugust1.replit.app" rel="noopener noreferrer"&gt;https://collab-canvas--dhruvaugust1.replit.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Built in 24 hours for the Replit Buildathon. Feedback welcome.&lt;/p&gt;

</description>
      <category>replit</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>hackathon</category>
    </item>
  </channel>
</rss>
