A real-time collaborative whiteboard with live cursors, voice, chat and replay. No accounts. No installs.
Sketchroom is built for teams that need to think out loud with a picture: system design interviews, retros, workshops and teaching.
One Node.js process owns the state of every room. Browsers draw locally for instant feedback, sync through Socket.IO, and talk to each other directly over WebRTC for voice. The canvas renderer, hit-testing, replay engine and rate limiter are all written by hand, with no drawing library.
- Live multiplayer: named, colored cursors that stay put when anyone pans or zooms
- Voice chat: peer-to-peer WebRTC audio, never routed through the server or recorded
- Chat, reactions and follow mode: follow a presenter's viewport so nobody gets lost
- Full drawing toolkit: pen, shapes, arrows, text, sticky notes, laser pointer, eraser, multi-select, resize, image paste/drop
- Infinite canvas with minimap, undo, keyboard shortcuts and PNG export
- Session replay: scrub back to the first stroke
- Host controls: lock room, remove users, clear board, countdown timer
- Dark mode and invite links (
?room=ABC123)
| Layer | Technology |
|---|---|
| Frontend | React 18, Vite 5, Canvas 2D (custom renderer) |
| Realtime | Socket.IO 4 (rooms, acks, volatile emits) |
| Backend | Node.js, Express, in-memory room state, crypto.randomInt |
| Voice | WebRTC, PeerJS |
| Tooling | ESLint 9 |
| Hosting | Render (one service serves API and built app) |
flowchart LR
subgraph A["Browser (Client A)"]
A1["Canvas 2D & Tools"]
A2["Board State & Replay"]
A3["WebRTC Voice (PeerJS)"]
end
subgraph S["Node.js + Socket.IO Server"]
S1["Rooms Map (live state)"]
S2["Rate Limiter & Caps"]
S3["History Log (replay)"]
end
subgraph B["Browser (Client B)"]
B1["Canvas 2D & Tools"]
B2["Board State & Replay"]
B3["WebRTC Voice (PeerJS)"]
end
A -- "upsert / ack" --> S
A -. "volatile: cursor, laser, viewport" .-> S
S -- "broadcast" --> B
S -. "volatile" .-> B
A3 <==>|"WebRTC audio, peer-to-peer"| B3
One Node process is the source of truth for every room. Browsers render from local state for instant feedback, and voice bypasses the server entirely.
sequenceDiagram
participant U as You (Client A)
participant S as Server
participant P as Others (Client B..N)
U->>U: Draw (canvas updates instantly from local state)
U->>S: elementUpsert { element } (throttled ~40 ms, final send on release)
S->>S: Validate, rate-limit, store in room, log for replay
S-->>P: elementUpsert (broadcast to everyone else)
P->>P: Redraw canvas
stateDiagram-v2
[*] --> Created: host creates room
Created --> Active: first user joins
Active --> Locked: host locks room
Locked --> Active: host unlocks
Active --> Empty: last user leaves
Locked --> Empty: last user leaves
Empty --> Active: someone rejoins within 60s
Empty --> Deleted: 60s TTL expires
Deleted --> [*]
flowchart TD
E["Incoming socket event"] --> R{"Socket is in a room?"}
R -- no --> X1["Dropped"]
R -- yes --> T{"Token bucket has a token?<br/>~100/s, burst 150"}
T -- no --> X2["Dropped"]
T -- yes --> V{"Valid type, id and size?"}
V -- no --> X3["Dropped"]
V -- yes --> H{"Host-only event?"}
H -- no --> OK["Apply to room and broadcast"]
H -- yes --> HC{"Sender is host?"}
HC -- yes --> OK
HC -- no --> X4["Dropped"]
sequenceDiagram
participant A as Client A (peerId: aaa)
participant S as Server
participant B as Client B (peerId: bbb)
A->>S: voice { peerId: "aaa" }
B->>S: voice { peerId: "bbb" }
S-->>A: presence (users with peerIds)
S-->>B: presence (users with peerIds)
Note over A,B: Smaller peerId places the call, so no double dial
A->>B: PeerJS call (WebRTC offer)
B-->>A: answer with microphone stream
A<<->>B: Direct audio, never through the server
flowchart LR
ED["Edit: up / del / clear"] --> REC["record()"]
REC --> CO{"Same element<br/>as last entry?"}
CO -- yes --> MG["Merge into last entry"]
CO -- no --> PU["Push new entry<br/>max 4,000"]
MG --> LOG[("History log")]
PU --> LOG
LOG --> ACK["history ack"]
ACK --> ST["stateAt(log, index)"]
ST --> RN["Same renderer as live board"]
flowchart LR
U["Users' browsers"] -- "HTTPS + WebSocket" --> R
subgraph R["Render Web Service (one origin)"]
ST["Express serves frontend/dist"]
IO["Socket.IO server"]
MEM[("In-memory rooms")]
ST --- IO
IO --- MEM
end
R -. "self-ping every 30s" .-> R
Under the hood:
- Renderer: one DPR-aware pan/zoom matrix, shared by the live board, minimap, replay and PNG export
- Sync: shapes are atomic elements keyed by id, merged last-write-wins
- Replay: any moment is rebuilt as a pure function of the log
- Voice: the server only shares PeerJS ids, audio goes browser to browser
Every event is scoped to the sender's own room and rate limited.
| Event | From | Notes |
|---|---|---|
join |
client | Ack returns the full board, users, chat and timer |
elementUpsert / elementsDelete |
both | Last write wins by id. Deletes capped at 500 per event |
boardClear |
host | Enforced on the server |
cursorMove / laser / viewport |
volatile | Dropped under load, never queued |
chat / reaction |
both | 300 chars per message, last 50 kept |
voice |
client | Publishes your PeerJS id |
lock / kick / timer |
host | Host-only room controls |
history |
client | Fetches the replay log |
- 25 users per room, 5,000 elements and 15 images per board
- 100 KB per element (300 KB for images), 500 KB socket buffer
- Per-socket token bucket: ~100 events/s, burst 150
- Host actions verified server-side, all payloads validated
- 6-character room IDs from a 32-character alphabet (~1 billion combinations), re-rolled on collision
- Empty rooms are deleted after 60 seconds
Anyone with a room ID can join, so treat it like a link. Hosts can lock the room or remove people.
Real_Code_Editor/
βββ backend/
β βββ index.js # Express + Socket.IO server
βββ frontend/
β βββ index.html
β βββ src/
β βββ App.jsx # Landing <-> Board switch
β βββ Landing.jsx # Start page, create/join form
β βββ Board.jsx # Whiteboard UI, sockets, voice, replay
β βββ draw.js # Renderer, hit-testing, geometry
β βββ *.css
βββ LICENSE
Prerequisites: Node.js 18+ and npm.
# 1. Clone
git clone https://github.com/AkshatPandey2006/Real_Code_Editor.git
cd Real_Code_Editor
# 2. Install
npm install
cd frontend && npm install
# 3. Build the frontend
npm run build
cd ..
# 4. Start the server
node backend/index.jsOpen http://localhost:5000. The server serves the built app and Socket.IO from the same origin, so no CORS setup is needed.
For frontend hot reload, run npm run dev inside frontend/ alongside the backend. Set PORT to change the server port (default 5000).
Deploy as a single Render Web Service: build the frontend, then start with node backend/index.js.
The server pings its own URL every 30 seconds to keep the free tier awake. If you fork this, change the url in backend/index.js to your own deployment or remove the ping.
| Choice | Why | What would change at scale |
|---|---|---|
| In-memory rooms | Instant, nothing to provision | Snapshot to Redis or Postgres |
| Last-write-wins | Shapes are atomic, so conflicts are rare | CRDTs, if text were co-edited |
| P2P voice | No media server to run | An SFU for larger rooms |
| Custom renderer | Full control of hit-testing, replay and export | More geometry to maintain |
- Persistent boards and optional accounts
- Horizontal scaling with the Socket.IO Redis adapter
- SVG and PDF export
- View-only rooms
- Automated tests for
draw.jsand the socket protocol
Contributions are welcome.
- Fork the repo and create a branch:
git checkout -b feat/your-feature - Make your changes and run
npm run lintinfrontend/ - Test with two browser tabs in the same room
- Commit with Conventional Commits (
feat:,fix:,docs:) - Open a Pull Request with a clear description (add a screenshot for UI changes)
Guidelines
- Every new socket event must be room-scoped, validated, rate limited and size-capped
- Use volatile emits for high-frequency data like cursors
- Keep a single draw routine (
drawElindraw.js) and send world coordinates, never screen coordinates - Discuss new dependencies in an issue first
Found a bug or have an idea? Open an issue. For security problems, please contact the maintainer privately through GitHub.
Is my board saved? No. Rooms live in memory. Export a PNG before you leave.
Is voice recorded? No. Audio goes browser to browser and never touches the server.
Why is the first load slow? The free host sleeps when idle and takes a few seconds to wake.
Licensed under the MIT License. See LICENSE. Copyright Β© 2026 Akshat Pandey.
Akshat Pandey
- π Portfolio: akshatpandeyportfolio.netlify.app
- πΌ LinkedIn: akshatpandey2006
- π» GitHub: @AkshatPandey2006
If Sketchroom helped you, consider giving it a β