This guide will walk you through setting up the WebStore E-commerce Platform with AI Chatbot on your local machine.
Before you begin, make sure you have:
- Node.js (v14 or higher) - Download
- Python (v3.8 or higher) - Download
- MySQL (v8.0 or higher) - Download
- Git - Download
- Google Gemini API Key - Get Free Key
git clone https://github.com/your-username/webstore.git
cd webstoreMake sure your MySQL server is running.
Run the setup script:
mysql -u root -p < database_setup.sqlWhat this does:
- Creates the
eshopdatabase - Creates all 20+ tables (products, orders, customers, chat, etc.)
- Sets up foreign key relationships
- Creates indexes for performance
Verify the setup:
mysql -u root -p
USE eshop;
SHOW TABLES;You should see tables like: admin, customer, product, order, chat_sessions, etc.
npm installThis installs:
- Express.js (web framework)
- MySQL2 (database driver)
- bcryptjs (password hashing)
- jsonwebtoken (authentication)
- multer (file uploads)
- and more...
Copy the example file:
cp .env.example .envEdit .env with your details:
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=eshop
DB_PORT=3306
PORT=3000
NODE_ENV=developmentnode app.jsExpected output:
Server is running on port 3000
Connected to MySQL database
Test it:
Open browser: http://localhost:3000
cd chatbot_backendWindows:
python -m venv venv
venv\Scripts\activatemacOS/Linux:
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtThis installs:
- Flask (web framework)
- google-generativeai (Gemini AI)
- chromadb (vector database)
- sentence-transformers (embeddings)
- transformers (BLIP image AI)
- and more...
Note: This may take 5-10 minutes depending on your internet speed.
- Visit Google AI Studio
- Sign in with your Google account
- Click "Create API Key"
- Copy the API key (starts with
AIzaSy...)
Copy the example file:
cp .env.example .envEdit chatbot_backend/.env:
# Google Gemini AI
GEMINI_API_KEY=AIzaSy_YOUR_ACTUAL_API_KEY_HERE
# Database
DB_HOST=localhost
DB_USER=root
DB_PASSWORD=your_mysql_password
DB_NAME=eshop
DB_PORT=3306
# Flask Server
FLASK_ENV=development
FLASK_DEBUG=True
FLASK_PORT=5000
# CORS (allow your frontend)
CORS_ORIGINS=http://localhost:3000,http://127.0.0.1:3000python app.pyExpected output:
* Running on http://127.0.0.1:5000
* Gemini AI initialized successfully
* Vector database loaded
* MySQL connection established
- Open browser:
http://localhost:3000 - You should see the homepage
- Try navigating to
/shop.htmlto see products
- Open browser:
http://localhost:3000 - Click the chat icon (bottom right)
- Type: "Hello"
- You should get a response from the AI
- Browse Products: Go to
/shop.html - Add to Cart: Click "Add to Cart" on any product
- Checkout: Go to
/cart.html→ Click "Proceed to Checkout" - Track Order: Go to
/track-order.html→ Enter order ID - Chat with AI: Click chat icon → Ask questions
- Login: Go to
/admin.html - Default Credentials: (You need to add an admin user to the database)
INSERT INTO admin (email, password, name, special_word) VALUES ('admin@webstore.com', 'hashed_password', 'Admin', 'secret');
- Dashboard: View sales analytics
- Manage Products: Add, edit, delete products
- Process Orders: View and update order status
Solution:
- Make sure MySQL is running
- Check DB credentials in
.envfiles - Verify database exists:
SHOW DATABASES;
Solution:
- Make sure you created
chatbot_backend/.env(not.env.example) - Verify API key is correct
- Check for extra spaces
Solution:
- Change port in
.env:PORT=3001 - Or kill the process using port 3000
Solution:
- Update pip:
pip install --upgrade pip - Install one by one if needed
- Check Python version:
python --version(must be 3.8+)
Solution:
- Check if Flask server is running (port 5000)
- Verify CORS_ORIGINS includes
http://localhost:3000 - Check browser console for errors (F12)
webstore/
├── database_setup.sql # Complete database schema ⭐
├── .env.example # Environment template
├── .env # Your config (DO NOT COMMIT)
├── package.json # Node.js dependencies
├── app.js # Main server
├── db.js # Database connection
│
├── public/ # Frontend files
│ ├── index.html # Homepage
│ ├── shop.html # Product listing
│ ├── cart.html # Shopping cart
│ ├── checkout.html # Checkout
│ ├── track-order.html # Order tracking
│ ├── customer-chatbot.js # Chat UI
│ └── admin_panel/ # Admin interface
│
├── routes/ # API endpoints
│ ├── products.js # Product APIs
│ ├── checkout.js # Order processing
│ ├── login.js # Authentication
│ └── ...
│
└── chatbot_backend/ # Python AI server ⭐
├── app.py # Flask application
├── requirements.txt # Python dependencies
├── .env.example # Template
└── .env # Your config (DO NOT COMMIT)
You need TWO terminal windows:
Terminal 1 - Node.js Backend:
cd webstore
node app.jsTerminal 2 - Python Chatbot:
cd webstore/chatbot_backend
python app.pyThen open browser:
http://localhost:3000
.envfiles- API keys
- Database passwords
node_modules/venv/orenv/
✅ Safe to commit:
.env.example(template only)database_setup.sql(schema, no data)- Source code
- Documentation
The database_setup.sql includes:
20+ Tables organized in groups:
- Core:
admin,customer - Products:
product,product_images,product_sizes,inventory - Orders:
order,order_items,payment,bill,shipping,discount - Chat:
chat_sessions,chat_conversations,chat_analytics,chat_common_queries - Other:
wishlist,messages,news_subscribers
See DATABASE_SCHEMA.md for details.
✅ Product catalog with search/filter
✅ Shopping cart
✅ Secure checkout
✅ Order tracking
✅ AI chatbot support
✅ Wishlist
✅ User accounts
✅ Analytics dashboard
✅ Inventory management
✅ Order processing
✅ Customer management
✅ Discount management
✅ AI business assistant
✅ Natural language processing (Google Gemini)
✅ Voice input with Web Speech API
✅ Product recommendations
✅ Order tracking
✅ Image search (BLIP AI)
✅ Chat history
✅ Analytics tracking
If you encounter issues:
- Check this guide - Most common issues are covered above
- Check logs - Look at terminal output for errors
- Check browser console - Press F12 in browser
- GitHub Issues - Open an issue on the repository
- Documentation - See
README.mdfor more details
After setup:
- Add sample products to the database
- Create admin account in the
admintable - Test all features (cart, checkout, chatbot, etc.)
- Customize the frontend (colors, images, content)
- Configure chatbot responses
- Deploy to production (optional)
USE eshop;
INSERT INTO admin (email, password, name, special_word)
VALUES (
'admin@webstore.com',
'$2a$10$examplehashedpassword', -- Use bcrypt to hash
'Admin User',
'recovery123'
);INSERT INTO product (product_name, product_type, product_price, product_ranking, product_discription)
VALUES
('Blue T-Shirt', 'Clothing', 29.99, 5, 'Comfortable cotton t-shirt'),
('Running Shoes', 'Footwear', 89.99, 5, 'Professional running shoes'),
('Leather Watch', 'Accessories', 149.99, 4, 'Elegant leather watch');Your WebStore is now running! 🎉
Open http://localhost:3000 and start exploring.
Built with ❤️ - Happy Coding!