How gopi-yenduru/real-time-collaborative-code-editor works
This is a full-stack collaborative code editor. Users authenticate, browse or create documents, then edit shared code in Monaco; Yjs updates and awareness travel through a binary WebSocket relay, while REST supports sharing and version history. The backend enforces document roles, persists update history and snapshots, and can relay collaboration across instances through Redis. The graph includes the documented frontend and backend capabilities; unsampled implementations are represented only at paths present in the tree, and some links rely on README descriptions.
Main entry points: EditorPage.jsx Editor workspace · api.js HTTP client · App.jsx App routing · SnapshotService.java Snapshot history
Components 24
Frontend experience
- App routing
realtime-editor-frontend/src/App.jsx - Sign-in UI
realtime-editor-frontend/src/pages/Login.jsx - Document dashboard
realtime-editor-frontend/src/pages/Dashboard.jsx - Editor workspace
realtime-editor-frontend/src/pages/EditorPage.jsx - Collaborative editor
realtime-editor-frontend/src/components/CollaborativeEditor.jsx
Identity and access
- Auth state
realtime-editor-frontend/src/store/authStore.js - HTTP client
realtime-editor-frontend/src/lib/api.js - Auth endpoints
src/main/java/com/codeeditor/controller/AuthController.java - Auth service
src/main/java/com/codeeditor/service/AuthService.java - JWT security
src/main/java/com/codeeditor/security/SecurityConfig.java
Documents and history
- Document endpoints
src/main/java/com/codeeditor/controller/DocumentController.java - Document access
src/main/java/com/codeeditor/service/DocumentService.java - History endpoints
src/main/java/com/codeeditor/controller/SnapshotController.java - Snapshot history
src/main/java/com/codeeditor/service/SnapshotService.java
Live collaboration
- Collaboration hook
realtime-editor-frontend/src/hooks/useCollaboration.js - Yjs WebSocket provider
realtime-editor-frontend/src/lib/collab.js - Binary WebSocket handler
src/main/java/com/codeeditor/websocket/YjsWebSocketHandler.java - Update relay service
src/main/java/com/codeeditor/service/CollaborationService.java
Persistence and relay
- CRDT update log
src/main/java/com/codeeditor/repository/DocumentUpdateRepository.java - Snapshot store
src/main/java/com/codeeditor/repository/DocumentSnapshotRepository.java - Document and membership data
src/main/java/com/codeeditor/repository/DocumentRepository.java - Redis Pub/Sub
src/main/java/com/codeeditor/redis/CollaborationRelay.java
Other components
- Collaborator
- MySQL
Connections 31
- Collaborator → App routing: uses
README.md - App routing → Sign-in UI: routes to
realtime-editor-frontend/src/App.jsx - App routing → Document dashboard: routes to
realtime-editor-frontend/src/App.jsx - App routing → Editor workspace: routes to
realtime-editor-frontend/src/App.jsx - Sign-in UI → Auth state: authenticates through
- Auth state → HTTP client: calls
realtime-editor-frontend/src/store/authStore.js - HTTP client → Auth endpoints: HTTP requests
README.md - Auth endpoints → Auth service: delegates to
src/main/java/com/codeeditor/controller/AuthController.java - Auth service → JWT security: issues JWT
src/main/java/com/codeeditor/service/AuthService.java - Auth service → Document and membership data: reads and writes users
src/main/java/com/codeeditor/service/AuthService.java - Document dashboard → HTTP client: requests documents
realtime-editor-frontend/src/pages/Dashboard.jsx - Editor workspace → HTTP client: requests document data
realtime-editor-frontend/src/pages/EditorPage.jsx - HTTP client → Document endpoints: HTTP requests
README.md - Document endpoints → Document access: delegates to
src/main/java/com/codeeditor/controller/DocumentController.java - Document access → Document and membership data: reads and writes
src/main/java/com/codeeditor/service/DocumentService.java - Editor workspace → Collaborative editor: renders
realtime-editor-frontend/src/pages/EditorPage.jsx - Editor workspace → Collaboration hook: sets up collaboration
realtime-editor-frontend/src/pages/EditorPage.jsx - Collaboration hook → Yjs WebSocket provider: creates provider
realtime-editor-frontend/src/hooks/useCollaboration.js - Yjs WebSocket provider → Binary WebSocket handler: binary frames
README.md - Binary WebSocket handler → Update relay service: dispatches updates
src/main/java/com/codeeditor/websocket/YjsWebSocketHandler.java - Update relay service → CRDT update log: stores and replays
src/main/java/com/codeeditor/service/CollaborationService.java - Update relay service → Redis Pub/Sub: publishes frames
src/main/java/com/codeeditor/service/CollaborationService.java - Redis Pub/Sub → Binary WebSocket handler: fans out across nodes
README.md - Editor workspace → History endpoints: requests history
realtime-editor-frontend/src/pages/EditorPage.jsx - History endpoints → Snapshot history: delegates to
src/main/java/com/codeeditor/controller/SnapshotController.java - Snapshot history → Snapshot store: reads and writes
src/main/java/com/codeeditor/service/SnapshotService.java - Snapshot history → Document access: checks access and updates text
src/main/java/com/codeeditor/service/SnapshotService.java - Snapshot history → Update relay service: resets state on restore
src/main/java/com/codeeditor/service/SnapshotService.java - CRDT update log → MySQL: persists log
README.md - Snapshot store → MySQL: persists versions
README.md - Document and membership data → MySQL: persists documents
README.md