Skip to content

Latest commit

Β 

History

24 Commits

Folders and files

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

Repository files navigation

RoyalWings - Restaurant Ordering & Booking System

A comprehensive full-stack restaurant management platform built with React, TypeScript, Vite, Node.js, Express, Firebase, and Stripe integration. Features an intuitive ordering system, table booking management, and admin dashboard.

🌟 Features

Customer Features

  • πŸ” User authentication (Login/Register)
  • 🍽️ Browse menu with categorized items
  • 🎨 View menu items with images, descriptions, and pricing
  • πŸ›’ Shopping cart with quantity management
  • πŸ’³ Stripe payment integration
  • πŸ“¦ Order tracking and order history
  • 🎫 Table booking and reservations
  • πŸ“² Real-time order status updates
  • 🧾 Digital receipts

Admin Features

  • πŸ“Š Admin dashboard with analytics
  • 🍲 Menu management (add, edit, delete items)
  • 🏷️ Category management
  • πŸ“‹ Order management and status updates
  • 🎟️ Booking management
  • πŸ–ΌοΈ Image upload for menu items
  • ⏰ Store open/close status control
  • πŸ“ˆ Order and booking history

Technical Features

  • 🎯 Alphabetically sorted menu items
  • πŸ”„ Real-time Firestore updates
  • πŸ”’ Role-based access control
  • πŸ“± Responsive design (Tailwind CSS)
  • βœ… Form validation (Yup + React Hook Form)
  • 🌐 RESTful API
  • πŸ” Firebase security rules
  • πŸ’Ύ Cloud storage integration

πŸ“ Project Structure

