Skip to content

Repository files navigation

RestaurantName — Online Pre-Order System

A full-stack restaurant pre-ordering web app that lets customers browse the menu, build a cart, and confirm an order before arriving — so the food is ready when they walk in.

Built at HackLoop by team AVJR: Vamshaj Rai, Jeevan, Ravi Shashi, Adarsh H N.


Features

Customer Flow

  • Browse the full menu with live search
  • Add items to a persistent cart (survives page refresh via localStorage)
  • Confirm order with name, email, phone, and pickup/arrival time
  • Receive an email confirmation with a 5-digit order code via Mailgun
  • Optional: authenticate via QR code before ordering (auth gateway)

Admin Panel

  • Protected by server-side credential check (credentials stored in .env)
  • View all orders sorted by arrival time
  • Filter by status: Pending / Served / Canceled
  • Search by customer name, email, or phone
  • Mark orders as served or canceled, with an Undo button
  • View a daily/monthly summary popup (total orders, earnings, items served)
  • Export summary or full order list as PDF

Auth Gateway (optional)

  • QR-based passwordless login using RS256-signed JWTs
  • Session managed via WebSocket — no polling
  • Falls back to HS256 in local dev if JWT_PRIVATE_KEY is not set

Tech Stack

Layer Tech
Frontend HTML, CSS, JavaScript (vanilla)
Backend Node.js, Express
Database MongoDB (via Mongoose)
Email Mailgun
Auth JWT (RS256 / HS256 fallback), QR codes

Getting Started

Prerequisites

  • Node.js 18+
  • MongoDB (local or Atlas)
  • A Mailgun account (for order confirmation emails)

1. Clone the repo

git clone <repo-url>
cd Hackloop-project-AVJR

2. Set up the restaurant backend

cd restaurant-backend
cp .env.example .env
# Fill in MONGO_URI and MAILGUN_* in .env, then generate the admin credentials:
node scripts/setup-admin.js   # prompts for password, writes ADMIN_PASSWORD_HASH + ADMIN_JWT_SECRET
npm install
npm start

The server starts on http://localhost:5000.

3. Set up the auth gateway (optional)

cd auth-gateway
cp .env.example .env   # if one exists, or set vars manually
npm install
npm start

The auth gateway starts on http://localhost:4000.

4. Open the frontend

Use VS Code Live Server or any static file server:

customers-frontend/index.html   → customer-facing app
admin-frontend/login.html       → admin panel
auth-frontend/index.html        → QR login gateway

5. Configure API URLs (if not using localhost)

Each frontend has a config.js — edit API_BASE / AUTH_GATEWAY to match your server:

// customers-frontend/config.js
const CONFIG = {
  API_BASE: 'http://localhost:5000',
};

Environment Variables

Copy restaurant-backend/.env.example to .env and fill in:

Variable Description
MONGO_URI MongoDB connection string
MAILGUN_API_KEY Mailgun API key
MAILGUN_DOMAIN Mailgun sending domain
ADMIN_USERNAME Admin login username (default: admin)
ADMIN_PASSWORD_HASH bcrypt hash of the admin password — never store plaintext. Generate with node scripts/setup-admin.js
ADMIN_JWT_SECRET 32-byte hex secret for signing admin session JWTs. Also generated by setup-admin.js
CORS_ORIGIN Comma-separated allowed origins (e.g. http://127.0.0.1:5500)
PORT Server port (default: 5000)

Never commit your .env file. It is already listed in .gitignore.


Ordering Hours

Orders are accepted between 9:00 AM and 10:00 PM only. The frontend validates this before submission; the backend trusts this constraint.


Project Structure

Hackloop-project-AVJR/
├── customers-frontend/     # Customer-facing pages (Home, Menu, Order)
│   ├── config.js           # API base URL (edit for deployment)
│   ├── styles.css
│   ├── index.html          # Home
│   ├── index1.html         # Menu
│   ├── index2.html         # Order form
│   ├── index1.js           # Menu + cart logic
│   ├── index2.js           # Order submission
│   └── menu.json           # Menu items
├── admin-frontend/         # Admin order management panel
│   ├── config.js
│   ├── login.html
│   ├── admin.html
│   ├── admin.css
│   ├── login.js
│   └── admin.js
├── auth-frontend/          # QR-based auth gateway UI
│   ├── config.js
│   ├── index.html
│   └── auth.js
├── auth-gateway/           # Auth gateway server (Node.js, JWT, WebSocket)
└── restaurant-backend/     # Order API server (Express, MongoDB)
    ├── .env.example
    ├── server.js
    └── models/Order.js

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages