How bhavesh10joshi/livelink works
What this project is (type + purpose)
LiveLink is a full-stack real-time chat application (WhatsApp-like) with:
• React + TypeScript + Tailwind frontend (Vite)
• Node.js + Express backend
• WebSockets for real-time messaging / live updates
• MongoDB + Mongoose as the primary datastore
• Supporting services: OAuth provider, Cloudinary (images), Nodemailer/SMTP (email/OTP/invites)
• Client–server separation
• Two communication planes: REST (request/response) + WebSocket (bi-directional, event-driven)
• Core domains: Auth, Users/Friends, Groups, Messaging (1:1 and group), Notifications, Invites, Media/Profile images
Frontend (frontend/)
Key architectural “modules” are clear from src/Pages/* and src/Components/*:
• Auth & password flows: SignInPage, CreateAnAccount, ForgotPass*, VerifyOtp, ChangePassword*
• Chat: ChattingDashboards/*, Chatting/* (separate U2U vs U2G views)
• Groups: CreateNewGroup, EditGroupInfo, AddMemberstoGroup, GroupInfo, DeleteGroupConfirm
• Users/Friends: SearchUserPage, FriendsSideBar, UserInfo
• Notifications: NotificationsDashboard
• Profile/settings: EditUserProfile, UserSettings, DeleteUserAccount
• API endpoint centralization: src/Config/ApiConfig.tsx
• Validation on client: src/ZodVaalidations/Zod.tsx
Backend (Backend/src/)
This is a classic Express modular routing structure:
• Entry point: src/index.ts
• DB connection: src/db/index.ts
• Routing by domain:
• Router/User/User.ts
• Router/Group/Group.ts
• Router/Messaging/UsertoUser/PersonalCommunication.ts
• Router/Messaging/UserToGroup/GroupCommunication.ts
• Router/Notifications/...
• Router/SendInvites/...
• Cross-cutting concerns:
• Middleware/Index.ts (auth, request parsing, etc.)
• ZodValidations/index.ts (API input validation)
• otp/otp.ts (OTP generation/verification flows)
• Nodemailer/emailvianode.ts (email transport)
• CloudinaryConfig/Cloudinary.ts (image hosting integration)
• uuid/index.ts, CurrentDateandTime/DateAndTime.ts
• membership/relationship checks: CheckForAFriend/*, CheckforaGroupMember/*
Backend → MongoDB: store/verify user credentials (bcrypt implied)
3. Backend → Browser: JWT (and possibly refresh token if present—README doesn’t mention refresh; keep it simple: JWT)
OAuth login
• Browser → OAuth Provider (redirect / popup)
• Browser/OAuth Provider → Backend (token exchange/verification)
• Backend → MongoDB (create/link user)
• Backend → Browser (JWT)
One-to-one messaging (real-time)
• Browser ↔ Backend (WebSocket): send message event
• Backend → MongoDB: persist message
• Backend ↔ Recipient Browser (WebSocket): deliver message + ack event (if implemented)
REST fallback usage if any exists (not obvious from tree; keep focus on WS).
Messaging
• Browser ↔ Backend (WebSocket): send group message event
• Backend: Check group membership (CheckforaGroupMember)
• Backend → MongoDB: persist message + group membership references
• Backend → group member sockets: broadcast
Invites + OTP/email
• Browser → Backend (REST): invite user / OTP request
• Backend → Email (Nodemailer/SMTP): send invite/OTP
• Backend → MongoDB: store OTP/invite status (conceptually)
Profile/group images
• Browser → Backend (REST): upload image (or request signature)
• Backend → Cloudinary: store asset, receive URL
• Backend → MongoDB: persist URL on user/group document
• Browser loads image directly from Cloudinary CDN URL
Notifications
• Browser → Backend (REST): fetch notification list, mark read
• Backend → MongoDB: read/update notifications
How to split components (practical grouping)
Instead of listing dozens of React components, show frontend as 5–7 blocks:
• Auth UI (SignIn/SignUp/Forgot/OTP)
• Chat UI (U2U + U2G dashboards)
• Groups UI (create/edit/add members)
• Notifications UI
• Profile/Settings UI
• API Client (ApiConfig + fetch/axios wrapper)
• WebSocket Client
Backend should be split close to the folder structure (high fidelity):
• User Router
• Router
• Messaging Router (U2U)
• Messaging Router (U2G)
• Notifications Router (Personal + Group)
• Invites Router
• Middleware (JWT/Auth)
• Validation (Zod)
• Services: OTP, Email, Cloudinary
• DB access layer (Mongoose)
• Browser
• React SPA (Auth / Chat / Groups / Notifications / Profile)
• WebSocket Client
• REST API Client
• Backend: Node/Express + WebSocket
• Middleware (JWT)
• Zod Validation
• Routers:
• User
• Group
• Messaging (U2U, U2G)
• Notifications (Personal, Group)
• Invites
• Services:
• OTP
• Email (Nodemailer)
• Cloudinary
• DB Layer (Mongoose)
• MongoDB
• Cloudinary
• OAuth Provider
• SMTP/Email Provider
• REST traffic for management actions
• WS traffic for realtime message delivery/broadcast
• Persistence to MongoDB for all durable state
• Side effects to Cloudinary + Email services
This will be “as detailed as possible” while still readable and faithful to the repository.