This repository contains a Proof of Concept demonstrating how to build Google-Docs-style real-time collaboration for custom forms (input fields, dropdowns, checkboxes, etc.) using Yjs CRDTs, React, and a Node.js WebSocket backend.
This POC shows that real-time sync is possible without using a rich text editor — it works directly on any custom React form UI.
This POC implements:
- Multi-user real-time form editing (Two or more users can fill out the same form at the same time)
- Offline editing (via IndexedDB, auto-sync when online)
- Conflict-free merging (CRDT-based, no overwriting)
- User presence awareness (“John is editing Severity field”)
- Auto-reconnect with state recovery
- Custom fields support Text, textarea, dropdown, radio, dynamic fields, etc.
This provides a foundation for building collaborative healthcare forms, survey panels, audit forms, or multi-user workflows.
yjs— CRDT engine (Conflict-free replicated data type)y-websocket— Sync provider for real-time updatesy-indexeddb— Offline persistence- React functional components
- Awareness API for real-time user presence
y-websocketserver (official Yjs server library)- Node.js
wsWebSocket server - Express (optional for REST APIs)
⭐ Entirely open source — no paid tools, no vendor lock-in.
This POC demonstrates that:
-
Real-time editing works even on custom forms, not only text editors.
-
Yjs handles conflicts, merges, ordering, syncing, and offline edits.
-
You can build collaborative forms similar to:
- Airtable
- Notion databases
- Figma comments
- Google Forms w/ live presence
-
Offline changes sync cleanly without overwriting.
User A (React) ──┐
│ y-websocket (CRDT updates)
User B (React) ──┤
▼
Node.js Y-WebSocket Server
- Render form UI (React components)
- Maintain a shared Yjs document (
Y.Mapfor form fields) - Send updates through y-websocket
- Sync offline updates from IndexedDB
- Subscribe to awareness → show “who is editing what”
- Host the y-websocket server (real-time sync)
- Relay CRDT updates to all connected clients
- Track connected clients (optional awareness)
- No merge logic needed by the backend
- Text inputs
- Textareas
- Dropdown selects
- Checkboxes
- Radio buttons
- Dynamic lists/sections
No overwriting — Yjs merges all updates deterministically.
Shows active editors and what they are editing.
All inputs work offline → sync when online automatically.
Network drop? Reconnection restores sync state with no data loss.
git clone https://github.com/your-username/realtime-collaborative-forms-poc.git
cd realtime-collaborative-forms-poccd backend
npm install
npm startThis starts the Yjs WebSocket Server on:
ws://localhost:1234
cd frontend
npm install
npm startRuns the React app on:
http://localhost:3000
Open two browser windows:
- Window 1 → http://localhost:3000
- Window 2 → http://localhost:3000
Try editing the same form:
- Inputs sync in real-time
- Selections sync
- Awareness updates show who is editing
Turn off your internet (offline mode):
- Form keeps working
- Turn internet back on
- Changes sync automatically
realtime-collaborative-forms-poc/
│
├── backend/
│ └── server.js # Y-WebSocket server
│
└── frontend/
├── src/
│ ├── App.jsx
│ ├── yjs-setup.js # Setup for Yjs, IndexedDB & Websocket provider
│ └── FormCollaborator.jsx
└── package.json
These can be added on top of the POC:
- Snapshot-based version control
- Milestone versions (“v1.0 before meeting”)
- Field-level activity highlighting
- Role-based access (lead surveyor vs generalist)
- Server-side persistence of snapshots
- Multi-step form collaboration
- Operation logs for audit compliance
MIT License — free for commercial, academic, personal use.