RoyalWings/
β”œβ”€β”€ client/                           # React Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/              # Reusable React components (15 components)
β”‚   β”‚   β”‚   β”œβ”€β”€ AuthNavbar.tsx       # Auth navigation bar
β”‚   β”‚   β”‚   β”œβ”€β”€ BookingForm.tsx      # Booking reservation form
β”‚   β”‚   β”‚   β”œβ”€β”€ CartItem.tsx         # Shopping cart item
β”‚   β”‚   β”‚   β”œβ”€β”€ CartPopup.tsx        # Cart popup/sidebar
β”‚   β”‚   β”‚   β”œβ”€β”€ CategoryForm.tsx     # Category management form
β”‚   β”‚   β”‚   β”œβ”€β”€ FlavorSelector.tsx   # Item flavor selection modal
β”‚   β”‚   β”‚   β”œβ”€β”€ ImageUpload.tsx      # Image upload handler
β”‚   β”‚   β”‚   β”œβ”€β”€ MenuCard.tsx         # Individual menu item card
β”‚   β”‚   β”‚   β”œβ”€β”€ MenuCarousel.tsx     # Featured items carousel
β”‚   β”‚   β”‚   β”œβ”€β”€ MenuGrid.tsx         # Menu items grid with search/filter
β”‚   β”‚   β”‚   β”œβ”€β”€ MenuItemForm.tsx     # Menu item creation/edit form
β”‚   β”‚   β”‚   β”œβ”€β”€ Navigation.tsx       # Main navigation component
β”‚   β”‚   β”‚   β”œβ”€β”€ ProtectedRoute.tsx   # Route authentication guard
β”‚   β”‚   β”‚   β”œβ”€β”€ Receipt.tsx          # Order receipt display
β”‚   β”‚   β”‚   └── StripeCheckout.tsx   # Stripe payment form
β”‚   β”‚   β”œβ”€β”€ pages/                   # Page components (12 pages)
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminPage.tsx        # Admin dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminBookingsPage.tsx # Admin booking management
β”‚   β”‚   β”‚   β”œβ”€β”€ AdminOrdersPage.tsx  # Admin order management
β”‚   β”‚   β”‚   β”œβ”€β”€ BookingPage.tsx      # Customer booking page
β”‚   β”‚   β”‚   β”œβ”€β”€ CartPage.tsx         # Shopping cart page
β”‚   β”‚   β”‚   β”œβ”€β”€ Login.tsx            # Login page
β”‚   β”‚   β”‚   β”œβ”€β”€ MenuPage.tsx         # Menu browsing page
β”‚   β”‚   β”‚   β”œβ”€β”€ OrderConfirmation.tsx # Order confirmation page
β”‚   β”‚   β”‚   β”œβ”€β”€ OrderHistory.tsx     # Customer order history
β”‚   β”‚   β”‚   β”œβ”€β”€ OrderStatus.tsx      # Real-time order status tracking
β”‚   β”‚   β”‚   β”œβ”€β”€ Register.tsx         # User registration page
β”‚   β”‚   β”‚   └── UserBookingsPage.tsx # Customer bookings page
β”‚   β”‚   β”œβ”€β”€ services/                # Firebase & API services
β”‚   β”‚   β”‚   β”œβ”€β”€ bookingService.ts    # Booking CRUD operations
β”‚   β”‚   β”‚   β”œβ”€β”€ menuService.ts       # Menu item management
β”‚   β”‚   β”‚   β”œβ”€β”€ orderService.ts      # Order processing & tracking
β”‚   β”‚   β”‚   └── stripeService.ts     # Stripe payment processing
β”‚   β”‚   β”œβ”€β”€ contexts/                # React Context providers
β”‚   β”‚   β”‚   β”œβ”€β”€ AuthContext.tsx      # Authentication state management
β”‚   β”‚   β”‚   └── CartContext.tsx      # Shopping cart state management
β”‚   β”‚   β”œβ”€β”€ types/                   # TypeScript type definitions
β”‚   β”‚   β”‚   β”œβ”€β”€ booking.ts           # Booking interfaces
β”‚   β”‚   β”‚   β”œβ”€β”€ cart.ts              # Cart interfaces
β”‚   β”‚   β”‚   β”œβ”€β”€ index.ts             # Common type exports
β”‚   β”‚   β”‚   β”œβ”€β”€ menu.ts              # Menu item interfaces
β”‚   β”‚   β”‚   └── order.ts             # Order interfaces
β”‚   β”‚   β”œβ”€β”€ utils/                   # Utility functions
β”‚   β”‚   β”‚   └── formatters.ts        # Price formatting utilities
β”‚   β”‚   β”œβ”€β”€ config/                  # Configuration
β”‚   β”‚   β”‚   └── firebase.ts          # Firebase initialization
β”‚   β”‚   β”œβ”€β”€ App.tsx                  # Main app component with routing
β”‚   β”‚   β”œβ”€β”€ index.css                # Global styles
β”‚   β”‚   └── main.tsx                 # React entry point
β”‚   β”œβ”€β”€ public/                       # Static assets
β”‚   β”œβ”€β”€ index.html                   # HTML template
β”‚   β”œβ”€β”€ package.json                 # Frontend dependencies
β”‚   β”œβ”€β”€ vite.config.ts               # Vite configuration
β”‚   β”œβ”€β”€ tsconfig.json                # TypeScript configuration
β”‚   β”œβ”€β”€ tailwind.config.js           # Tailwind CSS configuration
β”‚   β”œβ”€β”€ postcss.config.js            # PostCSS configuration
β”‚   └── eslint.config.js             # ESLint configuration
β”‚
β”œβ”€β”€ server/                           # Express Backend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.js                 # Server entry point
β”‚   β”‚   β”œβ”€β”€ config/
β”‚   β”‚   β”‚   β”œβ”€β”€ firebase.js          # Firebase Admin SDK configuration
β”‚   β”‚   β”‚   └── serviceAccountKey.json # Firebase service account
β”‚   β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”‚   β”œβ”€β”€ stripeRoutes.js      # Stripe payment routes
β”‚   β”‚   β”‚   └── uploadRoutes.js      # File upload routes
β”‚   β”‚   └── scripts/
β”‚   β”‚       └── createAdmin.js       # Admin user creation script
β”‚   β”œβ”€β”€ package.json                 # Backend dependencies
β”‚   └── .env                         # Backend environment variables
β”‚
β”œβ”€β”€ firebase/                        # Firebase configuration
β”‚   β”œβ”€β”€ firestore.rules              # Firestore security rules
β”‚   └── storage.rules                # Cloud Storage security rules
β”‚
β”œβ”€β”€ firebase.json                    # Firebase project configuration
β”œβ”€β”€ firestore.indexes.json           # Firestore index configuration
└── README.md                        # Project documentation

πŸš€ Getting Started

Prerequisites

  • Node.js v14 or higher
  • npm v6 or higher
  • Firebase account with a project created
  • Stripe account (for payment processing)
  • Git for version control

Installation

  1. Clone the repository

    git clone <repository-url>
    cd RoyalWings
  2. Setup Frontend

    cd client
    npm install
  3. Setup Backend

    cd server
    npm install

Configuration

Frontend Environment Variables (client/.env)

VITE_FIREBASE_API_KEY=your-api-key
VITE_FIREBASE_AUTH_DOMAIN=your-auth-domain
VITE_FIREBASE_PROJECT_ID=your-project-id
VITE_FIREBASE_STORAGE_BUCKET=your-storage-bucket
VITE_FIREBASE_MESSAGING_SENDER_ID=your-messaging-sender-id
VITE_FIREBASE_APP_ID=your-app-id
VITE_STRIPE_PUBLIC_KEY=your-stripe-public-key
VITE_API_URL=http://localhost:5000

Backend Environment Variables (server/.env)

PORT=5000
FIREBASE_PROJECT_ID=your-project-id
FIREBASE_PRIVATE_KEY=your-firebase-private-key
FIREBASE_CLIENT_EMAIL=your-firebase-client-email
STRIPE_SECRET_KEY=your-stripe-secret-key
STRIPE_WEBHOOK_SECRET=your-webhook-secret
NODE_ENV=development

Running the Application

Development Mode

Terminal 1 - Frontend:

cd client
npm run dev

Terminal 2 - Backend:

cd server
npm run dev

The application will be available at http://localhost:5173 (Vite default)

Admin Account Setup

After setting up the project, you need to create an admin account to access the admin dashboard.

Creating Admin User

  1. Navigate to the server scripts directory

    cd server
  2. Run the admin creation script

    node scripts/createAdmin.js admin@example.com password123

    Parameters:

    • First argument: Admin email address
    • Second argument: Admin password
  3. Example:

    node scripts/createAdmin.js admin@royalwings.com SecurePassword123
  4. Success Output

    Successfully created admin user:
    Email: admin@royalwings.com
    User UID: [generated-uid]
    Role: admin
    

⚠️ Important Notes:

  • The script uses your Firebase service account key (serviceAccountKey.json)
  • Make sure the service account key is in server/config/serviceAccountKey.json
  • Use a strong password for the admin account
  • Store the admin credentials securely
  • You can create multiple admin accounts by running the script multiple times with different emails

Logging in as Admin

  1. Go to http://localhost:5173/login
  2. Enter your admin email and password
  3. You'll be redirected to the admin dashboard at /admin

Admin Dashboard Features

Once logged in as admin, you can:

  • View all orders and update their status
  • Manage menu items (add, edit, delete)
  • Manage menu categories
  • View and manage table bookings
  • Control store open/close status
  • View order and booking history

Production Admin Creation

For production deployment:

# Set environment variables for production Firebase
export FIREBASE_PROJECT_ID=your-prod-project-id
export FIREBASE_PRIVATE_KEY=your-prod-private-key
export FIREBASE_CLIENT_EMAIL=your-prod-client-email

# Run the admin creation script
node scripts/createAdmin.js admin@yourdomain.com ProductionPassword123

Production Build

Frontend:

cd client
npm run build
npm run preview

Backend:

cd server
npm run start

πŸ“¦ Dependencies

Frontend

  • React 18.2.0 - UI library
  • TypeScript - Type-safe JavaScript
  • Vite - Lightning-fast build tool
  • Tailwind CSS - Utility-first CSS framework
  • Firebase 10.5.2 - Backend services (Auth, Firestore, Storage)
  • Stripe - Payment processing
  • React Router v6 - Client-side routing
  • React Hook Form - Efficient form handling
  • Yup - Schema validation
  • React Hot Toast - Toast notifications
  • ESLint - Code linting

Backend

  • Express 5.1.0 - Web framework
  • Firebase Admin SDK 13.5.0 - Server-side Firebase
  • Stripe 20.0.0 - Payment API
  • CORS - Cross-origin resource sharing
  • Multer - File upload middleware
  • Dotenv - Environment variable management
  • Nodemon - Development auto-reload

πŸ” Authentication & Security

  • Firebase Authentication (Email/Password)
  • Role-based access control (Admin/Customer)
  • Protected routes for authenticated users only
  • Firestore security rules for database access
  • Cloud Storage security rules for file uploads
  • Stripe webhook verification for payments
  • Password Reset via Email - Secure password recovery using Firebase

Password Reset / Forgot Password Feature

RoyalWings includes a complete password recovery system using Firebase's built-in email authentication:

How It Works

  1. Request Password Reset - User navigates to /forgot-password
  2. Enter Email - User enters their registered email address
  3. Firebase Sends Email - Firebase automatically sends a password reset link via Gmail
  4. Click Reset Link - User clicks the link in their email (valid for 1 hour)
  5. New Password Page - Reset link redirects to /reset-password
  6. Set New Password - User enters and confirms their new password
  7. Password Updated - Automatic redirect to login page

Pages & Routes

Route Purpose Public
/forgot-password Request password reset email βœ… Yes
/reset-password?oobCode=... Reset password with verification code βœ… Yes
/login Sign in (includes "Forgot password?" link) βœ… Yes

Key Features

  • βœ… Email validation before sending reset email
  • βœ… One-click password reset from email
  • βœ… Automatic code verification
  • βœ… Strong password requirements (8+ chars, uppercase, lowercase, number)
  • βœ… Password confirmation matching
  • βœ… 1-hour reset link expiration
  • βœ… User-friendly error messages
  • βœ… Toast notifications for all actions
  • βœ… Responsive design on all devices

Firebase Console Configuration

To customize the password reset email template:

  1. Go to Firebase Console β†’ Authentication β†’ Templates
  2. Click on "Password reset" email template
  3. Customize:
    • Email subject
    • Email content
    • Add your logo/branding
    • Change button text and colors
  4. Save changes

Default Email Variables:

  • %LINK% - Password reset link
  • %EMAIL% - User's email address
  • %APP_NAME% - Application name (RoyalWings)

Testing Password Reset

  1. Create a test account in the application
  2. Go to /forgot-password
  3. Enter your email
  4. Check your email inbox (may take a few seconds)
  5. Click the reset link
  6. Enter a new password meeting the requirements
  7. Confirm the password change

Troubleshooting Password Reset

Issue Solution
Email not received Check spam folder, verify email is correct
Reset link expired Request a new reset link (links valid for 1 hour)
"User not found" Verify email is registered with the system
"Invalid reset code" Link may be expired, request new reset
Password too weak Must include 8+ chars, uppercase, lowercase, number

πŸ—„οΈ Database Schema

Collections (Firestore)

  • users - User profiles and roles
  • menuItems - Menu item catalog with images and pricing
  • categories - Menu categories
  • orders - Customer orders with items and status
  • bookings - Table reservations
  • storeStatus - Store open/close status

🎨 Styling

  • Tailwind CSS for utility-first styling
  • PostCSS for CSS processing
  • Responsive design - Mobile, tablet, and desktop optimized
  • Gradient colors - Modern gradient UI elements
  • Animation - Smooth transitions and hover effects

πŸ› οΈ Development Tools & Technologies

Frontend Tools

Tool Purpose Version
Vite Build tool and dev server 4.4.5
TypeScript Type-safe JavaScript 5.0.2
ESLint Code quality and linting 8.45.0
Tailwind CSS Utility-first CSS framework 3.3.5
PostCSS CSS processing 8.4.31
React Hot Toast Toast notifications 2.6.0

Backend Tools

Tool Purpose Version
Express.js Web framework 5.1.0
Nodemon Auto-reload during development 3.1.10
Multer File upload handling 2.0.2
Firebase Admin SDK Server-side Firebase operations 13.5.0
CORS Cross-origin resource sharing 2.8.5
Stripe Payment processing 20.0.0

External Services

Service Purpose Integration
Firebase Authentication User login & registration Email/Password auth
Firestore Cloud database Real-time data sync
Cloud Storage Image & file storage Menu item images
Stripe Payment processing Card payments

Development Environment

  • Node.js - JavaScript runtime
  • npm - Package manager
  • Git - Version control
  • VS Code (Recommended) - Code editor

πŸ“± Pages & Routes

/                    β†’ Login page
/register            β†’ User registration
/menu                β†’ Browse menu (sorted alphabetically)
/cart                β†’ Shopping cart
/checkout            β†’ Stripe payment checkout
/order-confirmation  β†’ Order confirmation
/order-status/:id    β†’ Track order in real-time
/order-history       β†’ View past orders
/booking             β†’ Make table reservations
/user-bookings       β†’ View user's bookings
/admin               β†’ Admin dashboard
/admin/orders        β†’ Manage orders
/admin/bookings      β†’ Manage bookings

πŸ”§ Available Scripts

Frontend

npm run dev        # Start Vite development server
npm run build      # Build for production
npm run preview    # Preview production build
npm run lint       # Run ESLint

Backend

npm run dev        # Start with nodemon (hot reload)
npm run start      # Start production server
npm run test       # Run tests

🎯 Key Features Breakdown

Menu Management

  • Alphabetically sorted menu items
  • Category filtering
  • Search functionality
  • Featured items carousel
  • Item availability toggle
  • Image upload support
  • Flavor selection for customizable items

Ordering System

  • Add items to cart with quantity management
  • Real-time cart updates
  • Stripe payment integration
  • Order confirmation with receipt
  • Order status tracking
  • Order history view
  • Pickup code generation

Booking System

  • Date and time selection
  • Party size management
  • Special requests field
  • Booking confirmation
  • Booking history
  • Availability management

Admin Features

  • Dashboard with key metrics
  • Menu item CRUD operations
  • Category management
  • Order management with status updates
  • Booking management
  • Store status control
  • Customer viewing

🚨 Troubleshooting

Common Issues

  1. Firebase connection errors

    • Verify all environment variables are set correctly
    • Check Firebase project configuration
  2. Stripe payment failures

    • Ensure Stripe keys are correct
    • Check webhook configuration in Stripe dashboard
  3. Image upload issues

    • Verify Cloud Storage security rules
    • Check file size limits in Multer configuration

πŸ‘₯ Support & Contribution

For issues, feature requests, or contributions, please email me at galapon.luismiguel.paterno@gmail.com

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages