# mediwateyash/live-meet architecture

> Architecture diagram of the GitHub repository mediwateyash/live-meet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-06-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mediwateyash/live-meet
- Repository: https://github.com/mediwateyash/live-meet

## Overview

1. **High-level shape**
   - This is a two-process monorepo: a React client in `client/` and an Express/Mongo backend in `server/`.
   - The product is a role-based live learning platform with three main personas: **Admin**, **Instructor/Teacher**, and **Student**.

2. **Frontend boundary**
   - The frontend is a Vite app using React, React Router, TailwindCSS, and `socket.io-client`.
   - `client/src/main.jsx` and `App.jsx` act as the app entry/routing shell.
   - The UI is split into reusable layout and primitive components under `components/`, with role-specific pages under `pages/`.

3. **Frontend navigation and layout**
   - Layout components (`Navbar`, `Footer`, `PageLayout`, `StudentLayout`) separate public, authenticated, and student-focused shells.
   - Page folders map directly to product areas:
     - `pages/public` for marketing/browse/detail views
     - `pages/auth` for login/register/reset flows
     - `pages/admin`, `pages/instructor`, `pages/student` for role dashboards and workflows

4. **Frontend data access layer**
   - The `src/api/` folder is the client’s service boundary to the backend.
   - Separate API modules exist by domain: `auth`, `users`, `courses`, `instructor`, `admin`, `liveLectures`, `notifications`, and `progress`.
   - `axios.js` is the shared HTTP client, so all server interaction is centralized there rather than embedded throughout pages.

5. **Frontend state and cross-cutting concerns**
   - Global state is organized in `src/store/` with distinct stores for `auth`, `course`, and `ui`.
   - Custom hooks like `useAuth` and `useDebounce` handle auth-derived behavior and search/filter UX.
   - Shared UI atoms such as buttons, modals, badges, progress bars, skeletons, and notification bell support consistent interaction patterns across role dashboards.

6. **Backend request layer**
   - The server is an Express app (`server/index.js`) with route modules aligned to business domains: `auth`, `user`, `course`, `admin`, `instructor`, `liveLecture`, `notification`, and `progress`.
   - Each route delegates to a controller module, so routing is thin and business logic lives in controllers.

7. **Backend security and access control**
   - Authentication is JWT-based (`utils/generateToken.js`) and enforced through `middleware/auth.js`.
   - Role authorization is separated into `middleware/role.js`, which is the key boundary for Admin vs Instructor vs Student access.
   - This role gate is what makes the same backend serve different dashboards and capabilities.

8. **Backend domain model**
   - MongoDB/Mongoose models represent the core data graph:
     - `User`
     - `Course`
     - `Review`
     - `Progress`
     - `Notification`
     - `LiveLecture`
     - `InstructorRequest`
   - These models define the persistent state for enrollment, content, live sessions, notifications, and instructor onboarding.

9. **Real-time subsystem**
   - Live classroom behavior is handled separately from normal REST flows through Socket.io.
   - `server/socket/liveRoom.js` is the dedicated real-time module, likely managing room join/leave, presence, and live interaction for lecture sessions.
   - The frontend has matching live-session pages such as `student/LiveRoom.jsx` and `instructor/LiveLectures.jsx`, which are the client endpoints for that socket-driven experience.

10. **Notifications and async side effects**
   - `notificationController` plus `utils/notify.js` indicate server-side notification fanout to users.
   - `config/nodemailer.js` suggests email is part of the side-effect pipeline, likely for auth recovery and important account/course events.
   - `config/cloudinary.js` indicates external media storage for course assets or profile/media uploads.

11. **AI-assisted learning flow**
   - The README calls out Google Gemini integration, and the frontend includes `student/MCQGenerator.jsx`, which is the visible AI feature surface.
   - In architecture terms, AI is an auxiliary content-generation path, not the main request path: a user action triggers server-side generation, then the generated quiz/material is rendered back into the learning workflow.

