Skip to content

Hayat-array/FoodRush

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ” FoodRush - Advanced Food Delivery Platform

FoodRush is a state-of-the-art, full-stack food delivery application designed to seamlessly connect customers, restaurants, and delivery partners. Built with performance and user experience in mind, it leverages the power of Next.js 14 and MongoDB to provide real-time ordering, tracking, and management capabilities.


πŸš€ Technology Stack

Frontend & UI

  • Framework: Next.js 14 (App Router, Server Components)
  • Language: JavaScript (ES6+)
  • Styling: Tailwind CSS for responsive design
  • Component Library: Shadcn UI (Radix UI primitives)
  • Icons: Lucide React
  • Animations: Framer Motion
  • Maps: Google Maps JavaScript API (for delivery tracking)

Backend & Database

  • Database: MongoDB (NoSQL)
  • ODM: Mongoose for schema modeling
  • Authentication: NextAuth.js (Secure session management)
  • API: Next.js API Routes (RESTful architecture)

State & Utilities

  • State Management: Zustand (Lightweight global state)
  • Date Handling: date-fns
  • Forms: React Hook Form
  • Validation: Zod (implied usage with Shadcn forms)

πŸ› οΈ Environment Configuration

To run this project securely, you need to configure the following environment variables in a .env.local file at the root of the project.

Variable Description Required Default / Example
MONGODB_URI Connection string for your MongoDB database. Yes mongodb://localhost:27017/foodrush
NEXTAUTH_SECRET A random string used to hash tokens and sign cookies. Yes your_secret_key_here
NEXTAUTH_URL The canonical URL of your site. Yes http://localhost:3000
NEXT_PUBLIC_UPI_ID The default UPI ID used for receiving payments. No your-business-upi@oksbi
NEXT_PUBLIC_GOOGLE_MAPS_KEY API Key for Google Maps (Address search & tracking). No AIzaSy...

πŸ“œ Scripts & Commands

The project comes with several built-in scripts to streamline development and deployment.

Command Description
npm run dev Starts the development server at http://localhost:3000 with hot-reloading.
npm run build Compiles the application for production usage. Essential for deployment.
npm run start Starts the production server (run this after npm run build).
npm run lint Runs ESLint to identify and report on patterns in JavaScript.
npm run seed Data Seeding: Populates your database with initial test data (Users, Restaurants, Dishes).
Usage: Run this once to set up a demo environment.

✨ Comprehensive Features

πŸ‘€ Customer Application

  • Dynamic Menu Browsing: Filter dishes by category, rating, and price.
  • Smart Cart System: Real-time total calculation, tax estimation, and customization support.
  • Secure Checkout:
    • Support for UPI Payments (with Test Mode simulation).
    • Cash on Delivery (COD) option.
  • Real-Time Order Tracking:
    • Visual progress bar (Confirmed -> Preparing -> Out for Delivery -> Delivered).
    • Integration with map coordinates for delivery location.
  • User Profile: Manage saved addresses, view order history, and re-order favorites.
  • Review System: Rate dishes and restaurants with star ratings and comments.

πŸ› οΈ Admin Dashboard

  • Operational Overview: At-a-glance metrics for Total Sales, Active Orders, and User Growth.
  • Order Verification:
    • Payment Verification: Validate UPI transaction IDs (UTR) before confirming orders.
    • Status Control: Manually update order stages if needed.
  • Menu Management: comprehensive CRUD operations for Dishes and Categories.
  • Restaurant Onboarding: Manage restaurant profiles and settings.
  • QR Code Generator: Generate unique QR codes for restaurant tables or menus.

πŸ›΅ Delivery Personnel Portal

  • Dedicated Dashboard: tailored view for delivery partners.
  • Order Assignment: View orders specifically assigned to the logged-in driver.
  • Secure Delivery (OTP):
    • System generates a unique OTP for every order.
    • Drivers must enter the customer's OTP to mark an order as "Delivered", ensuring security.
  • Navigation: Access delivery addresses with integrated map support.

🏒 Restaurant Portal

  • Order Queue: Real-time kitchen display system (KDS) for incoming orders.
  • Availability Toggle: Instantly mark dishes as "Out of Stock" or "Available".
  • Business Analytics: Track daily earnings and popular items.

