How soham842op/livedocs works
LiveDocs is a collaborative document editor with JWT-protected Yjs synchronization, durable snapshots, document management, and an AI writing copilot. The main workflow is a user editing in the frontend, syncing document state through the WebSocket service, and invoking backend AI features over REST; the backend also handles auth and document metadata. The graph preserves the documented sharing, upload, RAG, inconsistency, caching, and observability capabilities. Some route and UI wiring is unsampled, so those links are omitted or marked unverified.
Main entry points: EditorWrapper.tsx Editor workflow · Editor.tsx Collaborative editor · main.py AI request routes · index.js WebSocket gateway
Components 22
Frontend
- Auth UI
frontend/src/app/login/page.tsx - Auth context
frontend/src/context/AuthContext.tsx - Document dashboard
frontend/src/components/Sidebar.tsx - Editor workflow
frontend/src/components/EditorWrapper.tsx - Collaborative editor
frontend/src/components/Editor.tsx - Formatting toolbar
frontend/src/components/Toolbar.tsx - Suggestions panel
frontend/src/components/SuggestionsPanel.tsx - Inconsistency panel
frontend/src/components/InconsistenciesPanel.tsx - Q&A panel
frontend/src/components/QAPanel.tsx - Section extraction
frontend/src/lib/extract-sections.ts - Supabase client
frontend/src/lib/supabase.ts
Realtime sync
- WebSocket gateway
sync-server/index.js - Snapshot persistence
sync-server/persistence.js
Backend API
- Auth and document API
backend/main.py - AI request routes
backend/main.py
AI services
- LLM generation
backend/llm.py - Embedding and retrieval
backend/embeddings.py - LLM cache and events
backend/observability.py
Data stores
- Supabase Postgres
- S3 snapshots
Other components
- Document user
- Gemini API
Connections 25
- Document user → Auth UI: signs in
README.md - Document user → Document dashboard: manages documents
- Document user → Collaborative editor: edits document
README.md - Auth UI → Auth context: uses sessions
- Editor workflow → Collaborative editor: renders
frontend/src/components/EditorWrapper.tsx - Collaborative editor → Formatting toolbar: renders
frontend/src/components/Editor.tsx - Editor workflow → Section extraction: extracts sections
frontend/src/components/EditorWrapper.tsx - Editor workflow → Suggestions panel: renders
frontend/src/components/EditorWrapper.tsx - Editor workflow → Inconsistency panel: renders
frontend/src/components/EditorWrapper.tsx - Editor workflow → Q&A panel: renders
frontend/src/components/EditorWrapper.tsx - Collaborative editor → WebSocket gateway: syncs CRDT
frontend/src/components/Editor.tsx - Editor workflow → Auth and document API: calls REST API
frontend/src/components/EditorWrapper.tsx - Document dashboard → Auth and document API: manages documents
- WebSocket gateway → Snapshot persistence: registers persistence
sync-server/index.js - WebSocket gateway → Supabase Postgres: checks access
sync-server/index.js - Snapshot persistence → S3 snapshots: loads and saves snapshots
sync-server/persistence.js - Snapshot persistence → Supabase Postgres: reads and updates metadata
sync-server/persistence.js - Auth and document API → Supabase Postgres: reads and writes records
backend/main.py - AI request routes → LLM generation: calls generation
backend/main.py - AI request routes → Embedding and retrieval: retrieves chunks
backend/main.py - AI request routes → LLM cache and events: logs and caches
backend/main.py - LLM generation → Gemini API: requests completions
backend/llm.py - Embedding and retrieval → Gemini API: requests embeddings
backend/embeddings.py - Embedding and retrieval → Supabase Postgres: stores and searches vectors
backend/embeddings.py - LLM cache and events → Supabase Postgres: stores events and cache
backend/observability.py