A production-style ETL pipeline that extracts cryptocurrency price data,
computes statistics, stores it in a PostgreSQL database, and displays a
visual dashboard using Flask. The pipeline includes a robust Dead Letter Queue
mechanism powered by PostgreSQL's LISTEN/NOTIFY to handle and monitor
data ingestion failures in real time.
- ETL pipeline for Bitcoin price data (CoinGecko API)
- Flask dashboard with real-time charting using Chart.js
- 7-day moving average and percent change calculations
- Dead Letter Queue (DLQ) for graceful error handling
- PostgreSQL-based real-time queue using
LISTEN/NOTIFY - Modular structure (extract/transform/load/dashboard)
- Easily extendable for other coins, metrics, or APIs
crypto_etl/
├── extract/ # CoinGecko API data fetcher
├── transform/ # Data cleaning & enrichment
├── load/ # DB loader + DLQ insertion
├── dlq/ # Real-time listener & optional retry logic
├── dashboard/ # Flask UI for dashboard & DLQ viewer
├── run_pipeline.py # Entrypoint for running ETL
├── init_db.sql # DB schema setup & triggers
├── requirements.txt # Dependencies
└── .env # Environment variables
| Layer | Tools Used |
|---|---|
| Language | Python 3.10+ |
| Data Source | CoinGecko API |
| Database | PostgreSQL |
| Backend | Flask |
| Charts | Chart.js |
| Real-time | PostgreSQL LISTEN/NOTIFY |
- Install dependencies
pip install -r requirements.txt- Set up PostgreSQL. Create a new DB and run the schema:
psql -U your_user -d your_db -f init_db.sql- Then add your .env file:
DATABASE_URL=postgresql://your_user:your_password@localhost:5432/your_db- Run the real-time DLQ listener
python dlq/listener.py- Run the ETL pipeline
python run_pipeline.py- Start the dashboard
python dashboard/app.py- Open
http://localhost:5000for the dashboard or go tohttp://localhost:5000/dlqto view DLQ entries
-
Build and start all services
docker compose build docker compose up -d
The sevices include
- Database (Postgres)
- DLQ Listener
- ETL pipeline
- Dashboard (Flask)