Skip to content

Repository files navigation

🍔 FOOD GENIE - AI-Powered MERN Food Delivery Application

React Node.js MongoDB Express.js Stripe Redux

A production-ready Full-Stack Food Delivery Platform built using the MERN Stack (MongoDB, Express.js, React, Node.js). This application features a modern architecture, secure role-based authentication, seamless online payments, and scalable backend design.

What sets this project apart are its intelligent AI features: leveraging AI to generate dynamic food descriptions, analyze restaurant review sentiments, and automatically generate food imagery.

Live Link : https://webstack-full-stack-development-mer.vercel.app/

image A1 image B1

🚀 Key Features

👤 Security & Authentication

  • JWT & Sessions: Secure authentication using JSON Web Tokens and HTTP-Only Cookie sessions.
  • Role-Based Access: Distinct authorization levels for Users and Admins.
  • Data Protection: Password encryption using Bcrypt, request size limiting, and protected routes.
  • Account Recovery: Forgot/Reset password functionality with secure tokens.
  • Error Handling: Centralized API error handling for reliable debugging.

🍽 Restaurant & Menu Management

  • Browse & Filter: Search for restaurants and filter menus by Veg/Non-Veg and specific food categories.
  • Dynamic Menus: Detailed food items with rich descriptions and user-generated restaurant ratings.

🛒 Smart Shopping Cart & Order Flow

  • Synchronized Cart: Backend-synchronized cart with dynamic quantity management and automatic updates.
  • Restaurant Rules: Single-restaurant cart rules (cart automatically resets when switching restaurants).
  • Order Lifecycle: Track order history, view details, cancel orders, and restore stock automatically upon cancellation.

💳 Secure Payments (Stripe)

  • Checkout Integration: Secure Stripe checkout sessions with shipping address collection.
  • Automated Workflow: Payment verification triggers automated order creation, stock updates, and cart cleanup.

🤖 AI Integrations (The USP)

This application leverages multiple AI models to enhance the user experience and reduce manual data entry:

  • AI Food Descriptions: Utilizes Groq Llama Models to generate appetizing menu descriptions. Responses are cached in MongoDB to optimize API usage and reduce costs.
  • AI Review Sentiment Analysis: Analyzes raw customer reviews to generate:
    • Overall Sentiment
    • Key Pros & Cons
    • Final AI Verdict
  • AI Image Generation: Automatically creates placeholder food images using Pollinations AI for menu items lacking photography.

🏗 Tech Stack

Domain Technologies
Frontend React, Vite, Redux Toolkit, React Router DOM, Axios, Font Awesome, React Toastify
Backend Node.js, Express.js
Database MongoDB Atlas, Mongoose
Security JWT, BcryptJS, Cookie Parser
Third-Party APIs Stripe (Payments), Cloudinary (Image Hosting)
AI Services Groq AI, Pollinations AI

📊 Database Collections

  • Users: Stores authentication, roles, and profile data.
  • Restaurants: Details, location, ratings, and status.
  • Menus / Food Items: Categories, pricing, stock, AI images, and AI descriptions.
  • Orders: Order status, items, totals, and payment references.
  • Cart: Active user carts with item quantities.

📂 Project Structure

Food-Delivery-App
│
├── frontend/
│   ├── components/    # Reusable UI components
│   ├── pages/         # Main application views
│   ├── redux/         # State management slices & store
│   ├── hooks/         # Custom React hooks
│   └── utils/         # Helper functions
│
├── backend/
│   ├── controllers/   # Request handling logic
│   ├── routes/        # API endpoints
│   ├── middleware/    # Auth, error, and validation middleware
│   ├── models/        # Mongoose database schemas
│   ├── utils/         # AI integrations and helpers
│   ├── config/        # DB and Third-party configurations
│   └── server.js      # Entry point
│
└── README.md

## ⚙️ Local Development & Setup
Follow these steps to set up the project locally on your machine.

## 1. Clone the repository
Bash
git clone [https://github.com/yourusername/Food-Delivery-App.git](https://github.com/yourusername/Food-Delivery-App.git)
cd Food-Delivery-App

## 2. Install Dependencies
You will need to install dependencies for both the frontend and backend.

Bash
# Install backend dependencies
cd backend
npm install

# Install frontend dependencies
cd ../frontend
npm install

## 3. Environment Variables
Create a .env file in the backend directory and add the following keys:

Code snippet
PORT=5000
MONGO_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
STRIPE_SECRET_KEY=your_stripe_secret
GROQ_API_KEY=your_groq_api_key
CLOUDINARY_URL=your_cloudinary_url

## 4. Run the Application
Open two separate terminal windows/tabs:

Terminal 1 (Backend):

Bash
cd backend
npm run dev
Terminal 2 (Frontend):

Bash
cd frontend
npm run dev
🎯 Learning Outcomes
Building this project demonstrated proficiency in:

Designing robust REST APIs and MVC Architecture.

Implementing secure, production-ready Authentication & Authorization.

Handling complex MongoDB relationships, indexing, and Cloud Database Integration.

Managing global state and caching efficiently with Redux Toolkit.

Integrating Third-Party Payment Gateways (Stripe) and AI APIs.

Optimizing performance via lazy loading and API caching.

## 📈 Future Improvements
[ ] Real-Time Order Tracking via WebSockets

[ ] Dedicated Delivery Partner Dashboard

[ ] Admin Analytics & Sales Dashboard

[ ] Push Notifications for Order Updates

[ ] Google Maps Integration for accurate delivery addressing

[ ] Docker Deployment & Kubernetes Support

[ ] CI/CD Pipeline

## payments are simulated using Stripe Test Mode.

## 👨‍💻 Author
Dhanraj Kumar Full Stack Developer

[ MERN Stack | REST APIs | React | Node.js | MongoDB | AI Integrations | AWS (Learning)]

About

A production-ready AI Full-Stack Food Delivery Platform built using the MERN Stack (MongoDB, Express.js, React, Node.js). This application features a modern architecture, secure role-based authentication, seamless online payments, and scalable backend design.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages