How jayvaja345/slatesync works
Project type and purpose
• This is a full-stack, real-time collaborative document editor.
• Frontend: a React/Vite single-page application (SPA)
• Backend: Node.js + Express REST API + Socket.IO for live collaboration
• Database: MongoDB (inferred from Mongoose-style schemas)
File structure
Top-level
• client/ – React source, components, pages, context and API-call helpers
• server/ – Express app (Config, Controllers, Models, Routes, Middleware)
• collab-server.js – standalone Socket.IO server for real-time events
• package.json, package-lock.json
client/
• src/Components – reusable UI pieces (Navbar, Banner, Panels, Error)
• src/Pages – route-level components: Dashboard, Editor (with CollabProvider), Login, Register
• src/Services – API call wrappers and helper functions
• Context/AuthContext – JWT‐based auth state management
server/
• Config/db.js – database connection setup
• Model/*.js – Mongoose schemas for User and Document
• Controller/userController.js – auth, registration, login logic
• Routes/Router.js – REST endpoints for user and document CRUD
• Sockets/documentSocket.js – real-time document events (join, sync, update)
• middleware/authenticate.js – JWT validation
• middleware/documentAccess.js – access control per document
Detail without over-splintering
• Four major components and their interactions
• Middleware steps (JWT check before controller)
• How AuthContext feeds the API layer in the client
• Collaboration flow: user types → WebSocket event → broadcast → local state update