A prototype dashboard for intelligent e-commerce analytics powered by LLMs, demonstrating natural language search, historical sales visualization, and AI-generated insights.
What: AI-powered e-commerce analytics dashboard with natural language search
Stack: Next.js + FastAPI + OpenAI GPT-4o-mini + DuckDB
Data: Real H&M dataset (476K transactions, 105K products) from S3
Time: ~2 hours development
What's Working (Real):
- โ NLP product search โ LLM parses queries
- โ Sales charts โ Real H&M transaction data
- โ AI insights โ LLM analyzes patterns
- โ AI Agent โ Conversational analytics interface
What's Mocked: Forecasts & customer segments (with production roadmap documented below)
๐บ Watch Demo Video - 2 minute walkthrough showing search โ analytics โ AI agent interaction
ShopSight transforms e-commerce analytics by making it agentic, search-driven, and intelligent. Users can search for products in natural language and instantly see:
- ๐ Historical Sales Trends (real data visualization)
- ๐ค AI-Generated Insights (LLM-powered analysis)
- ๐ Sales Forecasts (mocked, but production-ready architecture)
- ๐ฅ Customer Segmentation (mocked, demonstrates future capability)
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Next.js Frontend (TypeScript) โ
โ - React Components (Recharts for charts) โ
โ - Tailwind CSS for styling โ
โ - Axios for API calls โ
โโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ REST API
โโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ FastAPI Backend (Python) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ LLM Service (OpenAI GPT-4o-mini) โ โ
โ โ - Natural language search parsing โ โ
โ โ - Insights generation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Data Processor (DuckDB + Pandas) โ โ
โ โ - H&M dataset processing โ โ
โ โ - Sales aggregation โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
-
Natural Language Product Search ๐
- User types: "running shoes", "red dresses", etc.
- LLM parses query into structured search parameters
- Returns matching products from H&M dataset
- Displays friendly interpretation of search intent
-
Historical Sales Visualization ๐
- Real data from H&M transaction history
- Interactive line/bar charts (Recharts)
- Weekly aggregation with sales count & revenue
- Clean, professional UI with tooltips
-
AI-Generated Insights ๐ค
- LLM analyzes sales patterns
- Generates human-readable insights
- Identifies trends, anomalies, recommendations
- Contextual analysis of performance data
-
Sales Forecasting ๐
- Mocked 30-day predictions
- Shows confidence intervals
- Production approach: Time series models (ARIMA, Prophet, LSTM)
-
Customer Segmentation ๐ฅ
- Mocked buyer personas with characteristics
- Shows percentage distribution and avg purchase value
- Production approach: K-means clustering, RFM analysis
- Node.js 18+ (for Next.js frontend)
- Python 3.10+ (for FastAPI backend)
- OpenAI API Key (for LLM features)
-
Clone the repository
git clone <your-repo-url> cd ShopSight
-
Backend Setup
cd backend # Create virtual environment python3 -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate # Install dependencies pip install -r requirements.txt # Create .env file with your OpenAI API key export OPENAI_API_KEY="your_key_here"
Note: Data loads automatically from S3 on first startup (no preprocessing needed!)
-
Frontend Setup
cd ../frontend # Install dependencies npm install
Terminal 1 - Backend:
cd backend
source venv/bin/activate
python -m uvicorn main:app --reload --port 8000Terminal 2 - Frontend:
cd frontend
npm run devOpen browser: http://localhost:3000
- Type "running shoes" in the search bar
- Click Search โ AI parses your query
- Select a product from results
- See the magic:
- ๐ Real sales chart loads
- ๐ค AI insights appear
- ๐ Forecast shown (mocked)
- ๐ฅ Segments displayed (mocked)
Goal: Demonstrate LLM integration + real data processing in a demoable prototype
Strategy:
- โ Perfect one end-to-end flow (search โ sales โ insights)
- โ Use real data where it matters (sales history)
- โ Mock intelligently where it doesn't (forecasts, segments)
- โ Polish the UX to feel production-ready
| Choice | Rationale |
|---|---|
| Next.js | Modern React framework, fast development, great DX |
| FastAPI | Python + async + auto docs = perfect for data/ML APIs |
| OpenAI GPT-4o-mini | Fast & cheap for demos, easy upgrade to GPT-4o |
| DuckDB | In-memory SQL engine, blazing fast for analytics queries |
| Recharts | Beautiful React charts with minimal config |
| Tailwind CSS | Rapid UI development, clean design system |
Use Case 1: Semantic Search ๐
User: "comfortable shoes for running"
โ
LLM extracts: {type: "shoes", activity: "running", attribute: "comfort"}
โ
Maps to: product_type="sneakers", description contains "running"
Use Case 2: Insights Generation ๐ค
1. Fetch sales data (real)
2. Calculate aggregates (peaks, trends)
3. LLM synthesizes narrative
4. Return structured insights + summary
Why LLMs Add Value:
- Natural language interface (vs complex filters)
- Contextual understanding (not just keyword matching)
- Human-readable explanations (not just numbers)
- Scalable to more complex queries
Base URL: http://localhost:8000 โข Interactive Docs: http://localhost:8000/docs
POST /api/search- Natural language product searchGET /api/analytics/sales/{article_id}- Historical sales data (โ Real)GET /api/analytics/forecast/{article_id}- Predictive sales forecasting (๐ญ Mocked)GET /api/analytics/segments/{article_id}- Customer demographic analysis (๐ญ Mocked)GET /api/insights/{article_id}- AI-generated performance insights (โ Real)
POST /api/agent/ask- Interactive AI analytics with conversational context (โ Real)
# Search for products
curl -X POST http://localhost:8000/api/search \
-H "Content-Type: application/json" \
-d '{"query": "black dress"}'
# Get sales history
curl http://localhost:8000/api/analytics/sales/123456789
# Ask AI Agent
curl -X POST http://localhost:8000/api/agent/ask \
-H "Content-Type: application/json" \
-d '{"article_id": "123456789", "question": "What are the sales trends?", "conversation_history": []}'Source: s3://kumo-public-datasets/hm_with_images/
Automatic Loading:
- Downloads from S3 on first startup
- Caches locally for fast subsequent loads
- No manual preprocessing needed
What's loaded:
articles/โ 105,542 products (parquet format)transactions/โ 476,039 sales records (parquet format)
Processing:
- Products: Loaded into memory as JSON for fast search
- Transactions: Loaded into DuckDB for fast analytics queries
- Cache: Stored in
backend/data/cache/for instant reloads
-
Data Scale & Performance
- Assumed ~100K products and ~500K transactions is acceptable for demo
- Products loaded in memory (fast search, acceptable for demo scale)
- Transactions in DuckDB (OLAP-optimized for analytics queries)
- In production: Would use proper DB (PostgreSQL + Redis cache)
-
LLM Usage & Cost
- Assumed OpenAI API access is available
- Used GPT-4o-mini for cost efficiency (~10x cheaper than GPT-4)
- Structured outputs ensure reliability (no hallucinated JSON)
- Average cost per search: ~$0.001-0.002
-
User Experience
- Assumed users prefer natural language over complex filters
- 2-3 second LLM latency is acceptable for better UX
- Search results filtered to products with sales data (avoid empty charts)
- Visual loading states to manage expectations
-
Mocking Strategy
- Forecasts/segments mocked because:
- Real ML models would take hours to train properly
- Demo timeline prioritizes working end-to-end flow
- Architecture is ready for easy swap-in of real models
- Mocked data is realistic (not random garbage)
- Forecasts/segments mocked because:
-
Demo Constraints
- Target: 1-2 hour development time (actual: ~2 hours)
- Prioritized: One perfect flow over many half-baked features
- Tech stack: Chose familiar tools (Next.js/FastAPI) for speed
- No authentication (demo scenario, would add in production)
-
Data Quality
- Assumed H&M dataset is clean (it is!)
- Sales data is normalized/sparse โ Applied 30x scaling for believable demo numbers
- Revenue scaled 300,000x (original prices were normalized)
- In production: Would use actual transaction values
| Decision | Why | Production Alternative |
|---|---|---|
| In-memory products | Fast search, simple | PostgreSQL with full-text search |
| DuckDB for analytics | Perfect for OLAP, embeddable | ClickHouse or BigQuery |
| Mock forecasts | ML models take too long to train | Time series models (Prophet, ARIMA) |
| Mock segments | Real clustering needs customer profiles | K-means on RFM analysis |
| S3 direct load | Simple, no infra needed | ETL pipeline (Airflow/Dagster) |
| Monolithic backend | Faster development | Microservices for scale |
-
Real Forecasting Models ๐
- Prophet for seasonality detection
- LSTM for complex patterns
- Ensemble methods for robustness
- A/B test different models
-
Real Customer Segmentation ๐ฅ
- RFM (Recency, Frequency, Monetary) analysis
- K-means clustering on purchase behavior
- DBSCAN for anomaly detection
- Persona generation with LLMs
-
Multi-Turn Conversations ๐ฌ
- "Show me top products"
- "Compare to last quarter"
- "What drove the spike in November?"
- Agentic flow with function calling
-
Comparative Analysis โ๏ธ
- Side-by-side product comparison
- Category-level insights
- Competitor benchmarking (with external data)
-
Data Pipeline ๐
- Incremental ETL from S3
- Real-time updates
- Caching layer (Redis)
- Data quality monitoring
-
Advanced Visualizations ๐
- Heatmaps for seasonal patterns
- Cohort analysis
- Geographic insights
- Interactive drill-downs
ShopSight/
โโโ backend/
โ โโโ main.py # FastAPI app entry point
โ โโโ routers/
โ โ โโโ search.py # Product search endpoints
โ โ โโโ analytics.py # Sales & forecasts
โ โ โโโ insights.py # AI insights generation
โ โ โโโ agent.py # AI analytics agent
โ โโโ services/
โ โ โโโ llm_service.py # OpenAI integration
โ โ โโโ data_processor.py # S3 loading & DuckDB queries
โ โโโ models/
โ โ โโโ schemas.py # Pydantic models
โ โโโ data/
โ โ โโโ cache/ # S3 cached data (auto-downloaded)
โ โ โโโ raw/ # Raw S3 parquet files
โ โโโ requirements.txt # Python dependencies
โ โโโ venv/ # Virtual environment (gitignored)
โโโ frontend/
โ โโโ app/
โ โ โโโ page.tsx # Main dashboard
โ โ โโโ layout.tsx # App layout
โ โ โโโ globals.css # Global styles
โ โ โโโ favicon.ico # Browser icon
โ โโโ components/
โ โ โโโ SearchBar.tsx # Search input
โ โ โโโ ProductImage.tsx # Image with lazy loading
โ โ โโโ SalesChart.tsx # Historical sales visualization
โ โ โโโ ForecastChart.tsx # Demand forecast chart
โ โ โโโ InsightsPanel.tsx # AI insights display
โ โ โโโ SegmentCards.tsx # Customer segments
โ โ โโโ AIAgent.tsx # Conversational AI agent
โ โ โโโ LoadingSpinner.tsx # Loading states
โ โโโ lib/
โ โ โโโ api.ts # API client & types
โ โโโ package.json # Node dependencies
โ โโโ next.config.ts # Next.js config
โ โโโ tsconfig.json # TypeScript config
โ โโโ node_modules/ # NPM packages (gitignored)
โโโ README.md # This file
โโโ .gitignore # Git ignore rules
This is a demo project for Kumo.AI interview purposes.
This prototype demonstrates my ability to:
- โ Quickly scope and prioritize features
- โ Integrate LLMs thoughtfully (not just chatbots)
- โ Build production-quality architecture
- โ Balance real implementation vs. smart mocking
- โ Create demoable, polished UX
- โ Communicate technical decisions clearly
Time spent: ~2 hours (with focus on quality over speed)
What I'm most proud of:
- AI Analytics Agent - Went beyond requirements with a conversational interface that provides contextual insights
- Triple LLM Integration - Search parsing, insight generation, AND agent (not just one chatbot)
- Real Data Pipeline - Actual S3 loading, DuckDB analytics, not just mocks
- Production Architecture - Clean separation, type-safe, scalable patterns
- Thoughtful UX - Dark theme, lazy-loaded images, smooth interactions
Key Achievements:
- โ End-to-end working flow (search โ analytics โ insights)
- โ Real H&M dataset with 476K transactions processed
- โ Three distinct LLM use cases demonstrating agentic patterns
- โ Modern, polished UI that feels customer-ready
- โ Honest mocking with production roadmap
Thank you for the opportunity to build this! ๐
Contact: Manush Murali โข manushpalaniappan@gmail.com โข @Manushpm8