Skip to content

Full-stack e-commerce platform with AI-powered voice chatbot using Google Gemini, Node.js, Python, and MySQL

License

Notifications You must be signed in to change notification settings

ASAD2204/webstore-ai-ecommerce

Repository files navigation

WEBSTORE E-COMMERCE PLATFORM WITH AI CHATBOT

🌟 Project Overview

WebStore is a full-stack e-commerce platform featuring an advanced AI-powered customer service chatbot. The system combines modern web technologies with artificial intelligence to provide intelligent customer support, product recommendations, order tracking, and business analytics.


πŸš€ Features

Frontend (Customer Interface)

  • πŸ›οΈ Product Catalog - Browse and search products with filters
  • πŸ›’ Shopping Cart - Add, update, and manage cart items
  • πŸ’³ Checkout System - Secure payment processing
  • πŸ“¦ Order Tracking - Real-time shipping status updates
  • πŸ’¬ AI Chatbot - Intelligent customer support with voice input 🎀
  • πŸ‘€ User Authentication - Secure login and registration
  • ❀️ Wishlist - Save favorite products
  • πŸ“§ Newsletter - Subscribe to updates and promotions

Admin Panel

  • πŸ“Š Dashboard - Real-time business analytics
  • πŸ“¦ Inventory Management - Track stock levels
  • πŸ›οΈ Order Management - View and process orders
  • πŸ‘₯ Customer Management - View customer data
  • πŸ’¬ Admin Chatbot - Business intelligence assistant with voice queries 🎀
  • πŸ’° Discount Management - Create and manage promotions
  • πŸ“¨ Messages - Customer inquiries and support

AI Chatbot Features

  • πŸ€– Natural Language Processing - Powered by Google Gemini AI
  • 🎀 Voice Input - Web Speech API for voice-to-text queries
  • πŸ” Semantic Search - ChromaDB vector database for knowledge retrieval
  • πŸ“¦ Order Tracking - Real-time shipping status with tracking numbers
  • πŸ›οΈ Product Recommendations - AI-driven product suggestions
  • πŸ“Š Business Analytics - Admin insights and reporting
  • πŸ’Ύ Chat History - Persistent conversation storage in MySQL
  • πŸ“ˆ Analytics Dashboard - Track chatbot performance
  • πŸ–ΌοΈ Image Search - Visual product matching (BLIP AI)

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:


πŸ› οΈ Installation & Setup

1. Clone the Repository

git clone https://github.com/your-username/webstore.git
cd webstore

2. Database Setup

  1. Install MySQL and start the MySQL server

  2. Import the complete database schema:

mysql -u root -p < database_setup.sql

Or manually:

mysql -u root -p
source database_setup.sql

This will create:

  • The eshop database
  • All required tables (products, orders, customers, chat, etc.)
  • Foreign key relationships
  • Indexes for performance

3. Node.js Backend Setup

  1. Install dependencies:
npm install
  1. Configure environment variables:
cp .env.example .env
  1. Edit .env file:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_database_password
DB_NAME=eshop
DB_PORT=3306
PORT=3000
  1. Start the Node.js server:
node app.js

The server will run on http://localhost:3000

4. Python Chatbot Backend Setup

  1. Navigate to chatbot backend:
cd chatbot_backend
  1. Create virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install Python dependencies:
pip install -r requirements.txt
  1. Configure environment variables:
cp .env.example .env
  1. Edit chatbot_backend/.env file:
# Get your API key from: https://aistudio.google.com/apikey
GEMINI_API_KEY=your_gemini_api_key_here

DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_database_password
DB_NAME=eshop
DB_PORT=3306

FLASK_PORT=5000
CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000
  1. Start the chatbot server:
python app.py

The chatbot server will run on http://localhost:5000


πŸ”‘ API Keys & Credentials

Google Gemini AI API Key

  1. Visit Google AI Studio
  2. Create a new API key
  3. Add it to chatbot_backend/.env as GEMINI_API_KEY

Database Credentials

  • Update database credentials in both .env files
  • Ensure MySQL server is running
  • Grant proper permissions to the database user

πŸ“ Project Structure

