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.
- π€ 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
- 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
- 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
ShopShield AI transforms traditional e-commerce browsing into an intelligent, conversational shopping experience. Instead of manually searching through hundreds of products, users can:
- Chat naturally about what they're looking for
- Upload images of products they like to find similar items
- Get personalized recommendations based on their preferences and chat history
- 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.
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
- Python 3.13+
- Node.js 20+
- Redis (optional, for rate limiting)
- Google Gemini API Key
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.txtEnvironment Configuration:
Create a .env file in the backend folder:
GOOGLE_API_KEY=your_gemini_api_key_here
SECRET_KEY=your_jwt_secret_key_hereStart the backend server:
python main.pyThe backend will run at http://127.0.0.1:8000
cd frontend
# Install dependencies
npm install
# Run development server
npm run devThe frontend will run at http://localhost:3000
For rate limiting functionality:
Windows:
# Install Redis using WSL or download Redis for Windows
redis-serverMac:
brew install redis
brew services start redisLinux:
sudo apt-get install redis-server
sudo systemctl start redisProducts are processed and converted into vector embeddings using HuggingFace models, stored in ChromaDB and FAISS for fast retrieval.
User queries (text or image) are transformed into embeddings and matched against the vector database to retrieve relevant products.
The RAG system retrieves the most relevant product information based on the query and chat history.
Google Gemini processes the context and generates personalized shopping advice, recommendations, and answers.
CLIP model analyzes uploaded images and finds visually similar products using vector similarity search.
The app uses JWT-based authentication with the following endpoints:
POST /api/register- Create new user accountPOST /api/login- Get JWT access token- Protected routes require
Authorization: Bearer <token>header
POST /api/chat- Send text message to AI assistantPOST /api/chat-with-image- Upload image for visual search
POST /api/search- Search products by text queryPOST /api/visual-search- Find similar products by image
| 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 |
- 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"
- Password hashing with bcrypt
- JWT token-based authentication
- Rate limiting (100 requests/minute per user)
- CORS protection
- Environment variable configuration
This project is for educational purposes under the MIT License.
Contributions are welcome! Feel free to open issues or submit pull requests.
tailormst
ShopShield AI - Your intelligent shopping companion ποΈβ¨