How bhavadharani412/collaborative-text-editor works
Collaborative Docs is a browser-based document editor with a React home screen, rich-text editing, and multi-user collaboration. Users create or find documents on the home screen, open an ID-routed editor, and edit through Quill. The editor combines local Yjs state and offline persistence with a WebSocket sync server; it also supports live presence, title synchronization, and PDF/DOCX export. A separate Socket.IO path handles document snapshots and coarse-grained transfers through a bounded in-memory store. The README and excerpts support these flows; some editor internals and export implementation details were not sampled.
Main entry points: Editor.jsx Document Editor · yjsProvider.js Yjs Provider Setup · DocsPage.jsx Document Home · App.jsx Route App
Components 18
Document Navigation
- Route App
client/src/App.jsx - Document Home
client/src/components/DocsPage.jsx - Local Document List
client/src/services/storage.js - Document ID
client/src/utils/generateId.js
Editing and Export
- Document Editor
client/src/components/Editor.jsx - Rich Text Surface
client/src/components/Editor.jsx - Live Word Count
client/src/components/Editor.jsx - PDF Export
client/src/components/Editor.jsx - DOCX Export
client/src/components/Editor.jsx
Live Collaboration
- Yjs Provider Setup
client/src/services/yjsProvider.js - Shared Yjs Document
client/src/components/Editor.jsx - Presence and Titles
client/src/components/Editor.jsx - Offline Document Cache
client/src/services/yjsProvider.js
Backend Services
- Yjs WebSocket Relay
server/index.js - Socket.IO Events
server/index.js - Snapshot Store
server/index.js - Health Endpoint
server/index.js
Other components
- Document User
Connections 20
- Document User → Document Home: manages documents
README.md - Document User → Document Editor: edits document
README.md - Route App → Document Home: routes home
client/src/App.jsx - Route App → Document Editor: routes by ID
client/src/App.jsx - Document Home → Local Document List: reads and saves
client/src/components/DocsPage.jsx - Document Home → Document ID: generates ID
client/src/components/DocsPage.jsx - Document Editor → Rich Text Surface: mounts and configures
README.md - Document Editor → Live Word Count: updates count
README.md - Document Editor → PDF Export: exports PDF
client/src/components/Editor.jsx - Document Editor → DOCX Export: exports DOCX
client/src/components/Editor.jsx - Document Editor → Yjs Provider Setup: creates collaboration
client/src/components/Editor.jsx - Document Editor → Socket.IO Events: joins and transfers
README.md - Yjs Provider Setup → Shared Yjs Document: creates
client/src/services/yjsProvider.js - Yjs Provider Setup → Offline Document Cache: persists offline
client/src/services/yjsProvider.js - Rich Text Surface → Shared Yjs Document: binds edits
README.md - Document Editor → Presence and Titles: tracks peers and titles
README.md - Yjs Provider Setup → Yjs WebSocket Relay: syncs over WebSocket
README.md - Yjs WebSocket Relay → Shared Yjs Document: relays updates
README.md - Socket.IO Events → Snapshot Store: loads and saves
server/index.js - Health Endpoint → Snapshot Store: counts documents
server/index.js