How rakheshkrishna2005/livedocs works
Project Type and Purpose
• This is a full-stack, real-time collaborative document editing web application (“LiveDocs”).
• Frontend built with Next.js (React + TypeScript + TailwindCSS + shadcn/ui).
• Backend consists of an Express.js server (TypeScript) exposing both REST APIs and a Socket.IO server for live sync.
• MongoDB/Mongoose is used for persistent storage.
• Authentication via JWT in HTTP-only cookies.
File Structure
• app/ – Next.js 15 app directory: page routes under /app/api (REST endpoints), layout, pages for login/register/dashboard/document views, public viewer.
• components/ & components/ui/ – React UI components (shadcn/ui wrappers).
• context/ – React Context providers (user, document state).
• hooks/ – Custom React hooks (mobile detection, toasts).
• lib/ – Shared utilities: auth.ts, db.ts (MongoDB connection), Mongoose models.
• middleware.ts & next.config.mjs, tailwind.config.ts – Next.js middleware and configuration.
• server/ – Standalone Express.js + Socket.IO server, its own package.json and tsconfig.
• public/ & styles/ – Static assets and global CSS.
README for Additional Insights
• Key features: real-time collaboration, markdown support with live preview, cursor tracking, auto-save, sharing.
• Tech stack: Next.js (frontend), Express.js + Socket.IO (backend), MongoDB.
• Client → Next.js middleware → Auth → Pages/API → Socket.IO → Express → MongoDB
• Real-time sync channels (update, cursor_move, user_presence)
• Public sharing path with token validation