Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🍽️ Alviro β€” Modern Restaurant Web Application

Alviro Banner

A full-stack restaurant experience β€” seamless menus, table reservations, and more.

React Vite TailwindCSS Express MongoDB Clerk


πŸ“Œ Table of Contents


🌟 Overview

Alviro is a modern, full-stack restaurant web application that delivers a premium dining experience β€” online. Customers can explore the menu, make table reservations, subscribe to newsletters, and interact with an AI chatbot. Restaurant admins can manage menu items and reservations behind authenticated routes.


πŸ› οΈ Tech Stack

Frontend

Technology Version Purpose
React 19 UI Framework
Vite 7 Build Tool & Dev Server
TailwindCSS 3 Utility-First Styling
Framer Motion 12 Animations & Transitions
React Router DOM 7 Client-Side Routing
Lucide React 0.5 Icons
Clerk React 5 Authentication UI
Axios 1 HTTP Client

Backend

Technology Version Purpose
Node.js + Express 5 REST API Server
MongoDB + Mongoose 9 Database & ODM
Clerk SDK 4 Authentication Middleware
JSON Web Token 9 Route Protection
bcryptjs 3 Password Hashing
dotenv 17 Environment Variables
CORS 2 Cross-Origin Requests

πŸ—οΈ System Architecture

graph TB
    subgraph CLIENT["πŸ–₯️ Client β€” React + Vite (Port 5173)"]
        direction TB
        A["🏠 Home Page"] 
        B["πŸ“‹ Menu Page"]
        C["πŸ“ž Contact Page"]
        NAV["πŸ”— Navbar"]
        FOOT["🦢 Footer"]
        BOT["πŸ€– Chatbot"]
        CTX["🎨 Theme Context"]
    end

    subgraph SERVER["βš™οΈ Server β€” Express (Port 5000)"]
        direction TB
        AUTH_R["/api/auth"]
        MENU_R["/api/menu"]
        RES_R["/api/reservations"]
        NEWS_R["/api/newsletter"]
        PROT["/api/protected πŸ”"]
    end

    subgraph DB["πŸ—„οΈ MongoDB Atlas"]
        direction TB
        U[("πŸ‘€ Users")]
        M[("πŸ• MenuItems")]
        R[("πŸ“… Reservations")]
        N[("πŸ“§ Newsletters")]
    end

    CLIENT -->|"REST API calls via Axios"| SERVER
    SERVER --> DB
    CLERK["πŸ”‘ Clerk Auth"] -->|"JWT Tokens"| SERVER
    CLIENT -->|"Authentication"| CLERK
Loading

πŸ“ Project Structure

alviro/
β”œβ”€β”€ πŸ“¦ package.json               # Root config
β”œβ”€β”€ 🚫 .gitignore
β”‚
β”œβ”€β”€ client/                       # πŸ–₯️ Frontend (React + Vite)
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ vite.config.js
β”‚   β”œβ”€β”€ tailwind.config.js
β”‚   └── src/
β”‚       β”œβ”€β”€ App.jsx               # Root component + Router
β”‚       β”œβ”€β”€ main.jsx              # Entry point
β”‚       β”œβ”€β”€ config.js             # API base URL config
β”‚       β”œβ”€β”€ context/
β”‚       β”‚   └── ThemeContext.jsx  # Dark/Light theme
β”‚       β”œβ”€β”€ components/
β”‚       β”‚   β”œβ”€β”€ Navbar.jsx
β”‚       β”‚   β”œβ”€β”€ Footer.jsx
β”‚       β”‚   β”œβ”€β”€ Chatbot.jsx       # AI chatbot widget
β”‚       β”‚   β”œβ”€β”€ DesignOverlay.jsx
β”‚       β”‚   └── ScrollToTop.jsx
β”‚       β”œβ”€β”€ pages/
β”‚       β”‚   β”œβ”€β”€ Home.jsx
β”‚       β”‚   β”œβ”€β”€ Menu.jsx
β”‚       β”‚   └── Contact.jsx
β”‚       └── assets/
β”‚
└── server/                       # βš™οΈ Backend (Express + MongoDB)
    β”œβ”€β”€ index.js                  # App entry + middleware
    β”œβ”€β”€ models/
    β”‚   β”œβ”€β”€ User.js
    β”‚   β”œβ”€β”€ MenuItem.js
    β”‚   β”œβ”€β”€ Reservation.js
    β”‚   └── NewsletterSubscriber.js
    β”œβ”€β”€ controllers/
    β”‚   β”œβ”€β”€ authController.js
    β”‚   β”œβ”€β”€ menuController.js
    β”‚   β”œβ”€β”€ reservationController.js
    β”‚   └── newsletterController.js
    β”œβ”€β”€ routes/
    β”‚   β”œβ”€β”€ authRoutes.js
    β”‚   β”œβ”€β”€ menuRoutes.js
    β”‚   β”œβ”€β”€ reservationRoutes.js
    β”‚   └── newsletterRoutes.js
    └── middleware/
        └── authMiddleware.js

✨ Features & User Flows

1. 🧾 Menu Browsing