πŸ—„οΈ Database Architecture

The application uses a robust MongoDB schema design:

  • Users: Stores secure credentials, roles (admin, user, delivery, restaurant_owner), usage history, and saved addresses.
  • Orders: The central collection linking Users, Restaurants, and Dishes.
    • Tracks status sequence: pending -> confirmed -> preparing -> out_for_delivery -> delivered.
    • Stores deliveryOTP for security.
    • Records payment details (utrNumber, paymentStatus).
  • Restaurants: Profiles including location, ratings, and operational hours.
  • Dishes: Menu items with pricing, description, and category associations.

πŸ“‚ Project Structure

foodrush/
β”œβ”€β”€ scripts/                # Database seeding scripts
β”‚   └── seed.js             # Initial data population
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/                # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ api/            # Backend API endpoints (admin/, user/, etc.)
β”‚   β”‚   β”œβ”€β”€ admin/          # Admin Dashboard pages
β”‚   β”‚   β”œβ”€β”€ delivery/       # Delivery Partner pages
β”‚   β”‚   └── (user)/         # Customer facing pages
β”‚   β”œβ”€β”€ components/         # Reusable UI components
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ models/         # Mongoose Schemas (User, Order, Dish)
β”‚   β”‚   β”œβ”€β”€ db.js           # Database connection
β”‚   β”‚   └── utils.js        # Helper functions
β”‚   └── hooks/              # Custom React hooks
β”œβ”€β”€ public/                 # Static assets (images, logos)
└── package.json            # Dependencies and scripts

πŸ”Œ API Documentation (Key Endpoints)

User APIs

  • GET /api/menu: Fetch all available dishes.
  • POST /api/orders: Create a new order.
  • GET /api/user/profile: Fetch user details and history.

Admin APIs

  • GET /api/admin/orders: List all orders with filtering.
  • POST /api/admin/orders/verify-payment: Verify UPI transactions.
  • POST /api/admin/menu: Add new items to the global menu.

Delivery APIs

  • GET /api/delivery/orders: Get orders assigned to the current driver.
  • POST /api/delivery/verify-otp: Complete delivery by validating OTP.

πŸ› οΈ Setup & Installation

Follow these steps to run the project locally:

  1. Clone the Repository

    git clone <repository-url>
    cd foodrush
  2. Install Dependencies

    npm install
  3. Environment Configuration Create a .env.local file in the root directory and confirm the variables listed in the Configuration section above.

  4. Seed the Database (Optional) To populate the app with demo data (restaurants, dishes, and an admin user), run:

    npm run seed
  5. Run the Application

    npm run dev

    Visit http://localhost:3000 to start exploring.


πŸ§ͺ Testing Guide: Payments & Delivery

πŸ’³ UPI Payment Simulation (Test Mode)

The application includes a robust simulator for UPI payments:

  1. During Checkout, select "UPI Payment".
  2. Use the "πŸ§ͺ Generate Fake Payment" button in the purple Test Mode box.
  3. This auto-fills a valid 12-digit UTR for testing.
  4. Place the order.
  5. Admin Verification: Log in as Admin > Orders > Verify Payment to confirm the order.

πŸ“¦ Delivery Flow

  1. Once an order is out_for_delivery, a unique OTP is generated.
  2. The customer sees this OTP in their order tracking page.
  3. The Delivery Partner must request this OTP from the customer.
  4. Enter the OTP in the Delivery Dashboard to successfully mark the order as Delivered.

οΏ½ Deployment

The easiest way to deploy your Next.js app is to use the Vercel Platform.

  1. Push your code to a Git repository (GitHub, GitLab, or BitBucket).
  2. Import your project to Vercel.
  3. Add your Environment Variables (MONGODB_URI, NEXTAUTH_SECRET, etc.) in the Vercel dashboard.
  4. Click Deploy.

Check out the Next.js deployment documentation for more details.

About

FoodRush is a full-stack, real-time food ordering and restaurant management platform. It allows restaurant owners (Admins) to manage their menu, view live orders, and update settings, while providing users with a seamless experience for browsing menus and placing orders for delivery or dine-in.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages