An open API service indexing awesome lists of open source software.

https://github.com/flexycode/ecommerce-analytics

πŸ€– Real-time analytics platform for e-commerce businesses with AI-powered sales predictions and inventory management.
https://github.com/flexycode/ecommerce-analytics

docker docker-compose flask kubernetes nestjs nextjs14 numpy pandas posgresql python redis socket-io tailwindcss typeorm typescript

Last synced: 17 days ago
JSON representation

πŸ€– Real-time analytics platform for e-commerce businesses with AI-powered sales predictions and inventory management.

Awesome Lists containing this project

README

          

# E-commerce Analytics Dashboard

> Real-time analytics platform for e-commerce businesses with AI-powered sales predictions and inventory management.

[![Next.js](https://img.shields.io/badge/Next.js-14+-black?style=flat-square&logo=next.js)](https://nextjs.org/)
[![NestJS](https://img.shields.io/badge/NestJS-10+-red?style=flat-square&logo=nestjs)](https://nestjs.com/)
[![PostgreSQL](https://img.shields.io/badge/PostgreSQL-16-blue?style=flat-square&logo=postgresql)](https://postgresql.org/)
[![Redis](https://img.shields.io/badge/Redis-7-red?style=flat-square&logo=redis)](https://redis.io/)
[![Kubernetes](https://img.shields.io/badge/Kubernetes-ready-blue?style=flat-square&logo=kubernetes)](https://kubernetes.io/)

## ✨ Features

- **πŸ“Š Real-time Analytics Dashboard** - Monitor sales, revenue, and inventory with sub-second latency
- **πŸ€– AI-Powered Predictions** - Machine learning models for sales forecasting and inventory optimization
- **πŸ“¦ Inventory Management** - Real-time stock tracking with automated low-stock alerts
- **🎨 Customizable Dashboards** - Drag-and-drop widgets to build personalized analytics views
- **πŸ”’ GDPR/CCPA Compliant** - Built-in privacy controls for data export, deletion, and consent management
- **⚑ WebSocket Real-time Updates** - Live data streaming for instant dashboard updates

## 🎯 Key Outcomes

| Metric | Target |
|--------|--------|
| Sales Conversion Increase | **30%** |
| Inventory Tracking | **Real-time** (<1s latency) |
| Dashboard Customization | **100%** user personalization |

## οΏ½ Screenshots

### Landing Page
![Landing Page](public/screenshots/landing-page.png)
*Premium landing page with animated gradients, feature highlights, and technology stack showcase*

### Analytics Dashboard
![Dashboard Overview](public/screenshots/dashboard.png)
*Real-time dashboard with metrics cards, sales charts, recent orders, low stock alerts, and AI predictions*

## οΏ½πŸ› οΈ Technology Stack

| Layer | Technology |
|-------|------------|
| **Frontend** | Next.js 14+, TypeScript, Tailwind CSS |
| **Backend** | NestJS, TypeORM, Socket.io |
| **Database** | PostgreSQL 16 |
| **Cache** | Redis 7 |
| **ML Service** | Python, Flask, NumPy, Pandas |
| **Container** | Docker, Docker Compose |
| **Orchestration** | Kubernetes |

## πŸ“ Project Structure

```
ecommerce-analytics/
β”œβ”€β”€ src/ # Next.js Frontend
β”‚ β”œβ”€β”€ app/ # App Router pages
β”‚ β”‚ β”œβ”€β”€ dashboard/ # Dashboard pages
β”‚ β”‚ └── ...
β”‚ └── components/ # React components
β”‚ └── dashboard/ # Dashboard-specific components
β”œβ”€β”€ backend/ # NestJS Backend
β”‚ └── src/
β”‚ β”œβ”€β”€ modules/
β”‚ β”‚ β”œβ”€β”€ analytics/ # Real-time analytics
β”‚ β”‚ β”œβ”€β”€ auth/ # JWT authentication
β”‚ β”‚ β”œβ”€β”€ cache/ # Redis caching
β”‚ β”‚ β”œβ”€β”€ inventory/ # Stock management
β”‚ β”‚ β”œβ”€β”€ predictions/ # AI forecasting
β”‚ β”‚ β”œβ”€β”€ privacy/ # GDPR compliance
β”‚ β”‚ └── sales/ # Sales data
β”‚ └── common/ # Shared utilities
β”œβ”€β”€ ml-service/ # Python ML Service
β”œβ”€β”€ k8s/ # Kubernetes manifests
β”œβ”€β”€ docker-compose.yml # Local development
└── docs/ # Documentation
```

## πŸš€ Quick Start

### Prerequisites

- Node.js 18+
- Docker & Docker Compose
- PostgreSQL 16 (or use Docker)
- Redis 7 (or use Docker)

### 1. Clone and Install

```bash
# Clone the repository
git clone https://github.com/yourusername/ecommerce-analytics.git
cd ecommerce-analytics

# Install frontend dependencies
npm install

# Install backend dependencies
cd backend && npm install && cd ..
```

### 2. Environment Setup

```bash
# Copy environment files
cp backend/env.example backend/.env

# Edit .env with your configuration
# See env.example for all options
```

### 3. Start with Docker Compose (Recommended)

```bash
# Start all services
docker-compose up -d

# View logs
docker-compose logs -f
```

### 4. Or Start Manually

```bash
# Terminal 1: Start PostgreSQL and Redis
docker run -d -p 5432:5432 -e POSTGRES_PASSWORD=postgres postgres:16-alpine
docker run -d -p 6379:6379 redis:7-alpine

# Terminal 2: Start backend
cd backend && npm run start:dev

# Terminal 3: Start frontend
npm run dev

# Terminal 4: Start ML service
cd ml-service && python app.py
```

### 5. Access the Application

- **Frontend Dashboard:** http://localhost:3000
- **Backend API:** http://localhost:4000
- **API Documentation:** http://localhost:4000/api/docs
- **ML Service:** http://localhost:5000

## πŸ“– API Documentation

The API is documented with Swagger/OpenAPI. Access the documentation at:

```
http://localhost:4000/api/docs
```

### Key Endpoints

| Method | Endpoint | Description |
|--------|----------|-------------|
| POST | `/api/auth/register` | Register new user |
| POST | `/api/auth/login` | User login |
| GET | `/api/analytics/dashboard` | Get dashboard metrics |
| GET | `/api/sales` | List sales with pagination |
| GET | `/api/sales/metrics` | Get sales metrics |
| GET | `/api/inventory/products` | List products |
| GET | `/api/predictions/forecast` | Get AI predictions |
| GET | `/api/privacy/export` | Export user data (GDPR) |

## ☸️ Kubernetes Deployment

```bash
# Apply all manifests
kubectl apply -f k8s/

# Check deployments
kubectl get pods

# Check services
kubectl get services

# View HPA status
kubectl get hpa
```

## πŸ§ͺ Testing

```bash
# Frontend tests
npm run test

# Backend tests
cd backend && npm run test

# E2E tests
npm run test:e2e
```

## πŸ“Š Performance Targets

| Metric | Target |
|--------|--------|
| Dashboard Load Time | < 2 seconds |
| Real-time Update Latency | < 1 second |
| API Response Time (95th) | < 200ms |
| System Uptime | 99.9% |

## πŸ” Security & Compliance

- **Authentication:** JWT-based with secure token management
- **Authorization:** Role-based access control (RBAC)
- **Data Encryption:** TLS 1.3 in transit, encrypted at rest
- **GDPR Compliance:** Data export, deletion, consent management
- **CCPA Compliance:** Privacy rights dashboard

## 🀝 Contributing

1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit changes (`git commit -m 'Add amazing feature'`)
4. Push to branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## πŸ“„ License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

Built with ❀️ by Jay Arre P. Talosig for data-driven e-commerce success