A full-stack web application for college students and canteen staff to manage food orders with QR code generation and verification.
- Login/Register with USN, Email, and Password
- View all active canteens
- Browse canteen menus by category
- Add items to cart and place orders
- Dummy payment system (no real transactions)
- Get unique Order ID and QR code for each order
- View order history
- Track order status (Confirmed/Served)
- Login/Register with Canteen ID, Email, and Password
- Toggle canteen status (Active/Inactive)
- Manage menu items (Add/Edit/Delete)
- View today's orders in real-time
- Verify orders by:
- Order number (e.g., 23)
- Full Order ID (e.g., M1-20251015-23)
- QR code scanning
- Auto-mapping of order numbers to full IDs
- Daily order counter (resets automatically)
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - ODM
- JWT - Authentication
- bcryptjs - Password hashing
- qrcode - QR code generation
- CORS - Cross-origin resource sharing
- React - UI library
- React Router - Navigation
- Axios - HTTP client
- TailwindCSS - Styling
- qrcode.react - QR code display
- Context API - State management
- Node.js (v14 or higher)
- MongoDB (running locally)
- npm or yarn
cd MESS-CANTEEN-BOOKINGcd backend
npm installCreate a .env file in the backend directory (already created):
MONGO_URI=mongodb://127.0.0.1:27017/canteenBooking
JWT_SECRET=your_super_secret_jwt_key_change_this_in_production
PORT=5000cd ../frontend
npm installMake sure MongoDB is running on your local machine:
mongodOr use MongoDB Compass to connect to mongodb://127.0.0.1:27017
cd backend
npm start
# or for development with auto-reload
npm run devBackend will run on: http://localhost:5000
cd frontend
npm startFrontend will run on: http://localhost:3000
{
usn: String (unique),
name: String,
email: String (unique),
passwordHash: String
}{
canteenId: String (unique),
name: String,
email: String (unique),
passwordHash: String,
status: String (active/inactive)
}{
canteenId: String,
name: String,
price: Number,
available: Boolean,
category: String,
description: String
}{
orderId: String (unique),
orderNumber: Number,
canteenId: String,
studentUSN: String,
items: Array,
totalAmount: Number,
status: String,
date: String,
qrCode: String
}{
canteenId: String,
date: String,
lastOrderCount: Number
}POST /api/auth/student/register- Register studentPOST /api/auth/student/login- Student loginPOST /api/auth/canteen/register- Register canteenPOST /api/auth/canteen/login- Canteen login
GET /api/canteens/active- Get all active canteensPATCH /api/canteens/toggle- Toggle canteen status (Auth)GET /api/canteens/profile- Get canteen profile (Auth)GET /api/canteens/orders/today- Get today's orders (Auth)POST /api/canteens/verify- Verify order (Auth)
GET /api/menu/:canteenId- Get menu by canteenGET /api/menu/my/items- Get canteen's menu items (Auth)POST /api/menu/add- Add menu item (Auth)PUT /api/menu/update/:itemId- Update menu item (Auth)DELETE /api/menu/delete/:itemId- Delete menu item (Auth)
POST /api/orders/create- Create order (Auth)GET /api/orders/my-orders- Get student's orders (Auth)GET /api/orders/:orderId- Get specific order (Auth)
Orders follow this format: <canteenId>-<YYYYMMDD>-<orderNumber>
Example: M1-20251015-23
M1- Canteen ID20251015- Date (October 15, 2025)23- Order number (23rd order of the day)
- Student browses canteens and adds items to cart
- Student confirms order (dummy payment)
- System generates:
- Unique Order ID
- Sequential order number for the day
- QR code with order details
- Student receives order confirmation with QR code
- Student shows QR code or order number at canteen
- Canteen verifies order and marks as served
- Register/Login with USN, email, and password
- Browse active canteens from dashboard
- Click on a canteen to view menu
- Add items to cart
- Go to cart and confirm order
- Get QR code and order number
- Show at canteen for pickup
- Register/Login with Canteen ID, email, and password
- Manage menu items (add/edit/delete)
- Toggle status to active/inactive
- View today's orders on dashboard
- Use "Verify Orders" to scan QR or enter order number
- System marks order as served
backend/
βββ config/
β βββ db.js
βββ models/
β βββ Student.js
β βββ Canteen.js
β βββ MenuItem.js
β βββ Order.js
β βββ DailyCounter.js
βββ routes/
β βββ auth.js
β βββ canteen.js
β βββ menu.js
β βββ order.js
βββ middleware/
β βββ auth.js
βββ .env
βββ package.json
βββ server.js
frontend/
βββ public/
β βββ index.html
βββ src/
β βββ components/
β β βββ ProtectedRoute.js
β βββ context/
β β βββ AuthContext.js
β β βββ CartContext.js
β βββ pages/
β β βββ Home.js
β β βββ student/
β β β βββ StudentLogin.js
β β β βββ StudentRegister.js
β β β βββ StudentDashboard.js
β β β βββ MenuPage.js
β β β βββ CartPage.js
β β β βββ OrderConfirmation.js
β β β βββ MyOrders.js
β β βββ canteen/
β β βββ CanteenLogin.js
β β βββ CanteenRegister.js
β β βββ CanteenDashboard.js
β β βββ ManageMenu.js
β β βββ VerifyOrder.js
β βββ services/
β β βββ api.js
β βββ App.js
β βββ index.js
β βββ index.css
βββ package.json
βββ tailwind.config.js
βββ postcss.config.js
- JWT-based authentication
- Password hashing with bcrypt
- Protected routes with role-based access
- Token stored in localStorage
- CORS enabled for local development
- Real payment gateway integration
- Email notifications
- SMS alerts
- Order scheduling
- Menu item images
- Rating and reviews
- Analytics dashboard
- Mobile app version
- This is a local-only application (no hosting)
- Dummy payment system (no real transactions)
- Daily order counters reset automatically at midnight
- QR codes contain order details in JSON format
- All data stored in local MongoDB
- Ensure MongoDB is running:
mongod - Check connection string in
.env - Verify port 27017 is not in use
- Backend: Change PORT in
.env - Frontend: Set PORT in environment or kill process on 3000
- Ensure backend is running on port 5000
- Check API_BASE_URL in
frontend/src/services/api.js
Built as a MERN Stack project for college canteen management.
This project is for educational purposes.
Happy Ordering! πππ