How akashpaul2030/ecommerce_chatbot_recommendation works
Project type and purpose
• This is a full-stack e-commerce recommendation system that combines a React frontend with a Python/FastAPI backend.
• It implements a Retrieval-Augmented Generation (RAG) pipeline to allow users to search for products in natural language and get semantically matched results.
File structure
• Top-level “frontend” and “backend” folders indicate a clear separation of concerns:
• frontend/… – React application with modular components, pages, and an API service layer (api.js).
• backend/… – Python package organized into subpackages:
• data/ – product data ingestion and processing
• database/ – vector store abstraction for embeddings
• rag/ – embedding generation and retrieval logic
• api/ – FastAPI application and route definitions
• utils/ – query parsing utilities
• Configuration files at the root (config.py, requirements.txt, setup.py) and docker assets (Dockerfile.* and docker-compose.dev.yml) support containerized development and deployment.
README for additional insights
• The README confirms a layered architecture:
• Data Processing Layer
• Vector Database
• RAG Engine (embeddings + retriever)
• RESTful API
• Frontend details: React components, state management, responsive design.
a. Main components
1. User (Browser/Mobile)
2. React Frontend
– UI Components (ChatInterface, ProductCard, SearchFilters)
– API Service (api.js)
3. Backend API (FastAPI/Uvicorn)
4. Data Processing Layer (data_processor, product_catalog)
5. Vector Store (vector_store.py – could be FAISS, Melvus, etc.)
6. RAG Engine
– Embedding Service (embeddings.py)
– Retriever (retriever.py)
7. Database / Persistent Storage (original TSV or SQL/NoSQL store)
8. External LLM or Vector DB (e.g., Melvus, OpenAI API)
9. Configuration & Deployment (config.py, Docker, docker-compose)
b. Relationships and interactions
• User → React UI → *GET /products* or *POST /query* → FastAPI endpoints
• FastAPI → QueryParser → DataProcessor → EmbeddingService → VectorStore → Retriever → returns ranked product IDs → FastAPI → React UI → User
• React UI also fetches filtering options from *GET /filters*
• DataProcessor ingests raw product data into the VectorStore on startup or via batch jobs
• Docker Compose orchestrates Frontend and Backend containers, with environment configs pointing to each other
c. Architectural patterns & design principles
• Layered architecture (presentation, application/API, domain/data, infrastructure)
• Separation of concerns (frontend vs. backend, data ingestion vs. retrieval)
• Pipeline pattern in RAG (text → embeddings → vector search → LLM augmentation)
• Modular React components for reusability and maintainability
d. Key technologies, frameworks, and libraries
• Frontend: React, JSX, CSS modules, npm
• Backend: Python 3.8+, FastAPI, Uvicorn
• Embeddings: scikit-learn TF-IDF or sentence-transformers (optional), Melvus integration
• Vector DB: custom VectorStore abstraction (with possible backends like FAISS, Pinecone, Qdrant)
• Containerization: Docker, Docker Compose