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.
- 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)
- Database: MongoDB (NoSQL)
- ODM: Mongoose for schema modeling
- Authentication: NextAuth.js (Secure session management)
- API: Next.js API Routes (RESTful architecture)
- State Management: Zustand (Lightweight global state)
- Date Handling: date-fns
- Forms: React Hook Form
- Validation: Zod (implied usage with Shadcn forms)
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... |
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. |
- 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.
- 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.
- 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.
- 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.
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
statussequence:pending->confirmed->preparing->out_for_delivery->delivered. - Stores
deliveryOTPfor security. - Records payment details (
utrNumber,paymentStatus).
- Tracks
- Restaurants: Profiles including location, ratings, and operational hours.
- Dishes: Menu items with pricing, description, and category associations.
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 scriptsGET /api/menu: Fetch all available dishes.POST /api/orders: Create a new order.GET /api/user/profile: Fetch user details and history.
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.
GET /api/delivery/orders: Get orders assigned to the current driver.POST /api/delivery/verify-otp: Complete delivery by validating OTP.
Follow these steps to run the project locally:
-
Clone the Repository
git clone <repository-url> cd foodrush
-
Install Dependencies
npm install
-
Environment Configuration Create a
.env.localfile in the root directory and confirm the variables listed in the Configuration section above. -
Seed the Database (Optional) To populate the app with demo data (restaurants, dishes, and an admin user), run:
npm run seed
-
Run the Application
npm run dev
Visit
http://localhost:3000to start exploring.
The application includes a robust simulator for UPI payments:
- During Checkout, select "UPI Payment".
- Use the "π§ͺ Generate Fake Payment" button in the purple Test Mode box.
- This auto-fills a valid 12-digit UTR for testing.
- Place the order.
- Admin Verification: Log in as Admin > Orders > Verify Payment to confirm the order.
- Once an order is
out_for_delivery, a unique OTP is generated. - The customer sees this OTP in their order tracking page.
- The Delivery Partner must request this OTP from the customer.
- Enter the OTP in the Delivery Dashboard to successfully mark the order as Delivered.
The easiest way to deploy your Next.js app is to use the Vercel Platform.
- Push your code to a Git repository (GitHub, GitLab, or BitBucket).
- Import your project to Vercel.
- Add your Environment Variables (MONGODB_URI, NEXTAUTH_SECRET, etc.) in the Vercel dashboard.
- Click Deploy.
Check out the Next.js deployment documentation for more details.