Menu and ordering app for the college canteen. Built with React, TypeScript and Vite.
You need Node 22 or newer.
npm install
npm run dev # opens on http://localhost:5173
npm test
Menu
- Search matches item names, ignoring capital letters and extra spaces.
- Category tabs, "Veg only" and search can all be used together.
- "Recommended" is the order items are listed in
src/lib/menu.ts. Sorting by price and switching back to Recommended should bring that order back. - Sold-out items can't be added.
Cart
- The cart is saved in the browser, so it's still there after a page reload.
- Setting an item's quantity to 0 removes it.
Bill
- Coupon codes work in any case (
save10is the same asSAVE10).FLAT50: ₹50 off orders of ₹200 or more.SAVE10: 10% off, but never more than ₹100.
- Delivery is ₹30, and free when the amount after discount is ₹300 or more.
- GST is 5% of the amount after discount.
The application integrates with Firebase for student authentication and real-time order storage:
- College Student Restriction: Account registration requires an official
@spit.ac.incollege email. - Protected Checkout: Placing orders requires an authenticated student account.
- Real-Time Orders: Orders are persisted in Firestore under the
orderscollection (userId,items,totalBill,status,timestamp) and synced live with status badges. - Graceful Fallbacks: Clear error prompts guide developers when Firebase credentials have not been configured yet.
To connect your own Firebase project for local development:
-
Create a Firebase Project:
- Go to the Firebase Console and create a new project.
-
Register a Web App:
- In Project Overview/Settings, click the Web (
</>) icon to register a web app. - Give it a nickname (e.g.,
canteen-connect) and register it. - Copy the
firebaseConfigkeys provided.
- In Project Overview/Settings, click the Web (
-
Enable Authentication Providers:
- Go to Build > Authentication > click Get Started.
- Under the Sign-in method tab:
- Email/Password: Click Email/Password, toggle Enable ON, and click Save.
- Google (Optional): Click Add new provider > Google, toggle Enable ON, pick a project support email, and click Save.
-
Create a Firestore Database:
- Go to Build > Firestore Database > click Create database.
- Select Start in test mode for development read/write permissions.
- Choose your nearest cloud location (e.g.,
asia-south1 (Mumbai)) and click Create.
-
Set Up Local Environment Variables:
- In the project root, create a
.envfile from the example template:cp .env.example .env
- Paste your Firebase config values into
.env:VITE_FIREBASE_API_KEY=your_api_key VITE_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com VITE_FIREBASE_PROJECT_ID=your_project VITE_FIREBASE_STORAGE_BUCKET=your_project.firebasestorage.app VITE_FIREBASE_MESSAGING_SENDER_ID=your_sender_id VITE_FIREBASE_APP_ID=your_app_id
- In the project root, create a
-
Start the Application:
npm run dev
src/lib/firebase.ts: Firebase client initialization (Auth & Firestore)src/lib/orders.ts: Firestore orders storage & real-time listenersrc/lib/auth-validation.ts: College domain (@spit.ac.in) validation logicsrc/context/AuthContext.tsx: React Context for authentication statesrc/components/Login.tsx&src/components/Signup.tsx: Authentication UIsrc/lib/menu.ts: menu data, search, filters, sortingsrc/lib/cart.ts: adding and removing itemssrc/lib/pricing.ts: coupons, delivery, GST, totalssrc/App.tsx,src/components/: the UIsrc/lib/*.test.ts: tests (Vitest)
Fork the repo, make your changes on a new branch, and open a pull request. Run npm test and npm run build first.
If you find a bug, open an issue with the steps to reproduce it, what you expected, and what happened instead.
Part of Source Start by CSI SPIT. MIT licensed.