Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

40 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍽️ CampusBites β€” Smart Multi-Campus Canteen Management System

Next.js React Prisma Tailwind CSS Socket.io License

CampusBites is an enterprise-grade, real-time university food court pre-ordering, zero-click automated thermal printing, smart multi-college registration, and accounting platform.

πŸ“– For detailed academic and architectural documentation, please see PROJECT_DOCUMENTATION.md.


🌟 Key Features & Core Innovations

1. πŸ” Deep Mailbox Verification & Multi-College Registration

  • Direct SMTP Envelope Handshake: Connects directly to institutional mail exchange servers (MX) on port 25 (HELO, MAIL FROM, RCPT TO) to detect non-existent student/faculty addresses (550 5.1.1 NoSuchUser / Mailbox Not Found) before issuing OTPs.
  • Roll Number & Batch Syntax Engine: Validates institutional formats (e.g. 21bcaf59, 22bca101, 23cs42) and rejects incomplete prefixes like 21bcaf with actionable user guidance.
  • Zero-Default Typeahead: Clean onboarding with zero pre-selected colleges; search popup reveals dynamically as the user types.
  • 100% Strict Database OTP Security: Zero demo code bypasses; verified against unexpired prisma.otpVerification records.
  • Already-Registered User Guidance: 1-click password reset and sign-in shortcuts.
flowchart TD
    A["User enters Official ID / Roll No."] --> B["1. Syntax & Roll Number Pattern Check"]
    B -- "Incomplete (e.g. 21bcaf)" --> ERR1["Show Prompt: Add Roll Digits (e.g. 21bcaf59)"]
    B -- "Valid Format" --> C["2. Duplicate Account Check"]
    C -- "Already Registered" --> ERR2["Show 1-Click Reset / Sign-In Guide"]
    C -- "New User" --> D["3. DNS MX Lookup & Direct SMTP Envelope Handshake"]
    D --> E{"Mailbox Exists on College Server?"}
    E -- "Server returns 550 / NoSuchUser" --> ERR3["❌ 'Mailbox not found on college mail server'"]
    E -- "Mailbox Verified Active (250 OK)" --> F["4. Dispatch Branded HTML Email via Gmail SMTP"]
    F --> G{"Delivery Accepted?"}
    G -- "Accepted" --> H["5. Save OTP to Database & Start 60s Timer"]
Loading

2. πŸ“Ά Direct WebUSB / WebBluetooth Silent 0-Click Thermal Printing

  • Direct ESC/POS Driver: Background silent printing over WebSerial / WebUSB Virtual COM and WebBluetooth GATT without opening browser print modals.
  • Universal Hardware Compatibility: Works with Essae PR-55, TVS RP 3200, Epson TM-T88/TM-T20, Posiflex, NGX, and portable 58mm/80mm Bluetooth printers.
  • Automated KOT Dispatch: Automatically prints kitchen order tickets (KOT) on order arrival (PLACED), acceptance (CONFIRMED), or cancellation (REFUNDED).
  • Kitchen-Optimized Format: Large bold Token Number, Stall Name, Student Roll No, Pickup Slot, and Item List with special cooking notes (prices omitted for kitchen privacy).
sequenceDiagram
    autonumber
    actor Customer
    participant Server as CampusBites Backend
    participant VendorUI as Vendor Orders Portal
    participant HardwareDriver as WebUSB / WebBluetooth Driver
    participant ThermalPrinter as Thermal Printer (Essae / POS)

    Customer->>Server: Places Order & Completes Payment
    Server-->>VendorUI: Real-Time WebSocket Event (`NEW_ORDER`)
    VendorUI->>VendorUI: Play Sound Alert & Render Live Card
    VendorUI->>HardwareDriver: Dispatch Silent Print Job (Raw ESC/POS Binary)
    HardwareDriver->>ThermalPrinter: Stream Chunked Byte Stream (0-Click)
    ThermalPrinter-->>ThermalPrinter: Print Kitchen Order Ticket (KOT) Slip
Loading

3. ⚑ Zero-Lag Streaming Loaders & Food-Themed Skeletons

  • Next.js App Router Streaming Loaders (loading.tsx): Instant layout streaming across Student, Vendor, and Admin portals.
  • Component-Level Shimmer Skeletons: Custom placeholders for dish cards, order queues, analytics cards, and stall directories to eliminate dark or frozen screens during navigation.

