Phase 1 — Foundation
Tasks 1–2Local dev environment, monorepo scaffold, and Kubernetes namespaces.
CompleteBuild an end-to-end real-time fraud detection pipeline using stream processing, ML models, and production monitoring.
Built over two weeks of intensive self-directed work: a production-style real-time fraud detection pipeline from local WSL2 setup through ML training, Kafka streaming, Kubernetes deployment, observability, and GitHub Actions CI/CD. Source code is live on GitHub; modules are published here sequentially.
Follow these build guides in order. Published modules are ready to start.
Local dev environment, monorepo scaffold, and Kubernetes namespaces.
CompleteFeature engineering in Colab and XGBoost model training/export.
CompleteKafka deployment, producer service, and consumer inference layer.
CompleteMongoDB StatefulSet and fraud-event persistence schema.
CompleteStreamlit dashboard with authentication and live fraud analytics.
CompletePrometheus metrics, Grafana dashboards, and alert tuning.
CompleteGitHub Actions pipeline, Docker Hub pushes, and K8s secrets.
CompleteChallenge: minikube start hangs or errors because Docker Desktop is not running on Windows.
Fix: Open Docker Desktop first, verify wsl --status shows VERSION 2, then rerun minikube start --driver=docker with 4 CPUs and 6GB RAM.
Challenge: Zookeeper not ready before Kafka starts, or services deployed in wrong namespace.
Fix: Deploy Zookeeper first, wait for Ready status, then Kafka. Keep Kafka in fraud-kafka namespace and verify bootstrap server DNS matches the service name.
Challenge: Consumer predictor throws KeyError because live events miss engineered features from training.
Fix: Centralize FEATURE_COLUMNS in predictor.py, add pytest tests that assert every column exists after engineer_features(), run tests in CI before deploy.
Challenge: increase(counter[30s]) returns 0.3 frauds when scrape interval is 60 seconds.
Fix: Use a range window at least 4× the scrape interval. increase() is rate × seconds — coarse windows extrapolate fractional counts.
Challenge: Fraud-rate alert fires and resolves every scrape when metric oscillates around threshold.
Fix: Add a for: duration (e.g. 2m) to alert rules so the condition must hold before firing. Configure resolve_timeout in Alertmanager.
Start with --cpus=4 --memory=6144 --disk-size=20g. Running Kafka, Redis, MongoDB, and three app services on 2GB RAM causes OOM kills that are hard to diagnose.
Use actions/cache on ~/.cache/pip and consider a slim requirements-dev.txt for CI tests instead of installing full xgboost on every lint job.
Hash nameOrig as the partition key so all transactions for one account land on the same consumer — enables accurate rolling-window features without cross-partition state.
Store rolling aggregates in Redis with TTL instead of recomputing from MongoDB on every event — cuts p99 latency below 100ms.
fraud-app, fraud-kafka, and fraud-monitoring namespaces mirror how platform teams isolate workloads — makes RBAC and blast-radius containment easier later.