How krishagarwal-44/project-desk works
1. Overall shape
- This is a two-tier MERN application: an Express/Node backend and a React/Vite frontend.
- The product domain is college project allocation and management, centered on three roles: Head, Mentor, and Student.
2. Frontend boundary
- The frontend lives under frontend/Allocation and is organized by role-specific pages plus shared shell components.
- Shared UI/layout pieces include Navbar, SideMenu, AuthContext, useAuth, and PrivateRoute, which together suggest centralized auth state and route protection.
3. Role-based UI subsystems
- pages/Head, pages/Mentor, and pages/Student are separate feature areas with their own dashboards and workflows.
- The Head area includes dashboard cards, document management, interview scheduling, project review, and messaging.
- The Mentor area focuses on assigned projects, forms, documentation, and messages.
- The Student area covers project idea submission, bank project selection, checklist completion, documentation, pipeline tracking, and messaging.
4. Frontend data access layer
- The frontend does not appear to call the backend directly from components; instead it uses service modules in src/services.
- There are dedicated service files for auth, common, head, mentor, and student, which mirrors the backend’s role-based API segmentation.
- src/utils/axios.js is the shared HTTP client boundary for all API traffic.
5. Backend API boundary
- The backend is a conventional Express API in backend/server.js, with route modules for auth, common, head, mentor, and student.
- Controllers are similarly separated by concern, which indicates a clear API surface per role and shared utility endpoints.
- authMiddleware.js is the main gatekeeper for protected routes and role-aware access control.
6. Domain model and persistence
- MongoDB is the persistence layer, accessed through Mongoose models in backend/models.
- The model set shows the core business objects: Student, Mentor, Head, ProjectIdea, ProjectBank, AssignedProject, Interview, Checklist, StudentChecklist, Document, Message, and the multi-stage form entities (Form1, Form2, Form3, StudentForm3).
- This indicates the system persists both identity data and the full project lifecycle state.
7. Project lifecycle flow
- The key business flow is: student submits or selects a project, mentor/head reviews it, forms and checklist items are completed, and progress/interview/document records are updated over time.
- AssignedProject, Interview, and the form/checklist models suggest the app tracks state transitions rather than just storing static records.
8. Document and file handling
- backend/middleware/upload.js and the backend/uploads directory show that file uploads are stored on the server’s filesystem.
- The Document model likely links uploaded files to users or projects, making file storage a separate artifact from metadata stored in MongoDB.
- This creates a two-part document boundary: binary files on disk and references/ownership in the database.
9. Messaging and announcements
- Message and the Head message pages indicate an internal communication subsystem.
- The Head role likely acts as the broadcast source, while mentors and students receive notices through their own dashboards.
- This is a domain feature, not a general chat system; it appears oriented toward department announcements and operational updates.
10. Common vs role-specific services
- commonController.js and commonRoutes.js imply shared backend operations used across roles, such as generic uploads, lookup data, or dashboard-wide utilities.
- The role-specific controllers and routes keep workflows isolated while still allowing a shared foundation for cross-cutting actions.
11. Operational infrastructure
- The backend depends on Node.js, Express, Mongoose, Multer, JWT, and bcrypt, which means authentication is token-based and passwords are hashed.
- The frontend uses React + Vite, with TailwindCSS and additional UI libraries noted in the README.
- There is no sign of a separate job queue, cache, or external storage service; persistence is primarily MongoDB + local upload storage.
12. How to diagram the system
- A good architecture diagram should show:
- Three client-facing role UIs on the frontend.
- A shared frontend API/service layer feeding a single backend.
- Backend routing separated into auth/common/head/mentor/student modules.
- Controllers calling Mongoose models.
- MongoDB as the main data store.
- Local upload storage as a separate file store linked to document records.
- JWT auth middleware protecting role-specific API paths.
Main entry points: headRoutes.js Role routes · headService.js Role services · Student.js Domain models · server.js API server
Components 18
Frontend
React/Vite client with role-based dashboards and shared auth/UI shell.
- App shell · Main frontend composition and routing entry.
frontend/Allocation/src/App.jsx - Auth state · Central auth context and helper hook for session state.
frontend/Allocation/src/context/AuthContext.jsx - Private route · Protects authenticated or role-restricted views.
frontend/Allocation/src/routes/PrivateRoute.jsx - Shell UI · Shared navigation and menu chrome for the client.
frontend/Allocation/src/components/Navbar.jsx - API client · Shared Axios boundary used by all service modules.
frontend/Allocation/src/utils/axios.js - Role services · Frontend service modules for auth, common, head, mentor, and student flows.
frontend/Allocation/src/services/headService.js - Head UI · Head dashboards, reviews, interviews, documents, and messaging screens.
frontend/Allocation/src/pages/Head/HeadDashboard.jsx - Mentor UI · Mentor pages for assigned projects, forms, documentation, and messages.
frontend/Allocation/src/pages/Mentor/MentorDashboard.jsx - Student UI · Student pages for ideas, bank projects, checklist, pipeline, and messages.
frontend/Allocation/src/pages/Student/StudentDashboard.jsx
Backend
Express API split by auth, shared, and role-specific routes/controllers.
- API server · Bootstraps the Node/Express backend and mounts routes.
backend/server.js - Auth routes · Authentication and registration endpoints.
backend/routes/authRoutes.js - Role routes · Shared and role-specific API surfaces for head, mentor, and student operations.
backend/routes/headRoutes.js - Auth middleware · Protects APIs with token validation and role-aware access control.
backend/middleware/authMiddleware.js - Auth controller · Handles login and registration logic.
backend/controllers/authController.js - Common controller · Shared backend operations used across roles.
backend/controllers/commonController.js - Role controllers · Head, mentor, and student workflow handlers.
backend/controllers/headController.js
Data & files
MongoDB models plus local upload storage for documents.
- Domain models · Persistent business objects for users, projects, forms, checklists, interviews, messages, and documents.
backend/models/Student.js - Upload store · Local server-side storage for uploaded files.
backend/uploads
Connections 20
- App shell → Shell UI: renders · Composes shared UI chrome and application views.
- App shell → Private route: protects · Wraps sensitive routes with access checks.
- Auth state → App shell: provides auth · Supplies session and user state to the app.
- Private route → Auth state: reads session · Uses auth state to decide access.
- Head UI → Role services: calls · Uses service modules for role operations.
- Mentor UI → Role services: calls · Uses service modules for role operations.
- Student UI → Role services: calls · Uses service modules for role operations.
- Role services → API client: uses · All API requests flow through the shared Axios client.
- API client → API server: HTTP API · Client requests hit the Express backend.
- API server → Auth routes: mounts · Registers authentication endpoints.
- API server → Role routes: mounts · Registers shared and role-specific endpoints.
- Auth routes → Auth controller: delegates · Auth routes invoke controller logic.
- Role routes → Common controller: delegates · Shared routes invoke common backend logic.
- Role routes → Role controllers: delegates · Role routes invoke head/mentor/student handlers.
- Role routes → Auth middleware: protects · Secures private API paths with JWT/role checks.
- Auth controller → Domain models: reads/writes · Auth operations persist identity data.
- Common controller → Domain models: reads/writes · Shared operations access core domain records.
- Role controllers → Domain models: reads/writes · Workflow handlers update lifecycle state and documents.
- Role controllers → Upload store: stores files · Upload flows write binaries to local filesystem storage.
- Domain models → Upload store: references · Document records point to uploaded files.