A production-ready end-to-end data engineering solution that extracts e-commerce data, transforms it through a modern data stack, and serves actionable insights via an interactive analytics dashboard.
- Overview
- Features
- Architecture
- Tech Stack
- Prerequisites
- Quick Start
- Project Structure
- Usage Guide
- Development
- Troubleshooting
- Contributing
- License
This project demonstrates a complete data engineering workflow for an e-commerce platform. It showcases best practices in data extraction, transformation, loading (ETL), and analytics using industry-standard tools. The pipeline automatically fetches data from external APIs, transforms it using dbt, and serves insights through an interactive Streamlit dashboardโall orchestrated with Apache Airflow and containerized with Docker.
- Data Ingestion: Seamlessly extract e-commerce data from APIs
- Data Transformation: Clean, validate, and aggregate data for analytics
- Data Storage: Maintain a scalable, normalized PostgreSQL database
- Data Visualization: Present actionable insights through interactive dashboards
- Automated Data Extraction: Fetches users, products, and shopping carts from DummyJSON API
- Intelligent Scheduling: Apache Airflow manages workflow orchestration and monitoring
- Error Handling & Logging: Comprehensive error tracking and retry mechanisms
- Data Validation: Built-in data quality checks at each pipeline stage
- Products Analytics: Explore inventory with category, price, and rating filters
- Customer Insights: Demographic analysis and geographic distribution
- Sales Performance: Revenue trends, top performers, and KPI tracking
- AI-Powered Recommendations: Machine learning-based product suggestions
- Interactive Visualizations: Real-time charts and metrics powered by Streamlit
- dbt Models: Modular, version-controlled transformation logic
- Staging Models: Raw data normalization and standardization
- Mart Models: Business-ready aggregated tables
- ML Features: Engineered features for machine learning pipelines
- Docker Containerization: Fully containerized for consistency and portability
- Multi-Service Orchestration: Docker Compose manages all services
- Scalable Architecture: Designed for easy scaling and customization
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Data Sources โ
โ (DummyJSON API, External APIs) โ
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Apache Airflow (Orchestration) โ
โ โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ โ
โ โFetch Users โFetch ProductsโFetch Carts โ โ
โ โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ PostgreSQL (Data Warehouse) โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Raw Schema (Source Data) โ โ
โ โ - users_raw, products_raw, ... โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ dbt (Transformation) โ
โ โโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโ โ
โ โ Staging โ Marts โ ML Features โ โ
โ โ Models โ Models โ Models โ โ
โ โโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Streamlit Analytics Dashboard โ
โ โโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโฌโโโโโโโโโโโ โ
โ โProducts โCustomers โ Sales โAnalytics โ โ
โ โโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโดโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Component | Technology | Purpose |
|---|---|---|
| Orchestration | Apache Airflow | Workflow scheduling and monitoring |
| Data Extraction | Python | API integration and data extraction |
| Data Storage | PostgreSQL | Primary data warehouse |
| Data Transformation | dbt (Data Build Tool) | SQL-based transformation and testing |
| ML Pipeline | Python (scikit-learn) | Model training and recommendations |
| Analytics | Streamlit | Interactive web dashboard |
| API Server | FastAPI | REST API for data access |
| Containerization | Docker & Docker Compose | Infrastructure orchestration |
Before getting started, ensure you have the following installed:
- Docker Desktop (v20.10+)
- Must be running during project startup
- Allocate at least 4GB RAM for smooth operation
- Git (v2.0+)
- pgAdmin 4 (Optional, for database inspection)
System Requirements:
- RAM: Minimum 4GB (8GB recommended)
- Disk Space: At least 10GB free
- OS: Windows, macOS, or Linux
git clone https://github.com/yourusername/ecommerce-data-pipeline.git
cd ecommerce-data-pipeline/data-eng-projectdocker-compose up -dDocker will automatically:
- Download required images
- Build custom containers
- Start all services (Airflow, PostgreSQL, API, Dashboard)
- Initialize databases
โณ Wait 1โ2 minutes for services to become healthy. Check status:
docker-compose psExpected output:
NAME STATUS
airflow-webserver Up (healthy)
airflow-scheduler Up (healthy)
airflow-worker Up (healthy)
postgres Up (healthy)
pgadmin Up (healthy)
api-server Up (healthy)
cd cd .\dashboard\โณ Create Vertual Environment
python -m venv venvโณ Activate Environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activateโณ Install all Library that require.
pip install -r requirements.txtstreamlit run app.py| Service | URL | Credentials |
|---|---|---|
| Airflow UI | http://localhost:8080 | airflow / airflow |
| Streamlit Dashboard | http://localhost:8501 | None required |
| FastAPI Docs | http://localhost:8000/docs | None required |
| pgAdmin | http://localhost:5050 | admin@admin.com / admin |
- Navigate to http://localhost:8080 (Airflow)
- Login with
airflow/airflow - Locate the
ecommerce_ingest_pipelineDAG - Click the โถ Trigger DAG button
- Monitor execution in the Graph view
Once the pipeline completes:
- Open http://localhost:8501 in your browser
- Explore the interactive dashboard:
- ๐ฆ Products: Category, price, and rating analytics
- ๐ฅ Customers: Demographics and location insights
- ๐ฐ Sales: Revenue trends and key metrics
- ๐ฎ Recommendations: ML-powered product suggestions
data-eng-project/
โโโ dags/ # Airflow DAGs (orchestration logic)
โ โโโ main_ingest.py # Main pipeline DAG
โ โโโ fetch_users.py # User extraction task
โ โโโ fetch_products.py # Product extraction task
โ โโโ fetch_carts.py # Shopping cart extraction task
โ โโโ load_to_postgres.py # Database loading task
โ
โโโ ecommerce_dbt/ # dbt project (transformation logic)
โ โโโ models/
โ โ โโโ staging/ # Raw data cleaning
โ โ โโโ marts/ # Business-ready tables
โ โ โโโ recommendations/ # ML feature engineering
โ โ โโโ ml_features/ # ML model inputs
โ โโโ dbt_project.yml # dbt configuration
โ โโโ profiles.yml # Database connection config
โ
โโโ dashboard/ # Streamlit analytics dashboard
โ โโโ app.py # Main dashboard application
โ โโโ pages/ # Multi-page analytics
โ โ โโโ 01_products.py # Product analytics page
โ โ โโโ 02_sales.py # Sales performance page
โ โ โโโ 03_users.py # Customer insights page
โ โ โโโ 04_insights.py # Advanced analytics
โ โ โโโ 05_recommendations.py # ML recommendations
โ โโโ utils/ # Helper functions
โ โโโ assets/ # Static files (logos, data)
| โโโ requirements.txt # Requirement library
โ
โโโ api/ # FastAPI backend
โ โโโ app/
โ โ โโโ main.py # API entry point
โ โ โโโ database.py # Database connection
โ โ โโโ models.py # Pydantic models
โ โ โโโ schemas.py # API request/response schemas
โ โ โโโ routers/ # API endpoint routes
โ โโโ requirements.txt # Python dependencies
โ
โโโ ml_pipeline/ # Machine learning service
โ โโโ train_model.py # Model training script
โ โโโ load_ml_rules.py # Load trained models
โ โโโ requirements.txt # ML dependencies
โ โโโ Dockerfile # ML service container
โ
โโโ postgres/
โ โโโ init/ # PostgreSQL initialization scripts
โ
โโโ config/
โ โโโ airflow.cfg # Airflow configuration
โ
โโโ docker-compose.yaml # Multi-container orchestration
โโโ .env # Environment variables
โโโ README.md # This file
# Trigger the pipeline via CLI
docker exec airflow-scheduler airflow dags trigger ecommerce_ingest_pipeline
# View DAG status
docker exec airflow-scheduler airflow dags list- Open http://localhost:5050
- Register a new server:
- Host:
postgres - Port:
5432 - Database:
ecommerce_db - Username:
admin - Password:
admin123
- Host:
# Connect to PostgreSQL directly
docker exec -it postgres psql -U admin -d ecommerce_db
# View tables in raw schema
SELECT table_name FROM information_schema.tables
WHERE table_schema = 'raw';
# Query sample data
SELECT * FROM raw.users LIMIT 10;# Airflow scheduler logs
docker-compose logs -f airflow-scheduler
# Airflow worker logs
docker-compose logs -f airflow-worker
# PostgreSQL logs
docker-compose logs -f postgres
# Dashboard logs
docker-compose logs -f dashboard# Gracefully stop all services (preserves data)
docker-compose down
# Stop and remove all data (full reset)
docker-compose down -v
# Stop specific service
docker-compose stop airflow-scheduler- Create extraction task in
dags/fetch_[source].py - Add task to main DAG in
dags/main_ingest.py - Create dbt models in
ecommerce_dbt/models/staging/ - Rebuild containers:
docker-compose up -d --build
# Test dbt models
docker exec ecommerce_dbt dbt test
# Run specific model
docker exec ecommerce_dbt dbt run --select staging.users
# Generate documentation
docker exec ecommerce_dbt dbt docs generateCreate new files in dashboard/pages/ following the naming convention NN_page_name.py.
Example template:
import streamlit as st
import pandas as pd
from utils.api import get_data
st.set_page_config(page_title="New Page", layout="wide")
st.title("๐ New Analytics Page")
# Your content hereProblem: docker-compose up fails or services are unhealthy
Solutions:
# Check Docker is running
docker ps
# View detailed error logs
docker-compose logs
# Rebuild containers
docker-compose up -d --build
# Complete restart
docker-compose down -v
docker-compose up -dProblem: Cannot connect to http://localhost:8080
Solutions:
# Wait for container to be fully healthy
docker-compose ps # Check STATUS
# Restart Airflow
docker-compose restart airflow-webserver
# Check port conflicts
netstat -an | findstr 8080 # Windows
lsof -i :8080 # Mac/LinuxProblem: DAG execution fails
Steps:
- Check Airflow logs: http://localhost:8080 โ DAG โ Latest Run โ Logs
- Verify database connectivity
- Check API availability (DummyJSON API status)
Problem: Cannot connect to PostgreSQL
Verify credentials:
docker exec -it postgres psql -U admin -d ecommerce_dbCommon errors:
- Port 5434 already in use โ Change in
docker-compose.yaml - Connection refused โ Wait for container health check
Problem: Streamlit dashboard shows errors
# Restart dashboard
docker-compose restart dashboard
# View logs
docker-compose logs dashboard
# Clear cache
docker exec dashboard streamlit cache clearContributions are welcome! Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow PEP 8 for Python code
- Add docstrings to functions and classes
- Include unit tests for new features
- Update documentation as needed
This project is licensed under the MIT License โ see the LICENSE file for details.
For issues, questions, or suggestions:
- ๐ง Email: sambathseakty@gmail.com
- ๐ GitHub Issues: Create an issue
This project demonstrates key data engineering concepts:
- ETL Pipelines: Extract, Transform, Load workflows
- Data Modeling: Dimensional modeling and normalization
- Orchestration: Workflow scheduling with Apache Airflow
- Data Quality: Testing and validation frameworks
- Analytics: Real-time dashboards and visualization
- DevOps: Containerization and infrastructure-as-code
- All of the project member of my team.
- Built with Apache Airflow
- Powered by dbt
- Dashboard by Streamlit
- API by FastAPI
- Data from DummyJSON
Last Updated: May 2026 | Made with โค๏ธ for the Data Engineering Community
docker-compose restart airflow-scheduler