flowchart LR
    A([πŸ‘€ User visits /menu]) --> B[Fetch GET /api/menu]
    B --> C{Items found?}
    C -- Yes --> D[Render Menu Cards\nwith Framer Motion]
    C -- No --> E[Show empty state]
    D --> F([🍽️ User browses items])
Loading

2. πŸ“… Table Reservation Flow

flowchart TD
    A([User opens Contact/Reservation form]) --> B[Fill in: Name, Email,\nPhone, Date, Time, Guests]
    B --> C[Submit Form]
    C --> D[POST /api/reservations]
    D --> E{Validation OK?}
    E -- βœ… Yes --> F[Save to MongoDB\nStatus: Pending]
    E -- ❌ No --> G[Return Error to User]
    F --> H[Confirmation response]
    H --> I([βœ… User gets confirmation])

    subgraph ADMIN["πŸ” Admin Actions"]
        J[GET /api/reservations] --> K[View all reservations]
        K --> L[PATCH /api/reservations/:id]
        L --> M{Update status}
        M --> N([Confirmed βœ…])
        M --> O([Cancelled ❌])
    end
Loading

3. πŸ” Authentication Flow

sequenceDiagram
    participant U as πŸ‘€ User
    participant C as πŸ–₯️ Client
    participant CLK as πŸ”‘ Clerk
    participant S as βš™οΈ Server

    U->>C: Sign In / Sign Up
    C->>CLK: Redirect to Clerk Auth
    CLK-->>C: Return JWT Token
    C->>S: API Request + JWT in Header
    S->>CLK: Verify Token
    CLK-->>S: Token Valid βœ…
    S-->>C: Protected Data
    C-->>U: Render Response
Loading

4. πŸ“§ Newsletter Subscription

flowchart LR
    A([User enters email]) --> B[POST /api/newsletter]
    B --> C{Email exists?}
    C -- No --> D[Save subscriber\nto MongoDB]
    C -- Yes --> E[Return: Already subscribed]
    D --> F([βœ… Subscribed successfully])
Loading

πŸ“‘ API Reference

πŸ”“ Public Routes

Method Endpoint Description
GET /api/menu Fetch all menu items
POST /api/reservations Create a new reservation
POST /api/newsletter Subscribe to newsletter
POST /api/auth/login User login
POST /api/auth/register User registration

πŸ” Protected Routes (Auth Required)

Method Endpoint Description
POST /api/menu Add a new menu item
PATCH /api/menu/:id Update a menu item
DELETE /api/menu/:id Delete a menu item
GET /api/reservations Get all reservations
PATCH /api/reservations/:id Update reservation status
GET /api/protected Test Clerk auth route

πŸ—ƒοΈ Database Models

erDiagram
    USER {
        string _id PK
        string email
        string name
        string passwordHash
        date createdAt
    }

    MENU_ITEM {
        string _id PK
        string name
        string description
        number price
        string category
        string imageUrl
        date createdAt
    }

    RESERVATION {
        string _id PK
        string name
        string email
        string phone
        date date
        string time
        number guests
        string status
        string specialRequest
        date createdAt
    }

    NEWSLETTER_SUBSCRIBER {
        string _id PK
        string email
        date subscribedAt
    }

    USER ||--o{ RESERVATION : "makes"
Loading

Reservation Status States

stateDiagram-v2
    [*] --> Pending : Reservation Created
    Pending --> Confirmed : Admin Approves βœ…
    Pending --> Cancelled : Admin Rejects ❌
    Confirmed --> Cancelled : Cancellation Requested
    Cancelled --> [*]
Loading

πŸš€ Getting Started

Prerequisites

  • Node.js v18+
  • MongoDB Atlas account
  • Clerk account for auth

1. Clone the Repository

git clone https://github.com/your-username/alviro.git
cd alviro

2. Setup Environment Variables

server/.env

PORT=5000
MONGODB_URI=mongodb+srv://<username>:<password>@cluster.mongodb.net/alviro
CLERK_SECRET_KEY=sk_test_...
JWT_SECRET=your_jwt_secret

client/.env

VITE_API_BASE_URL=http://localhost:5000
VITE_CLERK_PUBLISHABLE_KEY=pk_test_...

3. Install Dependencies

# Backend
cd server
npm install

# Frontend
cd ../client
npm install

4. Run the Application

# Start backend (from /server)
npm run dev

# Start frontend (from /client)
npm run dev
Service URL
πŸ–₯️ Frontend http://localhost:5173
βš™οΈ Backend API http://localhost:5000

πŸ“Š Feature Overview

Features At a Glance
─────────────────────────────────────────
 πŸ• Dynamic Menu         β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 100%
 πŸ“… Reservations         β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 100%
 πŸ” Auth (Clerk + JWT)   β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 100%
 πŸ“§ Newsletter           β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 100%
 πŸ€– AI Chatbot           β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 100%
 🎨 Theme Toggle         β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 100%
 πŸ“± Responsive UI        β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ 100%
─────────────────────────────────────────

πŸ“„ License

This project is licensed under the ISC License.


Made with ❀️ by Divanshu Upadhayay

⭐ Star this repo if you found it useful!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages