How sanket-singh-sameer/himadriallinoneplatform works
1. This is a two-tier monorepo: a Node/Express backend in BACKEND/ and a React/Vite frontend in FRONTEND/. The frontend is a browser UI; the backend is the sole application server and API layer; MongoDB is the persistent store.
2. The backend entry point is BACKEND/server.js. It wires together DB connection (config/connectDB.js), route mounting, middleware, and likely global app configuration such as CORS, JSON parsing, cookies, and environment-based startup. All business features are exposed through versioned API routes under /api/v1/....
3. Data access is organized around Mongoose models in BACKEND/models/. The main domain entities are users, complaints, CGPI records, notices, mess menus, mess attendance, equipment, outpasses, and rooms. These models define the persistence boundary; controllers operate on them rather than talking to MongoDB directly.
4. Business logic is split by feature into controllers in BACKEND/controllers/: authentication, admin, complaints, CGPI, equipment, ID, mess, mess menu, and notices. This suggests a resource-oriented backend where each controller owns one domain slice and translates HTTP requests into model operations and side effects.
5. Authentication and authorization are layered through middleware. verifyToken.middleware.js handles logged-in user protection, checkIfAdmin.middleware.js gates admin-only operations, and checkIfCommitte.middleware.js plus the committee-specific checks enforce more granular role access for hostel committees like mess, discipline, gate, guard, cleaning, hostel, and common room. These middleware form the main security boundary around privileged endpoints.
6. The auth flow is email-centric and token-based. The README indicates college-email registration, OTP verification, password reset, and JWT-based login stored as HTTP-only cookies. Supporting utilities such as jwtTokenOperations.js, cookieOperations.js, and otpGeneration.js suggest the backend owns session/token issuance and verification rather than the frontend.
7. Messaging and notifications are handled by dedicated email integrations. There are two provider-specific folders, BACKEND/gmail/ and BACKEND/resend/, each with config and templates, indicating the app can send OTPs and notifications through email service abstraction. This is an external dependency boundary that supports signup verification and password reset.
8. Media/file handling and external storage are handled as separate utilities. utils/multer.js suggests multipart upload handling, while utils/imagekit.js indicates image/file assets are offloaded to ImageKit rather than stored in MongoDB. This matters for any diagram showing attachment flows, profile images, or document uploads.
9. Operational automation exists in utils/outpassScheduler.js, which implies scheduled backend jobs, likely for cleanup or expiry of time-bound outpass data. This is a background-process concern separate from synchronous request handling.
10. The frontend is a single-page app built with React 19 and Vite. src/main.jsx bootstraps the app, App.jsx likely defines routing/layout, and src/Pages/ contains the major screens: Home, Login, Signup, OTP verification, Forgot/Reset Password, Dashboard, Admin, Mark Attendance, Mess Snacks, and Role-Based ID. The UI is organized by page rather than feature modules.
11. Frontend state and API communication are centralized. src/store/authStore.js suggests client-side auth/session state, while Utils/axiosInstance.js and Utils/apiPaths.js provide a shared HTTP client and endpoint map. This means the frontend primarily consumes the backend API and does not own core business rules.
12. The main user journeys are: register with college email, verify OTP, log in, and then access student features such as complaints, notices, mess menu, attendance, and profile/ID functions. Admin and committee users follow a separate authenticated path to manage complaints, notices, mess menus, CGPI data, and role-restricted operations.
13. Static assets and documentation are mixed into the frontend public folder, including hostel documentation PDFs and a mess menu PDF. These are served directly to the browser and are not part of the API flow.
14. Overall, the architecture is a role-aware hostel management platform with clear boundaries: React UI on the client, Express controllers and middleware on the server, MongoDB-backed domain models in the middle, and external services for email and file/media handling.
Main entry points: controllers Controllers · server.js Server · App.jsx App Shell · routes API Routes
Components 20
Backend
Express API, domain logic, persistence, and integrations
- Server · Bootstraps the API server, middleware, routes, and startup flow
BACKEND/server.js - DB Connect · Creates the MongoDB connection used by the backend
BACKEND/config/connectDB.js - API Routes · Versioned resource routes for auth, admin, complaints, CGPI, equipment, ID, mess, menus, and notices
BACKEND/routes - Access Control · Token verification plus admin and committee role checks
BACKEND/middlewares - Controllers · Feature controllers that translate HTTP requests into domain operations
BACKEND/controllers - Models · Persistence models for users, complaints, CGPI, notices, mess, equipment, outpasses, and rooms
BACKEND/models - Auth Utils · JWT, cookies, OTP, and user-id helpers for login and verification flows
BACKEND/utils - Upload Utils · Multipart handling and image/file storage integration
BACKEND/utils - Outpass Job · Background task for time-based outpass processing
BACKEND/utils/outpassScheduler.js - Gmail Mailer · Gmail-based mail config and templates for OTP and notifications
BACKEND/gmail - Resend Mailer · Resend-based mail config and templates for OTP and notifications
BACKEND/resend
Frontend
React/Vite single-page client
- Main App · Bootstraps the SPA and application shell
FRONTEND/src/main.jsx - App Shell · Top-level client routing and layout coordination
FRONTEND/src/App.jsx - Pages · Home, auth, dashboard, admin, attendance, mess, and ID screens
FRONTEND/src/Pages - Auth Store · Shared frontend authentication/session state
FRONTEND/src/store/authStore.js - API Client · Shared axios instance and endpoint path map for backend calls
FRONTEND/Utils - Public Docs · Hostel and mess PDFs served directly to the browser
FRONTEND/public
External
Datastore and third-party services
- MongoDB · Persistent store for users and hostel domain data
- ImageKit · External storage for uploaded images and assets
- Email Services · Outbound email delivery for OTP and password reset flows
Connections 25
- Server → DB Connect: connects · Initializes the database connection at startup
- Server → API Routes: mounts · Registers versioned API routes
- Server → Access Control: uses · Applies request and role protection middleware
- Server → Auth Utils: uses · Configures auth/session helpers
- Server → Upload Utils: uses · Wires file upload and media handling
- API Routes → Controllers: delegates · Routes forward requests to feature controllers
- API Routes → Access Control: guards · Protects privileged endpoints with auth and role checks
- Controllers → Models: reads/writes · Controllers operate on Mongoose models
- Controllers → Auth Utils: uses · Auth, OTP, cookie, and token operations
- Controllers → Gmail Mailer: sends · Gmail-backed verification and notification mail
- Controllers → Resend Mailer: sends · Resend-backed verification and notification mail
- Controllers → Upload Utils: handles · Processes file uploads and media references
- Models → MongoDB: persists · Stores hostel domain records in MongoDB
- Upload Utils → ImageKit: uploads · Stores media assets externally
- Gmail Mailer → Email Services: delivers · Sends outbound email through Gmail
- Resend Mailer → Email Services: delivers · Sends outbound email through Resend
- Outpass Job → Models: jobs · Runs scheduled outpass maintenance against persisted data
- Main App → App Shell: boots · Starts the React application shell
- App Shell → Pages: renders · Composes the major screens and routes
- App Shell → Auth Store: uses · Reads and updates shared auth state
- App Shell → API Client: calls · Uses the shared API client for backend communication
- Pages → API Client: fetches · Pages consume backend endpoints through the shared client
- Pages → Auth Store: depends on · Pages react to authenticated user state
- API Client → API Routes: requests · Client talks to the Express API layer
- Public Docs → Pages: serves · Static PDFs support the UI and documentation