How ruthvikmaturu/campus-connect works
Project Type and Purpose
• This is a full-stack web application (“Campus Connect”) that pairs junior and senior students for mentorship.
• Frontend: React + Vite; Backend: Node.js + Express; Database: MongoDB; Real-time chat; File storage (Cloudinary); Email notifications.
File Structure
• Top-level:
• public / index.html → Static assets and the HTML shell
• src/ → React app code (components, pages, context, utils, theme, assets)
• server/ → Express API (config, middleware, models, routes, scripts, utils)
• Config files (.eslintrc.js, tailwind.config.js, vite.config.js, package.json, etc.)
• Patterns:
• Frontend: Component-based UI with Context for Auth & Theme
• Backend: MVC-style (models in server/models, routes in server/routes, middleware in server/middleware)
• Scripts for seeding data and maintenance (server/scripts)
Key Architectural Insights from the README
• JWT authentication for students/admin
• Real-time personal & group chat
• File uploads (profile pics, event images) via Cloudinary
• Email notifications via a mail service module
• Admin vs student roles with separate dashboards and routes
Main Components and Their Interactions
A. Frontend (React App)
• Pages & Components (Login, Register, Chat, Events, Experiences, Admin Dashboard, etc.)
• Context Providers (AuthContext for JWT, ThemeContext for dark mode)
• HTTP client (axiosConfig.js) to call backend API
• Optional: Firebase integration (src/firebase.js) for notifications/push
B. API Server (Express)
• Entry point: server/server.js
• Middleware: auth.js, adminAuth.js for route protection
• Routes: Auth, Chat, GroupChat, Event, Experience, Student
• Controllers/Models: MongoDB schema definitions (User, Student, Chat, etc.)
• Utilities: cloudinary.js for file uploads, email/emailService.js for messaging
C. Data Layer
• MongoDB (hosted locally or in cloud like Atlas)
• Collections: users, students, events, experiences, chats, groupchats
D. External Services
• Cloudinary for media storage
• Email provider (SMTP/SendGrid, abstracted in emailService.js)
• (Optional) Firebase for push notifications
Architectural Patterns & Design Principles
• Separation of concerns:
• UI vs business logic vs data access
• RESTful API design
• JWT-based stateless authentication
• MVC structure on backend
• Component & Context patterns on frontend
• Real-time comms (consider representing WebSocket / Socket.io if used)