A modern e-commerce platform with AI-powered chatbot, seller management system, and comprehensive order tracking.
Built with React, TypeScript, Flask, PostgreSQL (Render), and Hugging Face AI (Mistral-7B) for intelligent customer support.
- Features
- Screenshots
- Tech Stack
- Project Structure
- Getting Started
- API Endpoints
- Database Schema
- Admin Tools
- Security Features
- Troubleshooting
- License
- Contact
- π User Authentication - Signup/Login with OTP verification via Resend API
- ποΈ Shopping Cart - Add, remove, and manage cart items
- π³ Secure Checkout - Complete order with address details
- π¦ Order Tracking - View order history and status
- π€ AI Chatbot - Product search and customer support (Hugging Face Mistral-7B)
- π§ Email Notifications - Order confirmations via Resend API
- π Product Filtering - Browse by categories
- π Seller Registration - Apply to become a seller with approval workflow
- β Product Management - Add, edit, delete products
- β Draft/Publish System - Control product visibility
- π Activity Logging - Track all product changes with audit trail
- π§ Email Notifications - Get notified on approval/rejection
- π Seller Dashboard - Manage inventory and view analytics
- βοΈ Seller Approval System - Approve/reject seller applications via admin script
- π© Contact Management - Handle customer inquiries
- π System Monitoring - Overview of platform activity
- π οΈ Database Management - Auto-create tables with setup script
- π§ Email Queue - Automated email notifications
| Technology | Purpose |
|---|---|
| Flask | Python web framework |
| PostgreSQL | Cloud database (Render) |
| psycopg2 | PostgreSQL adapter for Python |
| bcrypt | Password hashing |
| Resend API | Email service for OTP & notifications |
| Hugging Face | AI chatbot (Mistral-7B-Instruct-v0.2) |
| Flask-CORS | Cross-origin requests |
| python-dotenv | Environment variables |
| Technology | Purpose |
|---|---|
| React | UI library |
| TypeScript | Type safety |
| Vite | Build tool |
| Axios | HTTP client |
| CSS3 | Styling |
- Hugging Face API - Mistral-7B-Instruct-v0.2 for chatbot
- Resend - Transactional email API
- Render - PostgreSQL database hosting
ecommerce-project/
βββ Backend/ # Flask REST API (Python)
β βββ app.py # Main Flask application
β βββ create_tables.py # Database setup script
β βββ approve_seller.py # Admin seller management tool
β βββ .env.example # Environment variables template
β βββ requirements.txt # Python dependencies
βββ frontend/ # React + TypeScript Frontend
β βββ src/ # Source code
β βββ public/ # Static assets
β βββ .env.production # Production config
β βββ vercel.json # Vercel deployment config
β βββ package.json # Node dependencies
βββ Images/ # Project screenshots
βββ sql/ # SQL schema files (reference)
β βββ SingupDB.sql # User database schema
β βββ seller_DB.sql # Seller database schema
βββ README.md # This file- Python 3.8+
- Node.js 16+
- Git
- Hugging Face account (free) - Sign up
- Resend account (free tier) - Sign up
- Render PostgreSQL database - Create free database
git clone https://github.com/ShashankGowni/ecommerce-fullstack.git
cd ecommerce-projectNavigate to Backend: ``bash cd Backend
**Create virtual environment:**
```bash
python -m venv venv
Activate virtual environment:
# Windows:
venv\Scripts\activate
pip install -r requirements.txtenv
[email protected]
EMAIL_PASSWORD=not-used-with-resend
RESEND_API_KEY=re_your_resend_api_key_here
DATABASE_URL=postgresql://username:password@host/database_name
HF_API_KEY=hf_your_hugging_face_token_here
HF_API_URL=https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2
Setup Database (Auto-create tables):
python create_tables.pyThis script will:
- Connect to your PostgreSQL database
- Drop existing tables (if any)
- Create all required tables
- Set up indexes and triggers
- Verify setup
Run Backend:
python app.pyπ Backend runs on http://localhost:5000
Navigate to frontend:
cd frontendInstall dependencies:
npm installCreate .env.local for development:
env
VITE_API_URL=http://localhost:5000
Run development server:
npm run dev
π Frontend runs on http://localhost:5173Render PostgreSQL Database
- Go to https://render.com/
- Sign up for free account
- Click "New" β "PostgreSQL"
- Choose free plan
- Copy the "External Database URL"
- Add to .env as DATABASE_URL
- Go to https://huggingface.co/join
- Sign up for free
- Go to Settings β Access Tokens
- Click "New token"
- Select "Read" permission
- Copy token
env
HF_API_KEY=hf_your_token_here
- Go to https://resend.com/signup
- Sign up (3,000 free emails/month)
- Go to API Keys
- Click "Create API Key"
- Copy the key
env
RESEND_API_KEY=re_your_key_here
Authentication
POST /signup - User registration
POST /login - User login
POST /send-otp - Send OTP verification via Resend
POST /verify-otp - Verify OTP code
Seller Management
POST /seller-signup - Seller registration (creates pending seller)
POST /seller-login - Seller login (only approved sellers)
GET /seller-products - Get seller's products
POST /check-seller-status - Check approval status
GET /seller-activity - Get activity logs
POST /update-seller-status - Approve/reject seller (admin only)
Products
GET /products - Get all published products
GET /products/<id> - Get single product details
POST /add-product - Add new product (seller only)
PUT /products/<id> - Update product
DELETE /products/<id> - Delete product
PATCH /products/<id>/publish - Publish product
PATCH /products/<id>/unpublish - Unpublish (draft) product
POST /save-order - Save order to database
POST /send-order-email - Send order confirmation via Resend
GET /get-orders/<email> - Get user's order history
Chatbot (AI - Hugging Face)
POST /chat - Basic AI chat with Mistral-7B
POST /chat-with-history - Chat with conversation context
POST /chat-product-search - AI-powered product search
POST /contact-us - Submit contact form
GET /admin/contact-messages - Get all messages (admin)
Tables Created by create_tables.py:
- Users - Customer accounts with authentication
- Sellers - Seller accounts with approval status
- Products - Product catalog (draft/published states)
- Orders - Customer order information
- OrderItems - Individual items in orders
- ProductActivityLog - Audit trail for product changes
- SellerStatusChanges - Track seller approval/rejection with email queue
- ContactMessages - Customer support inquiries
trg_seller_status_change - Auto-log status changes and queue emails
Optimized for seller email, product ID, and timestamp queries
Database Setup Script
-
File: create_tables.py
-
Purpose: Automatically creates all database tables, indexes, and triggers
Usage:
cd Backend
python create_tables.pyFeatures:
- β Drops old tables safely
- β Creates all tables in correct order
- β Sets up foreign keys
- β Creates indexes for performance
- β Sets up email notification triggers
- β Verifies setup
-
File: approve_seller.py
-
Purpose: Admin interface for managing sellers
Usage:
cd Backend
python approve_seller.pyFeatures:
READ/VIEW:
- View all sellers
- View pending sellers
- View seller details by ID
UPDATE:
- Approve seller (sends email, allows login)
- Reject seller (sends email, blocks login)
CREATE:
Manually create seller with chosen status
DELETE:
Delete seller and all products
EMAIL: Send pending approval emails
- π Security Features
- β Password hashing with bcrypt
- β OTP verification for signup via Resend API
- β Environment variables for sensitive data
- β SQL injection protection (parameterized queries)
- β Session management
- β Secure authentication flow
- β API keys never exposed to frontend
- β CORS protection with Flask-CORS
- β PostgreSQL SSL mode enabled
Backend Issues
PostgreSQL connection error:
DATABASE_URL=postgresql://user:password@host/dbnamepython create_tables.py
psycopg2 installation fails:
pip install psycopg2-binaryHugging Face API errors:
β Check if HF_API_KEY is valid β First request takes 20-30 seconds (model loading) β Free tier has rate limits β Check https://status.huggingface.co/
**Resend email not sending:**
- β
Verify RESEND_API_KEY is correct
- β
Free tier: 3,000 emails/month, 100/day
- β
Check dashboard: https://resend.com/emails
- β
Verify sender email
**Import errors:**
```bash
pip install -r requirements.txt
Module not found:
rm -rf node_modules package-lock.json
npm installPort already in use:
export default defineConfig({
server: { port: 3000 }
})- Verify backend URL in frontend config
- Check Flask-CORS is installed
- Verify backend is running
npm run buildTables not created:
python create_tables.py
Seller can't login after approval:Run approve_seller.py to check status Verify status is "Approved" (case-sensitive) Products not showing:
Check product status is "published" (not "draft") Verify seller is approved
Β© 2025 Gowni Shashank. All Rights Reserved.
This software is proprietary and confidential. See the LICENSE file for complete terms.
π License Summary
- β Viewable for portfolio/demonstration purposes only
- β No permission to use, copy, modify, or distribute
- β Commercial use strictly prohibited without written permission
- πΌ For licensing inquiries: [email protected] This project is shared publicly to showcase my development capabilities.
Flask - Python web framework
- Hugging Face - AI model hosting and Mistral-7B model
- Resend - Modern email API
- React - Frontend library
- Vite - Build tool
- PostgreSQL - Database
- Render - Cloud database hosting
- Vercel - Frontend deployment
Gowni Shashank
π§ Email: [email protected] πΌ LinkedIn: linkedin.com/in/shashankgowni π GitHub: @ShashankGowni
Open to collaboration on interesting projects.
Created with π» by Gowni Shashank β’ January 2025 π









