How m-deb-16/classlink works
Project type and purpose
• This is a full-stack MERN application called ClassLink.
• Purpose: educational resource and event organizer with user authentication, resource uploads, event management, and a discussion forum.
File structure
• Top-level split:
– client/ → React front end
– server/ → Node.js/Express back end
• client/
– src/components & src/pages → React UI components (cards, navbar, footer, forms, pages)
– src/utils/auth.js → front-end JWT handling
– public/index.html, vite.config.js → build & entry points
• server/
– models/ → Mongoose schemas (User, Resource, Event, Doubt)
– routes/ → Express routers for auth, resources, events, discussions
– middleware/ → auth (JWT verification) and upload (Multer/GridFS)
– server.js → Express app setup, connection to MongoDB, middleware, router mounting
• Config files:
– .env.sample → environment variables (JWT secret, Mongo URI, GridFS bucket)
– package.json in root orchestrates concurrently for running both client & server
Key architecture insights from README
• Frontend: React (+ React-Bootstrap & CSS) served by Vite dev server
• Backend: Express API exposes REST endpoints with JWT authentication
• Database: MongoDB for data + GridFS for file storage
• Authentication: JWT passed between client and server via HTTP headers
• File uploads: Multer (Express middleware) streams to GridFS in MongoDB
a. Main components
– Browser (User) → React SPA (client)
– API Layer (Express server)
– Authentication Service (JWT validation/issuance)
– Storage Layer
• MongoDB (collections for users, resources, events, doubts)
• GridFS bucket for uploaded files
– External services (optional): e.g., email/SMS for notifications
b. Relationships & interactions
– User interacts with React UI → triggers API calls (login, CRUD on resources/events, post doubts)
– API Layer uses auth middleware to verify JWT on protected routes
– API Layer interacts with MongoDB via Mongoose models
– File upload endpoints use Multer middleware to store files in GridFS
– API responses return JSON payloads to React
c. Architectural patterns/design principles
– Separation of concerns: UI vs. API vs. data persistence
– Component-based UI design in React
– MVC-style on server: routes (controller), models (Mongoose), middleware (service logic)
– RESTful API design
– Stateless authentication via JWT
d. Technologies & frameworks
– React, Vite, React-Bootstrap (UI layer)
– Node.js, Express, Multer, JWT (API layer)
– MongoDB, Mongoose, GridFS (persistence)