A full-stack e-commerce analytics tool built with FastAPI + Streamlit + Machine Learning.
It uses a real-world dataset of transactions to uncover business insights through SQL, clustering, and interactive dashboards.
- ⚙️ Backend: FastAPI + SQLite + raw SQL queries
- 🎨 Frontend: Streamlit (interactive dashboard)
- 🤖 ML: Customer Segmentation via KMeans
- ☁️ Hosting: Render (API) + Streamlit Cloud (dashboard)
- 🔝 Top customers by total revenue
- 📈 Daily revenue trends (with date filtering)
- 📦 Top-selling products
- 🌎 Sales by country (coming soon)
- 🧠 Customer Segmentation using RFM + KMeans
- 📊 Streamlit dashboard for visual insights
✅ Live API (deployed on Render):
🔗 https://ecommerce-analytics-api.onrender.com/docs
/top-customers/daily-sales?start=YYYY-MM-DD&end=YYYY-MM-DD/top-products?limit=10/customer-segment?customer_id=12345
✅ Live App:
🔗 https://ecommerce-analytics-api.streamlit.app
Interactive dashboard built on top of the FastAPI API. Powered by real-time data and machine learning.
- Top Customers – bar chart + data table of top 10 spenders
- Daily Sales – filterable line chart of daily revenue
- Customer Segmentation – enter a customer ID to view:
- Recency, Frequency, Monetary value
- Assigned cluster (e.g., "Loyal", "At Risk", "High Value")
📦 Kaggle: E-Commerce Data
UK-based online retail transaction dataset with product-level invoice data.
- Clone the repo:
git clone https://github.com/yourusername/ecommerce-analytics-api.git cd ecommerce-analytics-api