KatInterview

Real-Time Multiplayer Canvas Architecture

System DesignModel answer
MediumModel answerSystem Designreal-timecollaborationdistributed-systems

Last updated

Build a backend and client sync strategy for a collaborative visual editor where many users edit shapes and objects simultaneously on a shared canvas.

Problem Statement

You're tasked with architecting a real-time collaborative visual editor—think of a tool where teams work together on a shared canvas containing shapes, frames, and text elements. Everyone sees changes as they happen.

Your system needs to handle:

Functional requirements:

  • Files contain canvas objects (rectangles, circles, text boxes, groups)
  • Multiple people edit the same file simultaneously
  • Changes propagate to all active users with minimal delay
  • Show who else is viewing or editing (presence)
  • All edits must persist—users can close and reopen files
  • Handle common collaboration scenarios: two people moving the same object, creating objects at the same time, reorganizing hierarchies

Performance and reliability:

  • Editing latency should feel instant locally, with updates reaching others in under 200ms (p50)
  • A typical file might have 2–5 concurrent editors; popular files could see 50+ simultaneous users
  • Mobile and WiFi connections drop frequently. Your system must handle:
    • Temporary disconnections (user goes through a tunnel)
    • Clients editing offline then reconnecting
    • Network packets arriving out of order or duplicated

What to cover:

  • High-level architecture: major components and how they communicate
  • Data model for canvas objects and edit operations
  • Conflict resolution strategy when users edit simultaneously
  • API design (WebSocket and REST endpoints)
  • How the system behaves during network failures
  • Storage strategy for both live editing and persistence

You don't need to design the rendering engine, plugin system, or version history UI.

Hints

Hint 1

Consider whether you need a central server or peer-to-peer architecture—what are the trade-offs?

Hint 2

Think about the granularity of conflicts: should two users editing different properties of the same object conflict?

Hint 3

How will you ensure that all clients eventually see the same state even if operations arrive in different orders?