Skip to content

tailormst/Ecommerce-Amazon-Recommendation-Assistant

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›οΈ ShopShield AI: Smart E-commerce Recommendation Assistant

An advanced full-stack AI-powered e-commerce assistant that revolutionizes the shopping experience using RAG (Retrieval-Augmented Generation) and Computer Vision. Get personalized product recommendations through intelligent chat and visual search capabilities.

🌟 Key Features

  • πŸ€– AI Shopping Expert: Context-aware shopping advice powered by Google Gemini 2.0 Flash model
  • πŸ–ΌοΈ Visual Search: Analyze product images using CLIP model and Gemini Vision to find similar products
  • πŸ” Hybrid Search: Ultra-fast vector similarity search with FAISS and ChromaDB
  • πŸ’¬ Persistent Chat: Seamless conversational experience with chat history
  • πŸ›‘οΈ Secure Authentication: JWT-based authentication with rate limiting
  • ⚑ Real-time Responses: Fast API backend with Redis caching
  • 🎨 Modern UI: Beautiful, responsive interface built with Next.js 14 and Tailwind CSS

πŸ› οΈ Tech Stack

Frontend

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript 5
  • Styling: Tailwind CSS 4
  • Animations: Framer Motion
  • Icons: Lucide React
  • HTTP Client: Axios
  • Forms: React Hook Form
  • Markdown: React Markdown with remark-gfm
  • Notifications: React Hot Toast

Backend

  • Framework: FastAPI (Python 3.13)
  • AI Orchestration: LangChain
  • LLM: Google Gemini 2.0 Flash
  • Embeddings: HuggingFace (all-MiniLM-L6-v2)
  • Vector Databases:
    • ChromaDB (for RAG)
    • FAISS (for similarity search)
  • Database: SQLAlchemy ORM
  • Caching: Redis
  • Authentication: JWT tokens
  • Image Processing: PIL (Pillow)
  • Computer Vision: CLIP Model

πŸ’‘ Core Idea

ShopShield AI transforms traditional e-commerce browsing into an intelligent, conversational shopping experience. Instead of manually searching through hundreds of products, users can:

  1. Chat naturally about what they're looking for
  2. Upload images of products they like to find similar items
  3. Get personalized recommendations based on their preferences and chat history
  4. Receive expert shopping advice powered by AI that understands product context

The system combines semantic search, visual recognition, and conversational AI to create a shopping assistant that truly understands customer needs.

πŸ“¦ Project Structure

Ecommerce-Amazon-Recommendation-Assistant/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/              # FastAPI Routes
β”‚   β”‚   β”‚   └── search.py     # Product search endpoints
β”‚   β”‚   β”œβ”€β”€ services/         # Business Logic
β”‚   β”‚   β”‚   β”œβ”€β”€ rag_service.py      # RAG & AI assistant
β”‚   β”‚   β”‚   └── text_embedder.py   # Text embedding service
β”‚   β”‚   β”œβ”€β”€ models/           # Database Schemas
β”‚   β”‚   β”œβ”€β”€ database.py       # Database configuration
β”‚   β”‚   β”œβ”€β”€ auth.py           # Authentication logic
β”‚   β”‚   └── main.py           # FastAPI app entry point
β”‚   β”œβ”€β”€ main.py               # Server entry point
β”‚   └── requirements.txt      # Python dependencies
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ app/                  # Next.js App Router
β”‚   β”‚   β”œβ”€β”€ page.tsx          # Main page
β”‚   β”‚   β”œβ”€β”€ layout.tsx        # Root layout
β”‚   β”‚   └── components/       # React components
β”‚   β”œβ”€β”€ public/               # Static assets
β”‚   β”œβ”€β”€ package.json          # Node dependencies
β”‚   └── tailwind.config.ts    # Tailwind configuration
β”œβ”€β”€ README.md
└── .gitignore

βš™οΈ Setup & Installation

Prerequisites

  • Python 3.13+
  • Node.js 20+
  • Redis (optional, for rate limiting)
  • Google Gemini API Key

1. Backend Setup

cd backend

# Create virtual environment
python -m venv . venv

# Activate virtual environment
# Windows: 
.venv\Scripts\activate
# Mac/Linux:
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Environment Configuration:

Create a .env file in the backend folder:

GOOGLE_API_KEY=your_gemini_api_key_here
SECRET_KEY=your_jwt_secret_key_here

Start the backend server:

python main.py

The backend will run at http://127.0.0.1:8000

2. Frontend Setup

cd frontend

# Install dependencies
npm install

# Run development server
npm run dev

The frontend will run at http://localhost:3000

3. Redis Setup (Optional)

For rate limiting functionality:

Windows:

# Install Redis using WSL or download Redis for Windows
redis-server

Mac:

brew install redis
brew services start redis

Linux:

sudo apt-get install redis-server
sudo systemctl start redis

πŸš€ How It Works

1. Data Ingestion

Products are processed and converted into vector embeddings using HuggingFace models, stored in ChromaDB and FAISS for fast retrieval.

2. Query Processing

User queries (text or image) are transformed into embeddings and matched against the vector database to retrieve relevant products.

3. Context Retrieval

The RAG system retrieves the most relevant product information based on the query and chat history.

4. AI Generation

Google Gemini processes the context and generates personalized shopping advice, recommendations, and answers.

5. Visual Search

CLIP model analyzes uploaded images and finds visually similar products using vector similarity search.

πŸ” Authentication

The app uses JWT-based authentication with the following endpoints:

  • POST /api/register - Create new user account
  • POST /api/login - Get JWT access token
  • Protected routes require Authorization: Bearer <token> header

🌐 API Endpoints

Chat Endpoints

  • POST /api/chat - Send text message to AI assistant
  • POST /api/chat-with-image - Upload image for visual search

Search Endpoints

  • POST /api/search - Search products by text query
  • POST /api/visual-search - Find similar products by image

πŸ“Š Features Breakdown

Feature Technology Description
Conversational AI Gemini 2.0 Flash + LangChain Natural language understanding and generation
Vector Search FAISS + ChromaDB Fast semantic similarity search
Visual Search CLIP + Gemini Vision Image-based product discovery
Authentication JWT Secure user sessions
Rate Limiting Redis Prevent API abuse
Chat History SQLAlchemy Persistent conversations
Responsive UI Tailwind CSS Mobile-first design

🎯 Use Cases

  • Product Discovery: "Show me winter jackets under $100"
  • Visual Search: Upload an image of shoes to find similar styles
  • Shopping Advice: "What's the best laptop for programming?"
  • Comparisons: "Compare iPhone 15 vs Samsung S24"
  • Recommendations: "Suggest gifts for a tech enthusiast"

πŸ›‘οΈ Security Features

  • Password hashing with bcrypt
  • JWT token-based authentication
  • Rate limiting (100 requests/minute per user)
  • CORS protection
  • Environment variable configuration

πŸ“ License

This project is for educational purposes under the MIT License.

🀝 Contributing

Contributions are welcome! Feel free to open issues or submit pull requests.

πŸ‘¨β€πŸ’» Author

tailormst


ShopShield AI - Your intelligent shopping companion πŸ›οΈβœ¨

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors