Skip to content

shubhamsharma-10/UrbanMeals

Repository files navigation

πŸ” UrbanMeals - Food Ordering Application (Frontend)

A modern, responsive food ordering web application built with React, TypeScript, and Vite. UrbanMeals allows users to search for restaurants, browse menus, place orders, and track delivery status in real-time.

UrbanMeals Banner


πŸ“– Table of Contents


✨ Features

For Customers

  • πŸ” Search Restaurants - Search for restaurants by city or town
  • πŸ• Browse Menus - View restaurant details and browse menu items
  • πŸ›’ Shopping Cart - Add/remove items with persistent cart storage
  • πŸ’³ Secure Checkout - Integrated payment processing with Stripe
  • πŸ“¦ Order Tracking - Real-time order status updates (Placed β†’ Paid β†’ In Progress β†’ Out for Delivery β†’ Delivered)
  • πŸ‘€ User Profiles - Manage delivery addresses and personal information

For Restaurant Owners

  • πŸͺ Restaurant Management - Create and manage your restaurant profile
  • πŸ“‹ Menu Management - Add, edit, and remove menu items
  • πŸ“Š Order Dashboard - View and manage incoming orders
  • πŸ–ΌοΈ Image Upload - Upload restaurant and menu item images

General

  • πŸ” Auth0 Authentication - Secure login/signup with Auth0
  • πŸ“± Responsive Design - Works seamlessly on desktop and mobile
  • 🎨 Modern UI - Beautiful interface with shadcn/ui components
  • ⚑ Fast Performance - Optimized with Vite and React Query caching

πŸ› οΈ Tech Stack

Category Technology
Framework React 18
Language TypeScript
Build Tool Vite
Styling TailwindCSS
UI Components shadcn/ui (Radix UI)
Routing React Router DOM v6
State Management React Query
Form Handling React Hook Form + Zod
Authentication Auth0
Icons Lucide React
Notifications Sonner
Theming next-themes

πŸ“Έ Screenshots

Home Page

The landing page featuring the search bar and app download section.

Home Page


Search Results Page

Restaurant search results with cuisine filters and sorting options.

Search Results


Restaurant Detail Page

Individual restaurant view with menu items and order summary.

Restaurant Detail


Shopping Cart

Order summary with delivery details form.

Shopping Cart


Checkout Page

Checkout page with payment options. Checkout Page


Order Status Page

Real-time order tracking with progress indicator.

Order Status


User Profile Page

User profile management with delivery address settings.

User Profile


Restaurant Management Dashboard

Restaurant owner dashboard with orders and restaurant settings tabs.

Manage Restaurant - Orders

Manage Restaurant - Settings


Mobile Responsive Views

Mobile navigation and responsive layouts.

Mobile Home Mobile Menu

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • npm or yarn
  • An Auth0 account for authentication
  • Backend API running (see backend repository)

Installation

  1. Clone the repository

    git clone https://github.com/your-username/mern-food-ordering-app-frontend.git
    cd mern-food-ordering-app-frontend
  2. Install dependencies

    npm install
  3. Set up environment variables

    cp .env.example .env

    Edit .env and fill in your configuration values (see Environment Variables)

  4. Start the development server

    npm run dev
  5. Open in browser

    Navigate to http://localhost:5173


πŸ” Environment Variables

Create a .env file in the root directory with the following variables:

# Backend API URL
VITE_API_BASE_URL=http://localhost:7000

# Auth0 Configuration
VITE_AUTH0_DOMAIN=your-tenant.us.auth0.com
VITE_AUTH0_CLIENT_ID=your-auth0-client-id
VITE_AUTH0_CALLBACK_URL=http://localhost:5173
VITE_AUTH0_AUDIENCE=your-auth0-api-audience

Getting Auth0 Credentials

  1. Sign up at Auth0
  2. Create a new application (Single Page Application)
  3. Configure callback URLs to include http://localhost:5173
  4. Copy the Domain and Client ID to your .env file
  5. Create an API and copy the Audience identifier

πŸ“ Project Structure

