The Ultimate Campus Food Symphony.
Skip the queue. Level up your appetite. Win the leaderboard.
CampusQuickBite isn't just a food ordering app; it's a gamified ecosystem for university campuses. Built with a cutting-edge stack including React 19, Tailwind v4, and Three.js, it bridges the gap between hungry students and busy vendors with real-time sync, 3D immersion, and a deep secondary "hacker" meta-game.
| Layer | Technology |
|---|---|
| Frontend | React 19 ยท TypeScript ยท Vite ยท Tailwind CSS v4 |
| 3D & Animation | React Three Fiber ยท Three.js ยท Framer Motion |
| Backend | Node.js ยท Express 5 ยท TypeScript |
| State & Real-time | Socket.IO ยท React Context |
| Cache | Redis (circuit-breaker pattern, graceful fallback) |
| Infrastructure | Supabase (PostgreSQL) ยท Docker |
| Push Notifications | Firebase Cloud Messaging (FCM) ยท VAPID Web Push |
| Security & Monitoring | Sentry (Profiling + Error Tracking) ยท Helmet ยท Per-email Rate Limiting |
| DevOps & CI/CD | GitHub Actions ยท Playwright (E2E) ยท Swagger (API Docs) ยท Winston |
Every push to main triggers a comprehensive GitHub Actions workflow:
- Backend: TypeScript compile check + Jest unit tests.
- Frontend: Vite production build verification.
- E2E: Automated Playwright smoke tests to ensure critical paths (login/order) are never broken.
A comprehensive audit of the codebase resulted in the following hardening improvements:
| # | Area | Fix |
|---|---|---|
| 1 | Rate Limiting | Register limiter now keys on email (not shared IP) โ campus NAT no longer blocks mass sign-ups |
| 2 | CORS Policy | Local-IP regex gated to NODE_ENV !== 'production' โ internal IPs cannot bypass CORS in prod |
| 3 | Transactional Integrity | Outlet creation now rolls back the owner account if the outlet INSERT fails โ no more orphaned users |
| 4 | Cache Invalidation | Outlet status updates use cacheDelPattern('outlet:*') โ all derived keys invalidated atomically |
| 5 | Admin UI | Select-All checkbox correctly excludes the logged-in admin (self) from bulk-action count |
| 6 | Performance | Admin dashboard 30-second polling reduced from O(2N) requests โ O(1) per tick (N+1 fix) |
| 7 | Memory Safety | Cyberpunk audio engine uses useRef for AudioContext/interval โ eliminates stacked audio on re-render |
| 8 | Secret Management | Firebase credentials moved out of source code entirely; injected at build-time from .env via a custom Vite plugin |
Firebase configuration (API keys, sender IDs, app IDs) is never stored in source code.
frontend/public/firebase-messaging-sw.jscontains__PLACEHOLDER__tokens in the repo.- A custom
inject-sw-envVite plugin (vite.config.ts) replaces them with real values from.envat:- Dev time: via a dev-server middleware intercept.
- Build time: via a
closeBundlehook post-processingdist/firebase-messaging-sw.js.
For local setup: Copy
.env.exampleโ.envand fill in yourVITE_FIREBASE_*values from your Firebase Console.
- Instant Ordering: Browse vibrant, high-performance menus with advanced filtering.
- 3D Immersion: Interactive UI elements powered by Three.js for a premium feel.
- Real-Time Tracking: Live order status via Socket.IO โ no page refreshes needed.
- Push Notifications: FCM-powered background notifications with VAPID web push.
- QR Pickup: Secure, verified pickup with generated QR codes & downloadable receipts.
- PWA Ready: Installable on mobile with full offline-banner support.
- XP & Tier System: Earn XP for every order. Rank up from Bronze to the legendary Electric Blue.
- Elite Leaderboard: Compete with fellow students to be the campus "Top Foodie".
- Achievement Badges:
- ๐พ Shadow Member: Unlock the hidden hacker terminal.
- โ Caffeine Addict: Find the secret link in the ToS.
- ๐ Night Owl: Order during the witching hours for rare rewards.
- ๐น๏ธ Arcade King: Click the hidden trigger in the footer.
- ๐ป The Hacker: Activate Cyberpunk Mode.
Need to kill time? While waiting for your order, open the Multi-Tasking Game Hub.
- Play Snake, 2048, Flappy Bird, Breakout, Memory Game, and more in movable, floating windows.
- Run multiple games simultaneously in a "Mini-OS" environment.
- Live Kitchen Display: Manage incoming orders with a zero-latency interface.
- Menu Architect: CRUD operations with instant availability toggles.
- Revenue Analytics: Deep-dive into sales data with interactive Recharts.
- QR Scanner: Integrated scanner for lightning-fast order verification.
- Admin Console: Full user directory with bulk actions (ban/freeze), announcement broadcasts, review moderation, and DB nuke (with audio drama).
๐ต๏ธ Hidden Layers (Easter Eggs)
CampusQuickBite hides a dark-themed secret world:
- The Hacker Terminal: Type
/secretin the URL or find the portal in the footer. - Cyberpunk Mode: A developer secret transforms the entire UI with glitch effects and synthesized audio.
- Badge Hints: Double-click your avatar or visit
/hintsfor a cryptic guide to hidden achievements.
CampusQuickBite/
โโโ frontend/ # React 19 + Tailwind v4 + Three.js
โ โโโ public/
โ โ โโโ firebase-messaging-sw.js # SW template โ secrets injected at build
โ โโโ src/
โ โโโ pages/ # student / owner / admin / public views
โ โโโ components/ # shared + game hub components
โ โโโ hooks/ # context (Auth, Cart, Toast, Socketโฆ)
โ โโโ firebase/ # FCM config (reads from .env)
โโโ backend/ # Express 5 + Socket.IO + Sentry
โ โโโ src/
โ โโโ controllers/ # auth, outlet, order, menu, usersโฆ
โ โโโ services/ # cacheService (Redis), emailService, fcmService
โ โโโ middleware/ # auth, errorHandler, rate limiters
โ โโโ routes/v1/ # versioned API routes
โโโ database/ # Supabase Migrations & Seed Data
โโโ certs/ # SSL certificates for dev HTTPS
โโโ docker-compose.yml # Full-stack container orchestration
โโโ start.sh # Magic launcher (cleans ports + gen secrets)
โโโ bootstrap.sh # Initial environment setup wizardcp .env.example .env
# Fill in your Supabase, Firebase, VAPID, and email credentialssh ./start.shThis script will:
- Check for Node.js & Docker.
- Automatically generate secure
JWT_SECRETandJWT_REFRESH_SECRETif missing. - Sync
.envto bothfrontend/andbackend/. - Clear stale ports (5001, 5173, 3000).
- Launch both Backend and Frontend in parallel.
# Backend
cd backend && npm install && npm run dev
# Frontend (in a separate terminal)
cd frontend && npm install && npm run dev- API Docs:
http://localhost:5001/api/docs - App:
http://localhost:5173
| Service | Endpoint | Description |
|---|---|---|
| Authentication | /api/v1/auth/* |
JWT Login ยท Register ยท OTP ยท Google OAuth |
| Outlets | /api/v1/outlets/* |
CRUD + status management (Owner/Admin) |
| Menu | /api/v1/menu/* |
Menu items with Redis-cached responses |
| Orders | /api/v1/orders/* |
Place ยท Track ยท Receipt ยท Admin ledger |
| Analytics | /api/v1/analytics |
Owner-only revenue & heatmap insights |
| Push | /api/v1/push/* |
FCM token registration & broadcast |
| API Docs | /api/docs |
Interactive Swagger/OpenAPI |
| Health | /health |
Uptime & system monitoring |
Security First:
- Per-Email Rate Limiting: Registration throttled per registrant, not per shared IP โ campus NAT safe.
- Production CORS: Local-IP bypass only active in development mode.
- Sentry Guarded: Real-time error profiling and performance tracking.
- Secrets via Env: No credentials in source; Firebase config injected at build time.
MIT ยฉ CampusQuickBite Team