How habiitg/iitghabapp works
Project type and purpose
• This is a full-stack, multi-client gateway system called “Hostel Affairs Board.”
• Mobile clients (Flutter), several web admin/client portals (React/Vite), all talking to a versioned Node.js/Express REST API, backed by MongoDB Atlas. External services: Azure AD for OAuth, Firebase Cloud Messaging, AWS EC2/S3, Outlook SMTP.
File structure
• Top-level “frontend2” directory: Flutter mobile app (iOS/Android/Linux/Windows/macOS).
• Multiple React-based web frontends (hab-frontend, hostel-frontend, login-frontend, smc-frontend), each under its own directory.
• “server” directory: Node.js/Express API with two versions (v1 & v2), each using modular MVC structure under modules/, plus config, middleware, utils, scripts.
• Deployment/config files: ecosystem.config.js, GitHub Workflows in Flutter, AWS/S3 references, .env variables for MongoDB, Azure AD, JWT, Outlook.
README insights
• Confirms tech stack: Node.js 18, Express.js, MongoDB Atlas, Flutter 3.x, React 19.x
• Features: Complaint management, role-based access, QR mess cards, JWT + Azure OAuth
• Infrastructure: AWS EC2/S3, CI/CD via GitHub Workflows
Main components & their interactions
a. Clients:
• Mobile App (Flutter): /frontend2 – authentication, complaint UI, QR scanning, push notifications
• Admin Web Portal (React): /hab-frontend – complaint approvals, mess management, user stats
• Additional Web Clients: /hostel-frontend, /login-frontend, /smc-frontend for role-specific tasks
b. API Layer:
• API Gateway/Express Servers (server/v1 & server/v2) – versioned REST endpoints
• Middleware: JWT authentication (authenticateJWT.js), Azure AD OAuth guard (requireMicrosoftAuth.js)
• Modules (MVC): auth, user, hostel, mess, mess_change, feedback, bug_report, notification, profile, qr
c. Data Storage:
• MongoDB Atlas – collections per module (e.g., users, feedbacks, messMenus, hostelAllocations)
• AWS S3 – static assets/uploads via Cloudinary or direct S3 integration
d. External Services:
• Azure AD – OAuth for Outlook login and JWT token issuance
• Firebase – FCMToken model + firebase.js for push notifications
• Outlook SMTP – sending emails for notifications
• AWS EC2 – hosts the Node server
• AWS S3 – asset storage
Architectural patterns & design principles
• Layered architecture: client → API layer → business logic → data layer
• Modular MVC/REST: each feature in its own module folder with controller, model, route
• Versioning: v1 and v2 subdirectories to support breaking changes without downtime
• Separation of concerns: distinct mobile vs multiple web frontends; all share same API
• Dependency injection via config files (config/default.js, .env)
• Asynchronous scheduling: autoFeedbackScheduler, autoMessChangeScheduler, autoGuestCleanupScheduler