12. **Operational/runtime boundaries**
   - The server depends on MongoDB, JWT secrets, and Gemini API credentials; the README also mentions Redis/BullMQ for heavier background processing, though no queue module is visible in the tree.
   - `server/seeds/index.js` suggests the backend can bootstrap initial data for development or demo environments.
   - The repo’s directory names are `client/` and `server/` even though the README refers to `frontend/` and `backend/`.

13. **End-to-end data flow**
   - Typical flow: a React page calls a domain API module → axios sends request to Express route → middleware authenticates/authorizes → controller reads/writes Mongoose models → response updates store/UI.
   - For live lectures, the flow splits: REST is used for setup/persistence, while Socket.io handles real-time classroom interaction.
   - For AI/notifications/email, the controller triggers an external service or utility, then persists or broadcasts the result back into the app state.

Main entry points: [`client/src/App.jsx`](https://github.com/mediwateyash/live-meet/blob/main/client/src/App.jsx) (Routing), [`client/src/pages/student`](https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/student) (Student pages), [`client/src/api`](https://github.com/mediwateyash/live-meet/tree/main/client/src/api) (API layer), [`server/controllers`](https://github.com/mediwateyash/live-meet/tree/main/server/controllers) (Controllers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_client_app["App shell<br/>React/Vite entry<br/>[main.jsx]"]
  node_client_routes["Routing<br/>React router<br/>[App.jsx]"]
  node_client_api["API layer<br/>axios services"]
  node_client_layouts["Layouts<br/>UI shells"]
  node_client_ui["UI kit<br/>shared components"]
  node_client_pages_public["Public pages<br/>browse/marketing"]
  node_client_pages_auth["Auth pages<br/>login/recovery"]
  node_client_pages_admin["Admin pages<br/>admin dashboard"]
  node_client_pages_instructor["Instructor pages<br/>teaching workflow"]
  node_client_pages_student["Student pages<br/>learning workflow"]
  node_client_store["State store<br/>global state"]
  node_client_hooks["Hooks"]
end

subgraph group_server["Server"]
  node_server_entry["Server app<br/>Express entry<br/>[index.js]"]
  node_server_routes["Routes<br/>REST routers"]
  node_server_auth["Auth guard<br/>JWT middleware"]
  node_server_controllers["Controllers<br/>domain logic"]
  node_server_models["Data models<br/>Mongoose models"]
  node_server_realtime["Live room<br/>Socket.io<br/>[liveRoom.js]"]
  node_server_utils["Shared utils<br/>server utilities"]
  node_server_config["Config"]
  node_server_seeds["Seed data<br/>bootstrap data<br/>[index.js]"]
end

node_client_app -->|"mounts"| node_client_routes
node_client_routes -->|"wraps"| node_client_layouts
node_client_routes -->|"serves"| node_client_pages_public
node_client_routes -->|"serves"| node_client_pages_auth
node_client_routes -->|"serves"| node_client_pages_admin
node_client_routes -->|"serves"| node_client_pages_instructor
node_client_routes -->|"serves"| node_client_pages_student
node_client_pages_public -->|"reads data"| node_client_api
node_client_pages_auth -->|"auth calls"| node_client_api
node_client_pages_admin -->|"admin calls"| node_client_api
node_client_pages_instructor -->|"teaching calls"| node_client_api
node_client_pages_student -->|"learning calls"| node_client_api
node_client_pages_student -->|"state"| node_client_store
node_client_pages_admin -->|"uses"| node_client_ui
node_client_pages_student -->|"uses"| node_client_ui
node_client_hooks -->|"supports"| node_client_pages_student
node_server_entry -->|"mounts"| node_server_routes
node_server_routes -->|"protects"| node_server_auth
node_server_routes -->|"delegates"| node_server_controllers
node_server_controllers -->|"persists via"| node_server_models
node_server_controllers -->|"uses"| node_server_utils
node_server_entry -->|"starts"| node_server_realtime
node_server_controllers -->|"integrates"| node_server_config
node_server_entry -->|"bootstraps"| node_server_seeds
node_client_api -->|"HTTP"| node_server_routes
node_client_pages_student -->|"socket"| node_server_realtime

click node_client_app "https://github.com/mediwateyash/live-meet/blob/main/client/src/main.jsx"
click node_client_routes "https://github.com/mediwateyash/live-meet/blob/main/client/src/App.jsx"
click node_client_api "https://github.com/mediwateyash/live-meet/tree/main/client/src/api"
click node_client_layouts "https://github.com/mediwateyash/live-meet/tree/main/client/src/components/layout"
click node_client_ui "https://github.com/mediwateyash/live-meet/tree/main/client/src/components/ui"
click node_client_pages_public "https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/public"
click node_client_pages_auth "https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/auth"
click node_client_pages_admin "https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/admin"
click node_client_pages_instructor "https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/instructor"
click node_client_pages_student "https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/student"
click node_client_store "https://github.com/mediwateyash/live-meet/tree/main/client/src/store"
click node_client_hooks "https://github.com/mediwateyash/live-meet/tree/main/client/src/hooks"
click node_server_entry "https://github.com/mediwateyash/live-meet/blob/main/server/index.js"
click node_server_routes "https://github.com/mediwateyash/live-meet/tree/main/server/routes"
click node_server_auth "https://github.com/mediwateyash/live-meet/tree/main/server/middleware"
click node_server_controllers "https://github.com/mediwateyash/live-meet/tree/main/server/controllers"
click node_server_models "https://github.com/mediwateyash/live-meet/tree/main/server/models"
click node_server_realtime "https://github.com/mediwateyash/live-meet/blob/main/server/socket/liveRoom.js"
click node_server_utils "https://github.com/mediwateyash/live-meet/tree/main/server/utils"
click node_server_config "https://github.com/mediwateyash/live-meet/tree/main/server/config"
click node_server_seeds "https://github.com/mediwateyash/live-meet/blob/main/server/seeds/index.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_client_app,node_client_routes,node_client_api,node_client_layouts,node_client_ui,node_client_pages_public,node_client_pages_auth,node_client_pages_admin,node_client_pages_instructor,node_client_pages_student,node_client_store,node_client_hooks toneBlue
class node_server_entry,node_server_routes,node_server_auth,node_server_controllers,node_server_models,node_server_realtime,node_server_utils,node_server_config,node_server_seeds toneAmber
```

## Components

### Client

React/Vite frontend for public, admin, instructor, and student experiences.

- [App shell](https://github.com/mediwateyash/live-meet/blob/main/client/src/main.jsx): React/Vite entry · Bootstraps the SPA and route composition. · `client/src/main.jsx`
- [Routing](https://github.com/mediwateyash/live-meet/blob/main/client/src/App.jsx): React router · Top-level app shell and route wiring. · `client/src/App.jsx`
- [API layer](https://github.com/mediwateyash/live-meet/tree/main/client/src/api): axios services · Centralized client-to-server domain services. · `client/src/api`
- [Layouts](https://github.com/mediwateyash/live-meet/tree/main/client/src/components/layout): UI shells · Public, authenticated, and student layout wrappers. · `client/src/components/layout`
- [UI kit](https://github.com/mediwateyash/live-meet/tree/main/client/src/components/ui): shared components · Reusable atoms and cards used across roles. · `client/src/components/ui`
- [Public pages](https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/public): browse/marketing · Home, browse, and course detail views. · `client/src/pages/public`
- [Auth pages](https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/auth): login/recovery · Register, login, and password reset flows. · `client/src/pages/auth`
- [Admin pages](https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/admin): admin dashboard · Management views for users, courses, instructors, and lectures. · `client/src/pages/admin`
- [Instructor pages](https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/instructor): teaching workflow · Course creation and live lecture management. · `client/src/pages/instructor`
- [Student pages](https://github.com/mediwateyash/live-meet/tree/main/client/src/pages/student): learning workflow · Learning, progress, live room, and AI quiz experiences. · `client/src/pages/student`
- [State store](https://github.com/mediwateyash/live-meet/tree/main/client/src/store): global state · Auth, course, and UI state management. · `client/src/store`
- [Hooks](https://github.com/mediwateyash/live-meet/tree/main/client/src/hooks): custom hooks · Auth-aware and debounce behavior shared by pages. · `client/src/hooks`

### Server

Express/Mongo backend with REST, auth, real-time, and domain services.

- [Server app](https://github.com/mediwateyash/live-meet/blob/main/server/index.js): Express entry · Starts the API server and connects runtime services. · `server/index.js`
- [Routes](https://github.com/mediwateyash/live-meet/tree/main/server/routes): REST routers · Thin route modules for each business domain. · `server/routes`
- [Auth guard](https://github.com/mediwateyash/live-meet/tree/main/server/middleware): JWT middleware · Authentication and role-based access control. · `server/middleware`
- [Controllers](https://github.com/mediwateyash/live-meet/tree/main/server/controllers): domain logic · Business logic layer behind the route modules. · `server/controllers`
- [Data models](https://github.com/mediwateyash/live-meet/tree/main/server/models): Mongoose models · Persistent domain state for users, courses, lectures, progress, and notifications. · `server/models`
- [Live room](https://github.com/mediwateyash/live-meet/blob/main/server/socket/liveRoom.js): Socket.io · Real-time lecture presence and interaction handling. · `server/socket/liveRoom.js`
- [Shared utils](https://github.com/mediwateyash/live-meet/tree/main/server/utils): server utilities · Token, response, error, and notification helpers. · `server/utils`
- [Config](https://github.com/mediwateyash/live-meet/tree/main/server/config): runtime config · Database, email, and media integrations. · `server/config`
- [Seed data](https://github.com/mediwateyash/live-meet/blob/main/server/seeds/index.js): bootstrap data · Initial development or demo data loading. · `server/seeds/index.js`

## Connections

- App shell → Routing: mounts · The app entry renders the routed shell.
- Routing → Layouts: wraps · Routes are organized by layout shells.
- Routing → Public pages: serves · Public routes render marketing and browse pages.
- Routing → Auth pages: serves · Auth routes render login and recovery flows.
- Routing → Admin pages: serves · Admin routes render management dashboards.
- Routing → Instructor pages: serves · Instructor routes render teaching workflows.
- Routing → Student pages: serves · Student routes render learning workflows.
- Public pages → API layer: reads data · Public pages fetch course and catalog data.
- Auth pages → API layer: auth calls · Auth screens call login and recovery endpoints.
- Admin pages → API layer: admin calls · Admin dashboards use domain API modules.
- Instructor pages → API layer: teaching calls · Instructor pages call course and live lecture services.
- Student pages → API layer: learning calls · Student pages call progress, course, and notification services.
- Student pages → State store: state · Learning UI consumes shared client state.
- Admin pages → UI kit: uses · Admin views reuse shared UI primitives.
- Student pages → UI kit: uses · Student views reuse shared UI primitives.
- Hooks → Student pages: supports · Hooks provide cross-page auth and search behavior.
- Server app → Routes: mounts · Express mounts the domain route modules.
- Routes → Auth guard: protects · Routes rely on auth and role middleware.
- Routes → Controllers: delegates · Routes forward requests to controllers.
- Controllers → Data models: persists via · Controllers read and write Mongo models.
- Controllers → Shared utils: uses · Controllers use shared response, token, and notify helpers.
- Server app → Live room: starts · Server initializes the live Socket.io room layer.
- Controllers → Config: integrates · Controllers depend on DB, mail, and storage config.
- Server app → Seed data: bootstraps · Seed script supports initial data loading.
- API layer → Routes: HTTP · Client service modules call the Express API.
- Student pages → Live room: socket · Live room pages connect to real-time classroom flows.
