Skip to content

chirayu3003/CampusQuickBites

Repository files navigation

CampusQuickBite Logo

๐Ÿ” CampusQuickBite

The Ultimate Campus Food Symphony.
Skip the queue. Level up your appetite. Win the leaderboard.

React 19 Tailwind v4 Express 5 Supabase Three.js Redis


๐Ÿš€ Overview

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.


๐Ÿ› ๏ธ Cutting-Edge Tech Stack

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

๐Ÿ—๏ธ Robust Engineering

CI/CD Pipeline

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.

Reliability & Security Hardening (April 2026)

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

๐Ÿ” Secret Management

Firebase configuration (API keys, sender IDs, app IDs) is never stored in source code.

  • frontend/public/firebase-messaging-sw.js contains __PLACEHOLDER__ tokens in the repo.
  • A custom inject-sw-env Vite plugin (vite.config.ts) replaces them with real values from .env at:
    • Dev time: via a dev-server middleware intercept.
    • Build time: via a closeBundle hook post-processing dist/firebase-messaging-sw.js.

For local setup: Copy .env.example โ†’ .env and fill in your VITE_FIREBASE_* values from your Firebase Console.


๐ŸŽฎ Features That Wow

๐ŸŽ“ Student Ecosystem

  • 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.

๐Ÿ† The Gamification Engine

  • 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.

๐Ÿ•น๏ธ The Game Hub (Mini-OS)

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.

๐Ÿช Shop Owner & Admin Suite

  • 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:

  1. The Hacker Terminal: Type /secret in the URL or find the portal in the footer.
  2. Cyberpunk Mode: A developer secret transforms the entire UI with glitch effects and synthesized audio.
  3. Badge Hints: Double-click your avatar or visit /hints for a cryptic guide to hidden achievements.

๐Ÿ› ๏ธ Project Structure

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 wizard

๐Ÿšฆ Getting Started

1. Configure Environment

cp .env.example .env
# Fill in your Supabase, Firebase, VAPID, and email credentials

2. One-Step Launch

sh ./start.sh

This script will:

  • Check for Node.js & Docker.
  • Automatically generate secure JWT_SECRET and JWT_REFRESH_SECRET if missing.
  • Sync .env to both frontend/ and backend/.
  • Clear stale ports (5001, 5173, 3000).
  • Launch both Backend and Frontend in parallel.

3. Manual Setup

# 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

๐Ÿ›ก๏ธ API & Security

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.

๐Ÿ“œ License

MIT ยฉ CampusQuickBite Team

About

CampusQuickBites is a web-based platform designed to streamline food ordering within a campus environment, enabling students to browse menus, place orders, and manage requests efficiently.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors