Skip to content

Repository files navigation

🌊 The Lighthouse | Full-Stack Fine Dining Restaurant App

A premium MERN stack restaurant web application solving a real problem in modern food apps β€” the "Black Box Menu" problem.

Built with MongoDB, Express, React (Vite), and Node.js. Features a live menu availability engine, persistent dietary profiles, a smart reservation wizard with in-booking menu preview, and an admin dashboard β€” all wrapped in an elegant dark luxury UI.

πŸ† Officially part of GirlScript Summer of Code 2026 (GSSoC'26)

Stars Β Β  Forks


πŸ“‘ Table of Contents


🎯 The Problem We Solve

Most restaurant websites and food apps share the same flaw β€” the "Black Box Menu" problem:

Guests book a table with zero context about what's actually available that day. They see static dish names but have no idea which items are sold out, seasonal, or unavailable β€” until they arrive.

This leads to:

  • No-shows when guests find their expected dish unavailable
  • Restaurants unable to update menus dynamically without code changes
  • Diners with dietary needs having to call ahead with basic questions
  • Zero personalization β€” everyone sees the same menu regardless of context

πŸ’‘ The Lighthouse's Solution

Problem Solution
Static menus Live Menu Engine β€” isAvailable flag per dish, toggled by admin in real-time
Dietary filter resets Dietary Profile β€” saved to user account, auto-applies on every visit
No pre-booking menu insight Reservation Menu Preview β€” Step 3 of the booking wizard shows tonight's available dishes
Requires dev to update menu Admin Dashboard β€” toggle dishes, add items, moderate reviews β€” no code needed

✨ Features

πŸ—„οΈ Live Menu Engine

  • All 18+ dishes stored in MongoDB with a live isAvailable boolean
  • Admins toggle availability from the dashboard β€” changes reflect instantly for all users
  • Public menu only shows available dishes; admins see all with sold-out indicators
  • GET /api/menu/tonight returns dishes relevant to the current time of day

πŸ₯— Persistent Dietary Profiles

  • Users set their dietary preference (Vegetarian / Non-Vegetarian / All) on signup
  • Allergen alerts stored per user (gluten, dairy, nuts, eggs, soy, shellfish, fish)
  • Menu auto-filters on every visit based on the saved profile β€” no re-selecting needed
  • Profile updatable anytime via PATCH /api/auth/me/dietary

πŸ“… Smart Reservation Wizard (4 steps)

  1. Date & Guests β€” pick date, validate against real table availability
  2. Time Slot β€” live slots from API showing tables remaining per slot
  3. Tonight's Menu Preview β€” see exactly what's available before confirming ← the differentiator
  4. Confirm β€” special requests, email confirmation

🎨 Premium UI & Design

  • Elegant dark luxury theme (#1a1714 bg, #c9a962 gold accents)
  • Fonts: Cormorant Garamond (headings) + Inter (body)
  • Glassmorphism sticky navbar, parallax hero, scroll animations
  • Fully responsive β€” mobile hamburger menu, fluid grid layouts

πŸ” Authentication & Roles

  • JWT-based auth with protect and authorize middleware
  • Three roles: user, staff, admin
  • Admin-only routes for menu management and review moderation
  • Tokens stored securely with auto-redirect on expiry

πŸ›‘οΈ Admin Dashboard

  • Live stats β€” total dishes, available now, sold out, reviews count
  • Toggle any dish available/sold-out with a single switch
  • Add new menu items with full schema (category, tags, allergens, prep time)
  • Moderate guest reviews β€” view and delete

⭐ Persistent Reviews

  • Reviews stored in MongoDB (replaces the original localStorage approach)
  • Authenticated users only can post reviews
  • Displayed on the Home page, fetched live from API

πŸ› οΈ Tech Stack

Backend

Technology Purpose
Node.js Runtime
Express.js REST API framework
MongoDB Database
Mongoose ODM β€” schemas, validation, indexes
JSON Web Token Authentication
bcryptjs Password hashing
Nodemailer Reservation confirmation emails
Helmet + CORS Security middleware

Frontend

Technology Purpose
React 19 UI framework
Vite Build tool & dev server
React Router v7 Client-side routing
Axios HTTP client with JWT interceptor
React Context Auth + Menu global state
Vanilla CSS Design system (CSS variables)

πŸ“ System Architecture

The Lighthouse is built on a decoupled MERN architecture comprising a React 19 SPA (/frontend), an Express REST API (/backend), and a legacy static client at the root.

Key architectural features include:

  • Live Menu Availability Engine: Real-time dish availability toggling and dynamic time-of-day menu filtering.
  • Double-Booking Protection: Database-level Mongoose partial unique index on { table: 1, date: 1, time: 1 } for confirmed reservations.
  • Security & Validation: JWT authentication, sliding-window rate limiting, and real-time DNS MX email domain verification.

πŸ“– For complete subsystem topology diagrams, sequence flows, database schema constraints, and contributor extension guidelines, see the full Architecture Documentation.


πŸ“‚ Project Structure

The-Lighthouse/
β”‚
β”œβ”€β”€ backend/                          ← Express + MongoDB API
β”‚   β”œβ”€β”€ .env.example                  ← Copy to .env and fill in values
β”‚   β”œβ”€β”€ .gitignore
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ server.js                     ← App entry, routes, CORS
β”‚   └── src/
β”‚       β”œβ”€β”€ config/
β”‚       β”‚   β”œβ”€β”€ database.js           ← MongoDB connection
β”‚       β”‚   └── seed.js               ← Seeds 18 menu items, tables, users
β”‚       β”œβ”€β”€ controllers/
β”‚       β”‚   β”œβ”€β”€ authController.js     ← Register, login, dietary profile
β”‚       β”‚   β”œβ”€β”€ menuController.js     ← CRUD + live toggle + tonight's menu
β”‚       β”‚   β”œβ”€β”€ reservationController.js
β”‚       β”‚   └── reviewController.js
β”‚       β”œβ”€β”€ middleware/
β”‚       β”‚   β”œβ”€β”€ auth.js               ← JWT protect + authorize(role)
β”‚       β”‚   └── validation.js
β”‚       β”œβ”€β”€ models/
β”‚       β”‚   β”œβ”€β”€ MenuItem.js           ← Live menu (isAvailable flag)
β”‚       β”‚   β”œβ”€β”€ Reservation.js
β”‚       β”‚   β”œβ”€β”€ Review.js             ← Persistent reviews
β”‚       β”‚   β”œβ”€β”€ Table.js
β”‚       β”‚   └── User.js               ← + dietaryPreference, allergenAlerts
β”‚       β”œβ”€β”€ routes/
β”‚       β”‚   β”œβ”€β”€ authRoutes.js
β”‚       β”‚   β”œβ”€β”€ menuRoutes.js
β”‚       β”‚   β”œβ”€β”€ reservationRoutes.js
β”‚       β”‚   └── reviewRoutes.js
β”‚       └── services/
β”‚           β”œβ”€β”€ availabilityService.js
β”‚           └── emailService.js
β”‚
β”œβ”€β”€ frontend/                         ← React + Vite SPA
β”‚   β”œβ”€β”€ .gitignore
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ vite.config.js                ← Dev proxy β†’ localhost:5000
β”‚   β”œβ”€β”€ package.json
β”‚   └── src/
β”‚       β”œβ”€β”€ api/
β”‚       β”‚   β”œβ”€β”€ client.js             ← Axios + JWT interceptor
β”‚       β”‚   β”œβ”€β”€ authApi.js
β”‚       β”‚   β”œβ”€β”€ menuApi.js
β”‚       β”‚   β”œβ”€β”€ reservationApi.js
β”‚       β”‚   └── reviewApi.js
β”‚       β”œβ”€β”€ context/
β”‚       β”‚   β”œβ”€β”€ AuthContext.jsx       ← JWT + user + dietary state
β”‚       β”‚   └── MenuContext.jsx       ← Live menu state
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ Navbar.jsx            ← Glassmorphism sticky nav
β”‚       β”‚   β”œβ”€β”€ Navbar.css
β”‚       β”‚   β”œβ”€β”€ Footer.jsx
β”‚       β”‚   β”œβ”€β”€ MenuCard.jsx          ← Live availability badge + admin toggle
β”‚       β”‚   └── ProtectedRoute.jsx    ← Role-gated route wrapper
β”‚       β”œβ”€β”€ pages/
β”‚       β”‚   β”œβ”€β”€ Home.jsx              ← Hero, problem/solution, live specials
β”‚       β”‚   β”œβ”€β”€ Menu.jsx              ← Live menu with dietary filter
β”‚       β”‚   β”œβ”€β”€ Reserve.jsx           ← 4-step wizard with menu preview
β”‚       β”‚   β”œβ”€β”€ Auth.jsx              ← Login / Signup + dietary setup
β”‚       β”‚   └── AdminDashboard.jsx    ← Stats, toggle, add dish, reviews
β”‚       β”œβ”€β”€ index.css                 ← Full design system (CSS variables)
β”‚       β”œβ”€β”€ App.jsx                   ← Router + context providers
β”‚       └── main.jsx
β”‚
β”œβ”€β”€ images/                           ← Shared food/restaurant images
β”œβ”€β”€ .gitignore                        ← Root-level gitignore
β”œβ”€β”€ Readme.md
└── (legacy static files β€” index.html, script.js, style.css)

πŸš€ Getting Started

Prerequisites


1️⃣ Clone the Repository

git clone https://github.com/anushkasark08/The-Lighthouse.git
cd The-Lighthouse

2️⃣ Set Up the Backend

cd backend
cp .env.example .env

Edit .env with your values:

PORT=5000
MONGODB_URI=mongodb://localhost:27017/lighthouse
JWT_SECRET=your-super-secret-key
JWT_EXPIRE=7d
FRONTEND_URL=http://localhost:5173

Install dependencies and seed the database:

npm install
npm run seed     # Seeds 18 menu items, 9 tables, 2 users
npm run dev      # Starts API on http://localhost:5000

βœ… Verify: http://localhost:5000/api/health


3️⃣ Set Up the Frontend

# In a new terminal
cd frontend
npm install
npm run dev      # Starts React app on http://localhost:5173

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


4️⃣ Default Accounts (after seeding)

Role Email Password
πŸ”‘ Admin admin@thelighthouse.com Admin@123
πŸ‘€ User test@example.com password123

5️⃣ Key Flows to Try

Guest

  1. Browse /menu β†’ see live availability badges on each dish
  2. Go to /reserve β†’ complete the 4-step wizard β†’ see Step 3: Tonight's Menu

New User

  1. Sign up at /auth β†’ set your dietary preference during signup
  2. Visit /menu β†’ your filter is pre-applied automatically

Admin

  1. Log in β†’ navigate to /admin
  2. Toggle any dish to "Sold Out" β†’ switch back to /menu β†’ it's gone instantly
  3. Add a new menu item from the dashboard form

πŸ”‘ API Reference

Auth β€” /api/auth

Method Endpoint Access Description
POST /register Public Register with dietary profile
POST /login Public Login, returns JWT
GET /me Private Get current user
PATCH /me/dietary Private Update dietary preference

Menu β€” /api/menu

Method Endpoint Access Description
GET / Public All available items (?category= ?isVeg= ?tag=)
GET /tonight Public Tonight's dishes based on time of day
GET /:id Public Single item
POST / Admin Create item
PUT /:id Admin Update item
PATCH /:id/toggle Admin Toggle isAvailable ← live differentiator
DELETE /:id Admin Delete item

Reservations β€” /api/reservations

Method Endpoint Access Description
GET /slots Public Available time slots for a date + guest count
POST / Private Create reservation
GET / Private Get user's reservations
DELETE /:id Private Cancel reservation

Reviews β€” /api/reviews

Method Endpoint Access Description
GET / Public All reviews
POST / Private Submit a review
DELETE /:id Private/Admin Delete review

🎨 Customization

The design system uses CSS variables in frontend/src/index.css. Change the theme in one place:

:root {
  --color-primary:  #c9a962;   /* Gold accent */
  --color-bg:       #1a1714;   /* Dark background */
  --color-text:     #f5f2ed;   /* Off-white text */
  --font-serif:     'Cormorant Garamond', Georgia, serif;
  --font-sans:      'Inter', system-ui, sans-serif;
}

🌟 Future Improvements

  • Payment gateway integration (Razorpay / Stripe)
  • Online food ordering with cart
  • Real-time slot updates with Socket.io
  • Multi-language support (i18n)
  • Push notifications for reservation reminders
  • PWA support

🀝 Contributing

Contributions are welcome and appreciated!

Steps to Contribute

  1. Fork the repository

  2. Create a feature branch

git checkout -b feature/your-feature-name
  1. Commit your changes
git commit -m "feat: add your feature description"
  1. Push the branch
git push origin feature/your-feature-name
  1. Open a Pull Request

πŸ’– Contributors

Thanks to all the amazing people who contribute to The Lighthouse πŸš€

Contributors


πŸ“œ License

This project is licensed under the MIT License.


πŸ’– Acknowledgements

Developed with passion by Anushka Sarkar

Special thanks to:

  • GirlScript Summer of Code 2026
  • Open-source contributors ❀️

πŸ”— Repository

GitHub Repository: https://github.com/anushkasark08/The-Lighthouse

Releases

Packages

Contributors

Languages