Real-Time Collaboration: How We Built Live Editing for Knowledge Teams
A behind-the-scenes look at how we built real-time collaboration into HeroWorks — from conflict resolution to presence indicators and everything in between.
When we set out to build real-time collaboration in HeroWorks, we knew we couldn’t just bolt a “multiplayer mode” onto an existing editor. Knowledge work is different from code editing or whiteboarding — it requires thoughtful conflict resolution, granular presence awareness, and the ability to work asynchronously without losing sync.
Here’s how we approached it.
Why Real-Time Matters for Knowledge Bases
Documentation is inherently collaborative. A product spec starts with a PM, gets refined by engineering, reviewed by design, and eventually used by support. In traditional tools, this means passing documents back and forth, leaving comments, and hoping nobody overwrites someone else’s work.
Real-time collaboration eliminates this friction. Everyone works in the same space, sees each other’s changes as they happen, and never has to wonder if they’re looking at the latest version.
The Technical Architecture
Conflict-Free Replicated Data Types (CRDTs)
At the heart of our collaboration engine are CRDTs — data structures that allow multiple users to edit simultaneously without conflicts. Unlike Operational Transform (used by Google Docs), CRDTs guarantee eventual consistency without requiring a central server to arbitrate conflicts.
This means:
- Offline editing works. Changes merge cleanly when you reconnect.
- No data loss. Concurrent edits are preserved, not overwritten.
- Low latency. Changes apply locally first, then sync — so the editor always feels fast.
Presence and Awareness
Knowing who’s editing is just as important as the edits themselves. Our presence system shows:
- Live cursors with user names and colors
- Selection highlights so you can see what someone is working on
- Activity indicators showing who’s currently viewing or editing each article
- Typing awareness that prevents awkward simultaneous edits to the same paragraph
Version History
Every change is tracked with full attribution. You can:
- Browse the complete edit history of any article
- See exactly who changed what and when
- Restore any previous version with one click
- Compare versions side-by-side with a visual diff
Challenges We Solved
The “Last Write Wins” Problem
In naive implementations, if two people edit the same sentence simultaneously, one person’s changes get lost. Our CRDT-based approach preserves both edits and merges them intelligently — character by character if necessary.
Presence at Scale
Tracking cursor positions for 50 concurrent editors is trivial. Doing it for 500 without crushing your server is not. We built a lightweight presence protocol that uses delta compression and smart throttling to keep bandwidth minimal even with hundreds of active users.
Rich Text Complexity
Real-time sync for plain text is well-understood. Rich text — with formatting, images, tables, and embedded content — is significantly harder. Each element type has its own merge semantics, and we had to build custom CRDT types for complex structures like tables and nested lists.
What’s Coming Next
We’re working on several enhancements to our collaboration features:
- Inline comments with threads for focused discussions
- Suggested edits (like Google Docs’ suggestion mode) for review workflows
- AI-assisted merge that intelligently resolves complex conflicts
- Real-time notifications when articles you care about are edited
Real-time collaboration isn’t just a feature — it’s a fundamental shift in how teams work with knowledge. We’re committed to making it seamless.