4. 🍽️ "Dine-In Only" (No Takeaway / Parcel) Enforcement

  • Menu Level Control: Vendors can flag specific dishes (e.g. ice creams, sizzlers, hot soups) as Dine-In Only.
  • Cart & Checkout Guards: Prevents parcel packaging fee calculation and restricts checkout if a student attempts to order Dine-In only items for takeaway.

5. πŸ” Smart Global Dish Search

  • Searches across dish names, food categories, stall names, and descriptions with real-time highlight tags on canteen cards.

6. 🎟️ Smart 1-Day Event Guest Pass for External Attendees

  • Universal Guest Onboarding: Students, participants, guest speakers, and attendees visiting from other colleges/universities (for competitions, fests, hackathons, seminars) can generate a verified 1-Day Guest Pass without needing internal roll numbers or @kristujayanti.com email domains.
  • Deep Email OTP Verification: Real-time personal email mailbox check and 4-digit OTP dispatch.
  • Strict 24-Hour / Midnight Expiration: All guest sessions and meal ordering privileges automatically expire at 11:59:59 PM IST on the day of issuance.
  • Automatic Live Countdown Pill: Displays 🎟️ 1-Day Pass (College) Β· [Time Remaining] in the navbar with real-time timer and auto-signout upon expiry.
flowchart TD
    G1["Visiting Student / Guest arrives at Login"] --> G2["Clicks '1-Day Event Guest Pass'"]
    G2 --> G3["Enters Name, Home College, Fest/Event & Personal Email"]
    G3 --> G4["Real-Time MX Lookup & 4-Digit Email OTP Dispatch"]
    G4 --> G5["Enters OTP & Verifies"]
    G5 --> G6["System Generates Pass (GST-COLLEGE-XXXX)"]
    G6 --> G7["Pass Validated until 11:59:59 PM Today"]
    G7 --> G8["Access Canteens, Order Food via UPI & Receive Live Token Updates"]
    G8 --> G9{"Time >= 11:59:59 PM?"}
    G9 -- "Yes" --> G10["Auto-Expire Pass & Invalidate Session"]
    G9 -- "No" --> G8
Loading

7. πŸ›οΈ Custom Glassmorphism Multi-Campus Selector & Flawless Color Grading

  • Custom React Popover: Replaced primitive browser <select> with a dark/light mode color-graded popover (backdrop-blur-xl).
  • Interactive Campus Cards: Live canteen status indicators, dedicated location icons, descriptive campus taglines, and circular Marigold checkmark badges.
  • SSR Hydration Resilience: Complete suppressHydrationWarning and lifecycle mounting protection against browser autofill extensions injecting fdprocessedid.

πŸš€ Quick Start

1. Clone & Install

git clone https://github.com/Stevin5952/campusbites.git
cd campusbites
npm install

2. Configure Environment

Create a .env.local file (refer to .env.example):

DATABASE_URL=postgresql://user:password@host:5432/campusbites
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_secure_secret_key
CASHFREE_APP_ID=your_cashfree_app_id
CASHFREE_SECRET_KEY=your_cashfree_secret_key
CASHFREE_MODE=TEST
SMTP_HOST=smtp.gmail.com
SMTP_PORT=587
SMTP_USER=your_email@gmail.com
SMTP_PASS=your_gmail_app_password
RESEND_API_KEY=re_your_resend_key

3. Initialize Database

npx prisma generate
npx prisma db push

4. Run Development Server

npm run dev

Open http://localhost:3000 in your browser.


πŸ‘₯ Default Roles & Portals

Role Portal Path Description
Super Admin /admin University analytics, vendor onboarding, and global finance
Vendor /vendor/orders Live order queue, menu manager, sales report, printer settings
Student /student/dashboard Canteen exploration, menu ordering, multi-stall cart, and token tracker
Guest /student/dashboard 1-Day Event Guest Pass, canteen pre-ordering, and live digital pickup status

πŸ“„ Documentation

For full architectural diagrams, ER schemas, sequence flows, and methodology, view PROJECT_DOCUMENTATION.md.


πŸ‘€ Author

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages