The Mess Management System is designed to streamline mess operations in IIT Delhi. It provides a complete solution for managing multiple mess facilities, including user registration, meal planning, token-based meal access, rebate processing, and staff verification systems.
This is intended to be deployed inside IIT Delhi's BaadalVM (Internal Cloud), and be accessible only to the Mess Managers, Secretaries and designated Mess Staff. We welcome everyone from inside and outside the IIT Delhi student community to collaborate and develop this further!
Link to Staff App
- Key Features
- Tech Stack
- Installation and Deployment
- How to Use as a Mess Manager
- Step-by-Step Instructions for Mess Managers
- Important Endpoints
- Code Structure
- Contributing to Code
- Multi-mess facility management
- User registration and photo management
- Token-based meal access system
- Rebate application and approval workflow
- Staff verification and meal token usage
- Role-based access control (Admin, Manager, Staff)
- Web interface for management operations
- (TODO) Meal planning with capacity and pricing
- Framework: NestJS (Node.js)
- Database: MongoDB with Mongoose ODM
- Session Management: Redis with connect-redis
- Authentication: Passport.js with local strategy
- File Upload: Multer with Sharp for image processing
- Template Engine/Frontend: Handlebars (HBS)
- Containerization: Docker with docker-compose
- Reverse Proxy: Nginx
- Node.js (v16 or higher)
- Docker and Docker Compose
- MongoDB (or use the provided Docker setup)
- IIT Delhi BaadalVM for production deployment
- Copy
sample.env
to.env
and configure the following variables:
PORT=8080
SESSION_SECRET=your_session_secret
MONGODB_STRING=mongodb://username:password@localhost:27017/database
MONGODB_USERNAME=your_mongodb_username
MONGODB_PASSWORD=your_mongodb_password
REDIS_PASSWORD=your_redis_password
MULTER_MEDIA_DESTINATION=./docker/media
# Build and start all services
docker-compose up -d
# View logs
docker-compose logs -f
# Stop services
docker-compose down
# Install dependencies
yarn
# Start development server
yarn start:dev
# Build for production
yarn build
yarn start
- Request for credentials creation and
- Login with your admin credentials
- Navigate to different sections based on your role
- Create Users: Add new students with kerberos ID, name, hostel, and mess assignment
- View Users: List all users in your assigned mess facilities
- Upload Photos: Add student photos for identification
- Create Meals: Set up meals with name, timing, capacity, price, and food items
- View Meals: Browse upcoming and past meals
- Generate Tokens: Create meal tokens for students
- Bulk Operations: Generate multiple tokens at once
- Issue Tokens: Create meal tokens for specific students
- Track Usage: Monitor token usage and meal attendance
- Verify Tokens: Staff can verify tokens at meal times
- Submit Applications: Students can apply for rebates
- Review Requests: Managers can approve/reject rebate applications
- Track Status: Monitor rebate approval workflow
-
Navigate to User Management
- Click on "Users" in the navigation menu
- Click the "Create User" button
-
Fill User Details
- Kerberos ID: Enter the student's kerberos ID (e.g., "ee1200461")
- Name: Enter the student's full name
- Hostel: Select the appropriate hostel from the dropdown
- Click "Create" to save the user
-
Verify User Creation
- Click "Get Users" to see the newly created user in the list
- The user will appear with their details and an active status
-
Access User QR Codes
- In the Users section, find the user you want to create QR codes for
- Click the "QR" button next to their name
-
Generate New QR Code
- A modal will open showing existing QR codes for that user
- Click "Create" to generate a new QR code
- The QR code will be displayed with creation time and status
-
QR Code Information
- Each QR code contains:
{kerberos: "user_id", token: "unique_token"}
. Unique Token is stored in database and cannot be guessed. kerberos is added as a backup to verify the QR offline if the service is down - QR codes are automatically set to "Active" status
- Creation time is automatically recorded
- Each QR code contains:
-
Access QR Codes
- Click the "QR" button next to any user in the Users list
- All QR codes for that user will be displayed in a modal
-
QR Code Details
- Each QR code shows:
- QR code image (scannable)
- Scope (usually "full")
- Creation time
- Status (Active/Disabled)
- Each QR code shows:
- Access QR Management
- Currently, QR codes can be disabled by updating their status in the database
- Contact system administrator for immediate QR code revocation
- Future versions will include direct revocation through the web interface
-
Access Meal Management
- Navigate to "Meals" in the web interface
- Click "Create Meal" button
-
Fill Meal Details
- Name: Enter meal name (e.g., "Breakfast", "Lunch", "Dinner")
- Start Time: Set the meal start time (date and time)
- End Time: Set the meal end time (date and time)
- Auto-Assign: Check the box to automatically assign tokens to all active users
-
Create the Meal
- Click "Create" to save the meal
- If auto-assign is checked, meal tokens will be automatically generated for all active users
-
Plan Your Schedule
- Determine meal times for each day
- Typical schedule: Breakfast (7:00-9:00), Lunch (12:00-14:00), Dinner (19:00-21:00)
-
Create Meals in Advance
- Create meals for the entire week or month in advance
- Use consistent naming (e.g., "Breakfast - Monday", "Lunch - Monday")
-
Bulk Creation Tips
- Create meals with similar time slots
- Use the auto-assign feature to save time
- Set appropriate start and end times for each meal type
-
Regular Schedule
- Create meals at least 24 hours in advance
- Use consistent timing for each meal type
- Set appropriate duration (typically 2 hours for each meal)
-
Capacity and Pricing
- Default capacity is set to 1000 users
- Default price is set to 0 (free meals)
- These can be customized in future versions
-
Monitoring
- Use "Get Meals" to view current, future, and past meals
- Monitor meal attendance through the token system
-
Download from ERP
- Access your ERP system
- Download the rebate Excel file containing student rebate applications
- Ensure the file contains the required columns:
- Entry Number
- Rebate Application No.
- From Date
- To Date
- Approval Status
- Days
- Reason For Rebate
- Rebate Type
- Rebate Amount (INR)
-
File Format Requirements
- File must be in Excel format (.xlsx or .xls)
- First sheet should contain the rebate data
- Column headers should match the expected format
-
Access Rebate Management
- Navigate to "Rebate" in the web interface
- Click "Create Rebates" button
-
Upload Excel File
- Click "Choose File" in the Excel File field
- Select your downloaded ERP Excel file
- Click "Create" to upload and process the file
-
Processing Results
- The system will automatically parse the Excel file
- Rebate applications will be created for each row
- Student kerberos IDs will be automatically converted from entry numbers
- The Excel file will be automatically deleted after processing
-
View Uploaded Rebates
- Click "Get Rebates" to see all rebate applications
- Active rebates (current date within range) will be highlighted in red
- Inactive rebates will be shown in light background
-
Rebate Information Displayed
- Rebate Application No.
- Student Entry Number (converted from kerberos)
- Student Name
- From Date
- To Date
- Approval Status
- Reason for Rebate
-
Common Issues
- File Format: Ensure the file is in proper Excel format
- Column Headers: Verify column names match expected format
- Date Format: Ensure dates are in proper format
- Entry Numbers: Verify entry numbers are in correct format
-
Error Handling
- If upload fails, check the file format and column headers
- Contact system administrator if issues persist
- Verify that all required columns are present in the Excel file
POST /auth/login
- User loginPOST /auth/logout
- User logoutGET /auth/myProfile
- Get user profilePOST /auth/createAdmin
- Create new admin user
POST /manager/createUser
- Create new student userGET /manager/getUsers
- List users in messPOST /manager/createAccessToken
- Generate access tokensGET /manager/getAccessTokens
- View user tokensPOST /manager/createMeal
- Create new mealGET /manager/getMeals
- List mealsPOST /manager/createMealToken
- Generate meal tokenPOST /manager/bulkCreateMealToken
- Bulk token generationGET /manager/getMealTokens
- View meal tokensPOST /manager/createRebate
- Create rebate applicationGET /manager/getRebates
- List rebate applicationsPOST /manager/uploadFile
- Upload files
GET /staff/verifyToken
- Verify meal tokenGET /staff/verifyWithoutToken
- Verify user without tokenGET /staff/getMealTokens
- Get user meal tokensPOST /staff/useMealToken
- Mark token as usedPOST /staff/uploadPhoto
- Upload user photoGET /staff/photo/:uri
- Get user photo
GET /web
- Main dashboardGET /web/login
- Login pageGET /web/users
- User management pageGET /web/meals
- Meal management pageGET /web/mealtokens
- Token management pageGET /web/rebate
- Rebate management page
Mess-Backend/
βββ π src/ # Main source code
β βββ π auth/ # Authentication module
β β βββ auth.controller.ts
β β βββ auth.service.ts
β β βββ auth.module.ts
β β βββ π passport/ # Authentication guards and strategies
β β βββ admin-auth.guard.ts
β β βββ local-auth.guard.ts
β β βββ local.strategy.ts
β β βββ manager-auth.guard.ts
β βββ π manager/ # Manager operations module
β β βββ manager.controller.ts
β β βββ manager.service.ts
β β βββ manager.module.ts
β βββ π staff/ # Staff operations module
β β βββ staff.controller.ts
β β βββ staff.service.ts
β β βββ staff.module.ts
β βββ π web/ # Web interface module
β β βββ web.controller.ts
β β βββ web.module.ts
β βββ π schemas/ # MongoDB schemas
β β βββ accesstoken.schema.ts
β β βββ admin.schema.ts
β β βββ fooditem.schema.ts
β β βββ meal.schema.ts
β β βββ mealtoken.schema.ts
β β βββ mess.schema.ts
β β βββ rawmaterial.schema.ts
β β βββ rebate.schema.ts
β β βββ user.schema.ts
β βββ π utils/ # Utility functions
β β βββ config.ts
β β βββ parseExcel.ts
β β βββ utils.ts
β βββ app.controller.ts # Main application controller
β βββ app.module.ts # Main application module
β βββ app.service.ts # Main application service
β βββ index.d.ts # TypeScript declarations
β βββ main.ts # Application entry point
βββ π views/ # Handlebars templates
β βββ π partials/ # Reusable template components
β β βββ base_end.hbs
β β βββ base_start.hbs
β β βββ protected.hbs
β βββ index.hbs # Main dashboard page
β βββ login.hbs # Login page
β βββ logout.hbs # Logout page
β βββ meals.hbs # Meal management page
β βββ mealtokens.hbs # Token management page
β βββ rebate.hbs # Rebate management page
β βββ users.hbs # User management page
βββ π scripts/ # Utility scripts
β βββ createuser.py # Bulk user creation script
β βββ mailer.py # Email functionality
β βββ qr.py # QR code generation utilities
β βββ util.py # Common utilities
βββ π docker/ # Docker configuration
β βββ π media/ # File upload storage
β βββ π mongodb/ # MongoDB data persistence
β β βββ π data/
β βββ π nginx/ # Nginx configuration
β β βββ nginx.conf
β βββ π redis/ # Redis data persistence
βββ π upload/ # File upload directory
βββ π docker-compose.yml # Multi-container orchestration
βββ π Dockerfile # Application container definition
βββ π nest-cli.json # NestJS CLI configuration
βββ π package.json # Node.js dependencies and scripts
βββ π README.md # Project documentation
βββ π sample.env # Environment variables template
βββ π tsconfig.build.json # TypeScript build configuration
βββ π tsconfig.json # TypeScript configuration
βββ π yarn.lock # Yarn dependency lock file
Data Models:
- Admin: System administrators with role-based permissions
- User: Students with mess assignments and photos
- Mess: Mess facilities
- Meal: Meal definitions with timing, capacity, and pricing
- MealToken: Token-based meal access system
- Rebate: Student rebate applications and approvals
Authentication System:
- Session-based authentication using Redis
- Role-based access control (Admin, Manager, Staff)
- Passport.js integration for secure login
File Management:
- Photo upload and processing with Sharp
- Photos are stored in an internal BaadalVM. They are renamed for anonymity - so require database access to resolve the names.
- Excel file parsing for bulk operations
- Secure file storage and retrieval
Please connect with the BHM or DevClub team or Aditya Singh with your ideas before starting contribution.
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature
- Install dependencies:
yarn
- Set up environment variables
- Run development server:
yarn start:dev
- Follow TypeScript best practices
- Use NestJS decorators and patterns
- Maintain consistent code formatting with Prettier
- Write meaningful commit messages
- Add tests for new features
Disclaimer: This README has been generated by Cursor after analysing the code base. Make sure to connect with the maintainers for any clarifications regarding the usecases.