How jessthegpt/digital_archives works
Project Type & Purpose
• Full-stack collaborative editor built with Next.js (React), Lexical (rich-text), Liveblocks (real-time), Vercel AI SDK (AI toolbar).
Main Components
• Frontend (Next.js “app” folder): pages, React components, Lexical editor UI, custom hooks.
• Backend (Next.js API routes): serverless functions for chat, AI queries, screenshot, user search, Liveblocks auth.
• Real-time Service (Liveblocks): WebSocket sync of document state and cursors.
• AI Service (Vercel AI/Gemini): generates suggestions via API.
• Persistence (Liveblocks + optional DB): auto-save and state storage.
High‐Level Data Flow
1. User types in React/Lexical editor → local state update.
2. Edits sent over Liveblocks WebSocket → broadcast to other clients.
3. User triggers AI toolbar action → Next.js API route calls Vercel AI → response inserted into editor.
4. Collaborative state persisted by Liveblocks (and database if configured).
5. UI reflects real-time cursors, notifications, and AI-generated content.
Architectural Patterns
• Serverless functions (Next.js API routes) for backend logic.
• Real-time CRDT sync via Liveblocks.
• Plugin pattern in Lexical for draggable blocks, selection preservation.
• React hooks for local editor state and DOM events.