A full-stack web application for managing mess operations, including user attendance, meal planning, inventory, and user subscriptions. Built with Node.js (Express, MongoDB) for the backend and Next.js (React, Tailwind CSS) for the frontend.
| Name | Contributions |
|---|---|
| Anas Najam | Built the entire backend (APIs, DB models, routes), designed the Admin Dashboard, and created the data flow diagrams (DFD & ER) for system planning and documentation. |
| Ayan Ahmad Khan | Developed the User Dashboard, designed the Landing Page and handled SEO, Authentication, and Deployment. |
- Mark daily meal attendance (breakfast, lunch, dinner)
- View personal attendance history on a calendar
- See today's menu and personal plan
- Secure authentication and role-based access
- Manage users, plans, menus, and inventory
- Assign plans to users
- View and manage all attendance records
- Frontend: Next.js, React, Tailwind CSS
- Backend: Node.js, Express.js, MongoDB (Mongoose)
- Authentication: JWT-based
- State Management: React Query
┌─────────────────┐
│ USER │
│ (Student/ │
│ Employee) │
└─────────┬───────┘
│
▼
┌─────────────────────────────────────────┐
│ │
│ MESS MANAGEMENT SYSTEM │
│ │
└─────────┬───────────────────┬───────────┘
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ ADMIN │ │ DATABASE │
│ (Manager) │ │ (MongoDB) │
└─────────────────┘ └─────────────────┘
┌─────────────┐ Login/Register ┌──────────────────┐
│ USER │◄────────────────────►│ 1. AUTHENTICATION │
└─────────────┘ │ PROCESS │
│ └──────────────────┘
│ Mark Attendance │ User Data
▼ ▼
┌──────────────────┐ ┌─────────────────┐
│ 2. ATTENDANCE │◄────────────────│ USER STORE │
│ MANAGEMENT │ User Info │ (Database) │
└──────────────────┘ └─────────────────┘
│ ▲
│ Attendance Data │
▼ │
┌─────────────────┐ │
│ ATTENDANCE STORE│ │
│ (Database) │ │
└─────────────────┘ │
│
┌─────────────┐ Manage Data ┌──────────────────┐
│ ADMIN │◄────────────────────►│ 3. ADMIN │
└─────────────┘ │ MANAGEMENT │
└──────┬───────────┘
│
┌───────────────────────┼───────────────────────┐
│ │ │
▼ ▼ ▼
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ PLAN STORE │ │ MENU STORE │ │INVENTORY │
│ (Database) │ │ (Database) │ │ STORE │
└─────────────┘ └─────────────┘ │(Database) │
└─────────────┘
┌─────────────┐ Meal Type & Time ┌──────────────────────┐
│ USER │──────────────────────►│ 2.1 VALIDATE │
└─────────────┘ │ MEAL TIME │
└──────┬───────────────┘
│ Valid Request
▼
┌──────────────────────┐
│ 2.2 MARK │
│ ATTENDANCE │◄─── User ID
└──────┬───────────────┘
│ Attendance Record
▼
┌─────────────┐ Attendance History ┌──────────────────────┐
│ USER │◄─────────────────────│ 2.3 RETRIEVE │
└─────────────┘ │ ATTENDANCE │
└──────┬───────────────┘
│ Query
▼
┌─────────────────┐
│ ATTENDANCE STORE│
│ (Database) │
└─────────────────┘
┌─────────────┐ CRUD Operations ┌──────────────────────┐
│ ADMIN │──────────────────────►│ 3.1 USER │
└─────────────┘ │ MANAGEMENT │
│ └──────┬───────────────┘
│ │ User Data
│ Plan Operations ▼
▼ ┌─────────────────┐
┌──────────────────────┐ │ USER STORE │
│ 3.2 PLAN │ │ (Database) │
│ MANAGEMENT │ └─────────────────┘
└──────┬───────────────┘
│ Plan Data
▼
┌─────────────────┐
│ PLAN STORE │
│ (Database) │
└─────────────────┘
┌─────────────┐ Menu Operations ┌──────────────────────┐
│ ADMIN │──────────────────────►│ 3.3 MENU │
└─────────────┘ │ MANAGEMENT │
│ └──────┬───────────────┘
│ │ Menu Data
│ Inventory Operations ▼
▼ ┌─────────────────┐
┌──────────────────────┐ │ MENU STORE │
│ 3.4 INVENTORY │ │ (Database) │
│ MANAGEMENT │ └─────────────────┘
└──────┬───────────────┘
│ Inventory Data
▼
┌─────────────────┐
│ INVENTORY STORE │
│ (Database) │
└─────────────────┘
- USER STORE: User profiles, authentication data, roles
- ATTENDANCE STORE: Daily meal attendance records
- PLAN STORE: Subscription plans and user assignments
- MENU STORE: Daily meal menus and schedules
- INVENTORY STORE: Stock items and quantities
- USER: Students/Employees who mark attendance and view menus
- ADMIN: Managers who oversee mess operations and data
┌─────────────────────────────────────┐
│ USER │
│─────────────────────────────────────│
│ userId (PK) │
│ name │
│ email (UNIQUE) │
│ mobileno │
│ role (0=Student, 1=Employee, 2=Admin)│
│ password │
│ cpassword │
│ profilePicture │
│ notificationPreferences │
│ timestamps │
└─────────────┬───────────────────────┘
│
│ 1:M (subscribes to)
│
┌─────────────▼───────────────────────┐
│ USERPLAN │
│─────────────────────────────────────│
│ _id (PK) │
│ userId (FK) ─────────────────────┐ │
│ planId (FK) ─────────────────┐ │ │
│ start_date │ │ │
│ end_date │ │ │
│ fees │ │ │
│ fee_status │ │ │
│ isavailable[] │ │ │
│ timestamps │ │ │
└─────────────┬────────────────┘ │ │
│ │ │
│ │ │
┌─────────────▼────────────────────┘ │
│ PLAN │
│─────────────────────────────────────│
│ planId (PK) │
│ plan_type │
│ plan_desc │
│ plan_price │
│ plan_duration │
│ max_users │
│ timestamps │
└─────────────────────────────────────┘
┌─────────────────────────────────────┐
│ ATTENDANCE │
│─────────────────────────────────────│
│ attendanceId (PK) │
│ userId (FK) ─────────────────────┐ │
│ date │ │
│ breakfast: { │ │
│ status (present/absent) │ │
│ timestamp │ │
│ } │ │
│ lunch: { │ │
│ status (present/absent) │ │
│ timestamp │ │
│ } │ │
│ dinner: { │ │
│ status (present/absent) │ │
│ timestamp │ │
│ } │ │
│ timestamps │ │
└─────────────┬───────────────────────┘
│
│ M:1 (belongs to)
│
┌─────────────▲───────────────────────┐
│ USER │
│ (Reference) │
└─────────────────────────────────────┘
┌─────────────────────────────────────┐
│ MENU │
│─────────────────────────────────────│
│ menuId (PK) │
│ date │
│ breakfast: { │
│ name, description, price, │
│ ingredients[], nutritional_info │
│ } │
│ lunch: { │
│ name, description, price, │
│ ingredients[], nutritional_info │
│ } │
│ dinner: { │
│ name, description, price, │
│ ingredients[], nutritional_info │
│ } │
│ is_special │
│ timestamps │
└─────────────────────────────────────┘
┌─────────────────────────────────────┐
│ INVENTORY │
│─────────────────────────────────────│
│ inventoryId (PK) │
│ name │
│ storeType │
│ qty │
│ usedqty │
│ remainqty │
│ single_price │
│ date │
│ timestamps │
└─────────────────────────────────────┘
- One user can have multiple subscription plans over time
- Foreign Key:
userIdin USERPLAN referencesuserIdin USER
- One plan can be assigned to multiple users
- Foreign Key:
planIdin USERPLAN referencesplanIdin PLAN
- One user can have multiple attendance records
- Foreign Key:
userIdin ATTENDANCE referencesuserIdin USER - Unique constraint:
userId + date(one attendance record per user per day)
- MENU: Standalone daily menu records
- INVENTORY: Standalone inventory management records
| Entity | Description | Key Attributes |
|---|---|---|
| USER | System users (students, employees, admins) | userId, email, role, authentication data |
| PLAN | Subscription plans offered by mess | planId, plan_type, plan_price, duration |
| USERPLAN | Junction table linking users to their subscribed plans | userId (FK), planId (FK), dates, fees |
| ATTENDANCE | Daily meal attendance records | userId (FK), date, meal statuses & timestamps |
| MENU | Daily meal menus with nutritional info | menuId, date, meal details |
| INVENTORY | Stock management for mess supplies | inventoryId, quantities, prices |
- Primary Keys: Auto-incremented IDs for each entity
- Foreign Keys: Maintain referential integrity
- Unique Constraints:
- User email addresses
- User-Date combination for attendance
- Indexes: On userId, date fields for performance
MessManagement/
backend/
Controller/
Models/
Routes/
config/
database/
index.js
package.json
frontend/
src/
app/
components/
hooks/
services/
utils/
public/
package.json
tailwind.config.js
- Node.js (v16+ recommended)
- MongoDB (local or Atlas)
- Navigate to the backend folder:
cd MessManagement/backend - Install dependencies:
npm install
- Create a
.envfile with your MongoDB URI and JWT secret:MONGODB_URI=your_mongodb_connection_string JWT_SECRET=your_jwt_secret
- Start the backend server:
The backend runs on
npm start
http://localhost:5000by default.
- Navigate to the frontend folder:
cd MessManagement/frontend - Install dependencies:
npm install
- Start the frontend development server:
The frontend runs on
npm run dev
http://localhost:3000by default.
- Register or log in as a user or admin.
- Mark your attendance for each meal.
- View your attendance history in the calendar.
- Admins can manage users, plans, menus, and inventory from the dashboard.
POST /auth/register- Register new userPOST /auth/login- User loginPOST /auth/logout- User logout
GET /user/profile/:userId- Get user profilePUT /user/profile/:userId- Update user profileGET /user/all- Get all users (Admin only)
GET /attendance/user/:userId- Get user attendance historyGET /attendance/today/:userId- Get today's attendancePOST /attendance/mark/:userId- Mark meal attendance
GET /plan/all- Get all plansPOST /plan/create- Create new plan (Admin only)PUT /plan/update/:planId- Update plan (Admin only)DELETE /plan/delete/:planId- Delete plan (Admin only)
GET /userplan/user/:userId- Get user's plansPOST /userplan/assign- Assign plan to user (Admin only)
GET /menu/today- Get today's menuGET /menu/date/:date- Get menu by datePOST /menu/create- Create menu (Admin only)PUT /menu/update/:menuId- Update menu (Admin only)
GET /inventory/all- Get all inventory itemsPOST /inventory/add- Add inventory item (Admin only)PUT /inventory/update/:inventoryId- Update inventory (Admin only)DELETE /inventory/delete/:inventoryId- Delete inventory (Admin only)
# Database Configuration
MONGODB_URI=mongodb://localhost:27017/mess-management
# or for MongoDB Atlas:
# MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/mess-management
# JWT Configuration
JWT_SECRET=your_super_secret_jwt_key_here
JWT_EXPIRE=7d
# Server Configuration
PORT=5000
NODE_ENV=development
# CORS Configuration (optional)
FRONTEND_URL=http://localhost:3000# API Configuration
NEXT_PUBLIC_API_URL=http://localhost:5000
NEXT_PUBLIC_APP_NAME=Mess Management System-
Production Environment Setup:
# Install PM2 for process management npm install -g pm2 # Start application with PM2 pm2 start index.js --name "mess-backend" pm2 startup pm2 save
-
Environment Variables:
- Set
NODE_ENV=production - Use MongoDB Atlas for cloud database
- Configure proper JWT secrets
- Set
-
Build for Production:
npm run build npm start
-
Deploy to Vercel (Recommended):
npm install -g vercel vercel
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow ESLint configuration for code style
- Write meaningful commit messages
- Test your changes thoroughly
- Update documentation when adding new features
-
MongoDB Connection Issues:
# Check if MongoDB is running sudo systemctl status mongod # Start MongoDB service sudo systemctl start mongod
-
Port Already in Use:
# Kill process on port 5000 npx kill-port 5000 # Or change PORT in .env file
-
JWT Token Issues:
- Ensure JWT_SECRET is set in environment variables
- Check token expiration settings
- Clear browser localStorage/cookies
-
CORS Issues:
- Verify FRONTEND_URL in backend .env
- Check corsOptions.js configuration
- Database Indexing: Indexes are created on userId and date fields
- API Caching: Consider implementing Redis for frequent queries
- Image Optimization: Use Next.js Image component for profile pictures
- Bundle Size: Regularly audit and optimize bundle size
- Authentication: JWT tokens with secure expiration
- Authorization: Role-based access control (RBAC)
- Data Validation: Input validation on both frontend and backend
- Password Security: Bcrypt hashing for password storage
- Environment Variables: Sensitive data stored in .env files
- Push notifications for meal reminders
- QR code-based attendance marking
- Integration with payment gateways
- Mobile app development (React Native)
- Advanced analytics and reporting
- Multi-language support
- Offline functionality with PWA
For support and questions:
- Email: [your-email@example.com]
- GitHub Issues: Repository Issues
- Documentation: This README and inline code comments
- Update meal times, plan types, and menu items in the backend models/controllers as needed.
- Tailwind CSS is used for easy UI customization.
MIT License - see the LICENSE file for details.
Built with ❤️ for efficient mess management