webstore/
β”œβ”€β”€ public/                    # Frontend files
β”‚   β”œβ”€β”€ index.html            # Homepage
β”‚   β”œβ”€β”€ shop.html             # Product listing
β”‚   β”œβ”€β”€ cart.html             # Shopping cart
β”‚   β”œβ”€β”€ checkout.html         # Checkout page
β”‚   β”œβ”€β”€ track-order.html      # Order tracking
β”‚   β”œβ”€β”€ admin_panel/          # Admin interface
β”‚   β”œβ”€β”€ img/                  # Images and assets
β”‚   β”œβ”€β”€ style.css             # Main stylesheet
β”‚   β”œβ”€β”€ customer-chatbot.js   # Customer chatbot UI
β”‚   └── admin-chatbot.js      # Admin chatbot UI
β”‚
β”œβ”€β”€ routes/                    # Express.js routes
β”‚   β”œβ”€β”€ index.js              # Main routes
β”‚   β”œβ”€β”€ products.js           # Product APIs
β”‚   β”œβ”€β”€ checkout.js           # Checkout APIs
β”‚   β”œβ”€β”€ login.js              # Authentication
β”‚   β”œβ”€β”€ userReg.js            # User registration
β”‚   └── ...
β”‚
β”œβ”€β”€ middleware/               # Express middleware
β”‚   └── adminVerify.js        # Admin authentication
β”‚
β”œβ”€β”€ chatbot_backend/          # Python chatbot server
β”‚   β”œβ”€β”€ app.py                # Main Flask application
β”‚   β”œβ”€β”€ requirements.txt      # Python dependencies
β”‚   β”œβ”€β”€ .env.example          # Environment template
β”‚   └── create_chat_history_table.sql
β”‚
β”œβ”€β”€ app.js                    # Node.js server entry point
β”œβ”€β”€ db.js                     # Database connection
β”œβ”€β”€ package.json              # Node.js dependencies
β”œβ”€β”€ .env.example              # Environment template
β”œβ”€β”€ .gitignore                # Git ignore rules
β”œβ”€β”€ README.md                 # This file
└── VOICE_FEATURE.md          # Voice chatbot documentation

πŸš€ Usage

Running the Complete System

  1. Start MySQL database
  2. Start Node.js backend: node app.js (Port 3000)
  3. Start Python chatbot: python chatbot_backend/app.py (Port 5000)
  4. Open browser: Navigate to http://localhost:3000

Customer Features

  • Browse products at /shop.html
  • Add items to cart at /cart.html
  • Track orders at /track-order.html
  • Chat with AI assistant (chat icon on every page)

Admin Features

  • Access admin panel at /admin.html
  • Login with admin credentials
  • View analytics, manage inventory, process orders
  • Use admin chatbot for business insights

πŸ›‘οΈ Security Notes

⚠️ IMPORTANT SECURITY REMINDERS:

  1. Never commit .env files to Git
  2. Never commit API keys or passwords
  3. Change default database passwords
  4. Use environment variables for all secrets
  5. Enable HTTPS in production
  6. Implement rate limiting
  7. Validate all user inputs
  8. Use prepared statements for SQL queries

🀝 Contributing

Contributions are welcome! Please follow these steps:

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

πŸ“ License

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


πŸ‘₯ Authors

  • Muhammad Asad - Initial work

πŸ™ Acknowledgments

  • Google Gemini AI for natural language processing
  • ChromaDB for vector database
  • Flask and Express.js frameworks
  • MySQL database
  • Tech2 etc(Youtube Channel) for Initial Store Views
  • EGATOR(Youtube Channel) For Admin Panel Idea

πŸ“ž Support

For support, email [email protected] or open an issue in the GitHub repository.


πŸ”„ Version History

  • v1.0.0 (November 2025)
    • Initial release
    • AI chatbot with Gemini integration
    • Chat history database
    • Admin and customer interfaces
    • Order tracking system
    • Product catalog and shopping cart

🚧 Roadmap

  • Add payment gateway integration
  • Implement email notifications
  • Add mobile app support
  • Enhance image search capabilities
  • Multi-language support
  • Advanced analytics dashboard
  • Social media integration

Built with ❀️ using Node.js, Python, MySQL, and AI