mern-food-ordering-app-frontend/
β”œβ”€β”€ public/                     # Static assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ api/                    # API integration hooks
β”‚   β”‚   β”œβ”€β”€ MyRestaurantApi.tsx # Restaurant owner API calls
β”‚   β”‚   β”œβ”€β”€ MyUserApi.tsx       # User profile API calls
β”‚   β”‚   β”œβ”€β”€ OrderApi.tsx        # Order management API calls
β”‚   β”‚   └── RestaurantApi.tsx   # Restaurant search API calls
β”‚   β”œβ”€β”€ assets/                 # Images and static assets
β”‚   β”œβ”€β”€ auth/                   # Authentication components
β”‚   β”‚   β”œβ”€β”€ Auth0ProviderWithNavigate.tsx
β”‚   β”‚   └── ProtectedRoute.tsx
β”‚   β”œβ”€β”€ components/             # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ ui/                 # shadcn/ui components
β”‚   β”‚   β”œβ”€β”€ Header.tsx
β”‚   β”‚   β”œβ”€β”€ Footer.tsx
β”‚   β”‚   β”œβ”€β”€ SearchBar.tsx
β”‚   β”‚   β”œβ”€β”€ CuisineFilter.tsx
β”‚   β”‚   └── ...
β”‚   β”œβ”€β”€ config/                 # App configuration
β”‚   β”œβ”€β”€ forms/                  # Form components
β”‚   β”‚   β”œβ”€β”€ manage-restaurant-form/
β”‚   β”‚   └── user-profile-form/
β”‚   β”œβ”€β”€ layouts/                # Page layouts
β”‚   β”œβ”€β”€ lib/                    # Utility functions
β”‚   β”œβ”€β”€ pages/                  # Page components
β”‚   β”‚   β”œβ”€β”€ HomePage.tsx
β”‚   β”‚   β”œβ”€β”€ SearchPage.tsx
β”‚   β”‚   β”œβ”€β”€ DetailPage.tsx
β”‚   β”‚   β”œβ”€β”€ UserProfilePage.tsx
β”‚   β”‚   β”œβ”€β”€ ManageRestaurantPage.tsx
β”‚   β”‚   β”œβ”€β”€ OrderStatusPage.tsx
β”‚   β”‚   └── AuthCallbackPage.tsx
β”‚   β”œβ”€β”€ AppRoutes.tsx           # Application routing
β”‚   β”œβ”€β”€ main.tsx                # Application entry point
β”‚   β”œβ”€β”€ types.ts                # TypeScript type definitions
β”‚   └── global.css              # Global styles
β”œβ”€β”€ .env.example                # Environment variables template
β”œβ”€β”€ index.html                  # HTML entry point
β”œβ”€β”€ package.json
β”œβ”€β”€ tailwind.config.js          # TailwindCSS configuration
β”œβ”€β”€ tsconfig.json               # TypeScript configuration
└── vite.config.ts              # Vite configuration

πŸ”Œ API Integration

The frontend communicates with the backend through the following API modules:

MyUserApi

  • useCreateMyUser() - Create a new user profile
  • useUpdateMyUser() - Update user profile information
  • useGetMyUser() - Fetch current user profile

MyRestaurantApi

  • useCreateMyRestaurant() - Create a new restaurant
  • useGetMyRestaurant() - Fetch restaurant owner's restaurant
  • useUpdateMyRestaurant() - Update restaurant details
  • useGetMyRestaurantOrders() - Fetch incoming orders

RestaurantApi

  • useSearchRestaurants() - Search restaurants by city with filters
  • useGetRestaurant() - Get individual restaurant details

OrderApi

  • useCreateCheckoutSession() - Create Stripe checkout session
  • useGetMyOrders() - Fetch user's order history

πŸ“œ Available Scripts

Script Description
npm run dev Start development server at http://localhost:5173
npm run build Build for production (runs TypeScript compiler and Vite build)
npm run lint Run ESLint for code quality checks
npm run preview Preview production build locally

πŸ›£οΈ Routes

Path Component Description Protected
/ HomePage Landing page with search No
/search/:city SearchPage Restaurant search results No
/detail/:restaurantId DetailPage Restaurant menu and ordering No
/auth-callback AuthCallbackPage Auth0 callback handler No
/user-profile UserProfilePage User profile management βœ… Yes
/order-status OrderStatusPage Order history and tracking βœ… Yes
/manage-restaurant ManageRestaurantPage Restaurant owner dashboard βœ… Yes

🀝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ™ Acknowledgements

  • shadcn/ui - Beautiful UI components
  • Auth0 - Authentication and authorization
  • Stripe - Payment processing
  • TailwindCSS - Utility-first CSS framework
  • Vite - Next generation frontend tooling

Made with ❀️ for food lovers everywhere

⭐ Star this repository if you found it helpful!