Home/Articles/Data Engineering
Data Engineering
12 min read
May 2026

Building a Netflix-Scale Streaming Intelligence Platform: Architecture, ML, and the Data Engineering Behind It

A deep dive into building a production-grade analytics ecosystem — from synthetic data generation to ML-driven churn prediction, experimentation engines, and a 10-page self-service dashboard across 7 APAC markets.

KP
Kiran Pawar
BFSI Transformation Consultant
Follow

When most people think about analytics, they think dashboards. When Netflix thinks about analytics, they think about a system that processes millions of streaming sessions, predicts which users will cancel next month, measures the exact revenue impact of a content thumbnail change, and does all of this across seven countries — simultaneously.

I built one. Not Netflix itself — but the full analytics architecture that replicates what a senior analytics engineering team at a company like Netflix would design, implement, and operate. The result is the Streaming Merchandising Intelligence Platform: a production-grade ecosystem simulating Netflix-scale operations across 7 APAC markets, live at analytics.kpintel.in.

Project Scale

200,000 users · 500 titles · 5 million streaming sessions · 20 million impressions · 10 marketing campaigns · 7 APAC markets (India, Japan, Korea, Indonesia, Thailand, Philippines, Australia)

The Vision: What Separates Analytics from Intelligence

There is a critical distinction between reporting and intelligence. Reporting tells you what happened yesterday. Intelligence tells you what is happening now, explains why, and predicts what will happen next. Most analytics projects stop at reporting. This platform is designed to demonstrate the full intelligence stack.

The platform answers four categories of questions that a real streaming business needs to operate:

  • Merchandising effectiveness: Which content slots, thumbnails, and promotional placements are actually driving engagement — and which are wasting screen real estate?
  • Experimentation rigour: Did the new homepage layout improve conversion? How confident are we, statistically?
  • Retention intelligence: Which user cohorts are churning? Can we predict who will cancel before they do?
  • Regional strategy: How does viewing behaviour in Japan differ from India, and how should content strategy reflect that?

Architecture: Demo Stack and the Ideal Production Path

The platform is built in two conceptual layers: what was actually built and deployed (the demo architecture), and how this system would be re-engineered for true Netflix-scale production. The diagram below shows both — and the equivalences between them.

Streaming Merchandising Intelligence Platform — Architecture

Demo Architecture

What Was Built — Live at analytics.kpintel.in

PRODUCTION DEMO
Data Simulation Layer
200K Users
Synthetic profiles · 7 APAC markets
5M Sessions
Viewing events · device · completion
20M Impressions
Merchandising slots · CTR · attribution
10 Campaigns
A/B groups · spend · conversion
Python 3.11 generate_all.pyFaker + NumPyParquet output
ETL Pipeline
Extract
CSV / Parquet readers · schema validation
Transform
Pandas · PyArrow · dedup · normalise
Load
DuckDB + PostgreSQL 15 writer
Python 3.11PandasPyArrowSQLAlchemy
Semantic / Data Modelling Layer
5 Staging Models
Standardised · cleaned · typed
3 Intermediate Models
Business logic · attribution rules
7 Data Mart Models
Star schema · SCD Type 2 · partitioned
PostgreSQL 15 — OLTP / Source of Truth
Dimensions · Facts · Views · Referential integrity
DuckDB 1.1 — In-process OLAP Engine
Sub-second analytics · columnar · zero-copy Parquet
dbt (15 models)PostgreSQL 15DuckDB 1.1dbt tests + lineage
Pipeline Orchestration
Daily DAG @ 06:00 UTC
Extract → Transform → dbt run → ML score
SRM Detection
Sample Ratio Mismatch check before experiment trust
Data Quality Gates
dbt tests · row counts · freshness alerts
Apache Airflow 2.9Python operatorsdbt CLI
Analytics API Layer
/regional
APAC market KPIs
/content
Title performance
/experiments
A/B results
/merchandising
Slot CTR · ROI
/ml
Churn · forecast
FastAPI 0.115Uvicorn asyncSQLAlchemy asyncAPI key authResponse caching
Machine Learning Models
Churn Predictor
Algorithm: LightGBM → RandomForest fallback
Metric: AUC-ROC ~0.84
30+ behavioural features · risk tiering
Demand Forecaster
Algorithm: Prophet + APAC holiday regressors
Metric: MAPE ~3.1%
7 market seasonality · title-level
Audience Segmentor
Algorithm: K-Means RFM clustering
Metric: Silhouette ~0.39
5 behavioural clusters · 200K users
Experiment Analyzer
Algorithm: Z-test + Bayesian Beta-Binomial
Metric: p-value + Bayesian probability
SRM detection · power analysis
LightGBMProphetscikit-learnSciPyModel Registry
Self-Service Dashboard — 10 Pages
Executive Overview
Title Performance
Merchandising Analytics
APAC Regional Intel
Experimentation Hub
Engagement Funnel
Retention Analysis
Content Discovery
Campaign Effectiveness
Ops Monitoring
Streamlit 1.39Plotly 5.24Netflix dark themeCross-filter stateNarrative generation
↓ How This Scales to Production
Ideal Production Architecture

Netflix-Grade Engineering — How This System Scales at 200M+ Users

ENTERPRISE GRADE
Data Sources — Real-time + Batch
Streaming Events
Playback · pause · skip · impressions
User Systems
Auth · profiles · subscriptions · billing
Content Metadata
Titles · thumbnails · genres · experiments
Third-party Signals
Ratings · social · partner APIs
Ingestion Layer — Real-time + Batch
Apache Kafka — Real-time Event Streaming
Billions of events/day · partitioned by user · exactly-once semantics · consumer groups per domain
Apache Spark — Batch Ingestion & CDC
Delta Lake writes · Change Data Capture · schema evolution · compaction jobs
Kafka (Confluent)Apache Flink (stream processing)Debezium CDCApache Spark 3.5
Data Lakehouse — Open Table Format
Delta Lake / Apache Iceberg
ACID transactions · time travel · schema evolution · partition pruning
S3 / GCS / MinIO (On-Prem)
Petabyte-scale Parquet · lifecycle policies · cross-region replication
Apache Hudi — Upserts
Near-real-time CDC · incremental pulls · record-level operations
Delta LakeApache IcebergApache HudiS3-compatible object store
Processing & Semantic Layer
dbt Cloud — Semantic Modelling
300+ models · CI/CD · data contracts · automated tests · lineage graph
Apache Spark / Trino — Compute
Distributed SQL · petabyte joins · shuffle-optimised query plans
Feast — Feature Store
Online + offline feature serving · point-in-time joins · feature versioning
dbt CloudApache Spark 3.5TrinoFeast Feature StoreGreat Expectations
ML Platform — Training · Serving · Monitoring
MLflow
Experiment tracking · model registry · artifact store
Kubernetes Jobs
Distributed training · GPU nodes · auto-scaling
Model Serving
Seldon / BentoML · A/B model experiments · canary deployments
Model Monitoring
Data drift · prediction drift · retraining triggers
MLflowKubernetesSeldon CoreEvidently AI (monitoring)Ray Tune
Analytics Serving Layer — Sub-second Query Performance
Apache Druid / ClickHouse
Sub-second OLAP · time-series · real-time ingestion from Kafka · pre-aggregated rollups
Redis Cluster — Cache
Hot query cache · feature serving · session state · sub-millisecond reads
Elasticsearch
Full-text search · content discovery · recommendation scoring · faceted filters
Apache DruidClickHouseRedis ClusterElasticsearchGraphQL API Gateway
Presentation & Action Layer
Apache Superset
Self-service BI · SQL IDE · role-based dashboards
Grafana
Real-time operational monitoring · alerting · SLO tracking
Custom React App
Personalised UX · embedded analytics · AI-assisted insights
Alert Engine
Proactive push alerts · Slack/email · threshold-based triggers
Apache SupersetGrafanaReact + D3.jsDataHub (data catalog)OpenTelemetry

Demo → Production Equivalences

Synthetic Data Gen
Kafka Event Streams
DuckDB (in-process)
Druid / ClickHouse OLAP
Airflow DAG (daily)
Flink + Spark (real-time)
Streamlit Dashboard
React + Superset + Grafana
Demo (Built & Live)
Ideal Production Scale
Open-source
ML / AI Layer
API / Serving

Streaming Intelligence Platform — Demo architecture (built) and Ideal production architecture (Netflix-grade), with layer-by-layer equivalences

Layer 1: Data Engineering Foundation

The base layer generates and processes synthetic but statistically realistic data representing user behaviour across all seven APAC markets. The ETL pipeline is written in Python 3.11 using Pandas and PyArrow for high-throughput columnar processing, with output stored in Parquet format — the same format used by Spark, Databricks, and every modern data lakehouse.

Why DuckDB alongside PostgreSQL?

Most analytics projects use PostgreSQL for everything. This platform uses PostgreSQL 15 as the operational store and DuckDB 1.1 as the OLAP query engine. DuckDB allows sub-second analytical queries on multi-million row datasets without a Spark cluster — it runs in-process, reads Parquet natively, and is ideal for the self-service analytics use case. In production, this role would be filled by Apache Druid or ClickHouse at petabyte scale.

Demo → Production Equivalence

DuckDB (in-process OLAP, millisecond queries on millions of rows) → Apache Druid or ClickHouse (distributed OLAP, sub-second queries on billions of rows, real-time Kafka ingestion)

Layer 2: The dbt Semantic Layer

Raw data without a semantic layer produces the most dangerous output in analytics: numbers that look right but mean different things to different people. I modelled the full semantic layer in dbt with 15 models across three tiers.

  • 5 staging models — standardised, cleaned, typed source data. No business logic, just trust.
  • 3 intermediate models — business logic transformations. Attribution rules, session stitching, campaign mapping.
  • 7 mart models — final dimensional tables for each analytics domain. Star schema with SCD Type 2 for historical accuracy.

dbt's built-in testing framework enforces data quality contracts on every pipeline run: uniqueness, referential integrity, non-null constraints, accepted value ranges. In production, this would be complemented by Great Expectations for deeper statistical validation and DataHub for data lineage and discovery.

Layer 3: Pipeline Orchestration

Apache Airflow 2.9 orchestrates the full pipeline on a daily DAG firing at 06:00 UTC. The DAG runs in order: Extract → Transform → dbt run → ML scoring → data quality checks. One non-obvious design decision: SRM (Sample Ratio Mismatch) detection runs as a gate before any experiment results are trusted. If traffic allocation between experiment variants deviates beyond tolerance, the downstream experiment analysis is flagged automatically.

In production, the batch-only Airflow DAG would be complemented by Apache Flink for real-time stream processing — enabling the system to react to user behaviour within seconds rather than the next morning.

Layer 4: The FastAPI Analytics Backend

The dashboard and ML systems do not query the database directly. All data flows through a FastAPI 0.115 backend with five router modules, each serving a distinct analytics domain: regional KPIs, content performance, experiment results, merchandising analytics, and ML model outputs.

The API uses async SQLAlchemy for non-blocking database connections, API key authentication, and response caching. In production, this layer would expand to a GraphQL API gateway with service mesh, horizontal auto-scaling on Kubernetes, and a Redis cluster for sub-millisecond hot query caching.

Layer 5: Machine Learning Models

This is where the platform moves from "reporting what happened" to "predicting what will happen." Four models are in production:

Churn Prediction — LightGBM

Uses 30+ engineered behavioural features — recency of viewing, binge session frequency, genre diversity score, cross-device pattern, days since last session, completion rate trend — to predict which users will cancel within 30 days. The model achieves AUC-ROC of ~0.84 and outputs a three-tier risk score (High / Medium / Low) for each user, enabling targeted retention campaigns rather than blanket interventions.

Demand Forecasting — Prophet

Predicts title-level viewing demand across each APAC market. Prophet was chosen specifically for its handling of APAC market seasonality — Japanese Golden Week, Indian festivals, Korean Chuseok, Australian summer schedules — all encoded as custom regressors. The model achieves MAPE of approximately 3.1%, meaning content scheduling and merchandising decisions can be made with high confidence 14–30 days ahead.

Audience Segmentation — K-Means RFM

Groups 200,000 users into 5 behavioural clusters using Recency, Frequency, and Monetary (engagement value) scoring. The Silhouette score of ~0.39 confirms meaningful cluster separation. Each segment receives different content merchandising weights, recommendation biases, and campaign targeting — enabling personalisation without individual-level model complexity.

Experimentation Engine — Frequentist + Bayesian

Most analytics platforms stop at p-values. This engine implements both approaches:

  • Frequentist: Z-test and Welch's t-test with confidence intervals, statistical power calculations, and minimum detectable effect sizing.
  • Bayesian: Beta-Binomial conjugate model giving a direct probability that the variant beats the control — no binary p-value threshold, no "marginally significant" ambiguity.
  • SRM Detection: Automatic flagging of traffic allocation errors before results are trusted, preventing false conclusions from biased experiment populations.

The difference between a dashboard and an intelligence platform is not the technology. It is the architectural discipline applied to every layer — from data contracts at ingestion to statistical rigour at the output.

Layer 6: The Self-Service Dashboard — 10 Pages

The dashboard is built in Streamlit 1.39 with Plotly 5.24 in Netflix's dark theme. Each of the 10 pages is designed around a specific business question, not a data schema — a distinction that matters enormously for adoption.

  • Executive Overview — Platform health, regional comparison, content mix at a glance
  • Title Performance — Funnel analysis, 90-day trend, benchmark scoring against portfolio
  • Merchandising Analytics — Slot CTR heatmap, campaign ROI attribution, Sankey traffic flow
  • APAC Regional Intelligence — Choropleth maps, market KPIs, genre preference matrices
  • Experimentation Hub — A/B results, confidence intervals, forest plot, sample size calculator
  • Engagement Funnel — Platform funnel drop-off, binge session analysis, completion by device
  • Retention Analysis — Cohort heatmaps, retention curves, churn score distribution
  • Content Discovery — Source attribution, recommendation algorithm performance scoring
  • Campaign Effectiveness — Portfolio ROI, spend vs revenue trend analysis
  • Operational Monitoring — Pipeline health, data freshness indicators, SRM alerts

The Technology Stack

  • Database: PostgreSQL 15 (OLTP) + DuckDB 1.1 (in-process OLAP)
  • ETL: Python 3.11, Pandas, PyArrow, columnar Parquet storage
  • Semantic Model: dbt (15 models — staging, intermediate, marts), SCD Type 2
  • API: FastAPI 0.115, Uvicorn, async SQLAlchemy, API key authentication
  • Dashboard: Streamlit 1.39, Plotly 5.24, Netflix dark theme
  • Machine Learning: LightGBM, Prophet, scikit-learn, SciPy
  • Orchestration: Apache Airflow 2.9, daily DAG with data quality gates
  • Infrastructure: Docker Compose, NGINX reverse proxy

What the Ideal Production Architecture Looks Like

The demo architecture makes deliberate trade-offs to run on a single server. A true Netflix-scale deployment would replace each layer with distributed, fault-tolerant, real-time equivalents — as shown in the lower half of the architecture diagram above.

The key architectural shifts from demo to production:

  1. 1.Kafka replaces synthetic data generation — billions of real user events stream in continuously rather than being generated in batch.
  2. 2.Apache Flink sits alongside Airflow — real-time stream processing enables second-level latency rather than daily batch cycles.
  3. 3.Delta Lake / Apache Iceberg replaces raw Parquet — ACID transactions, time travel, and schema evolution at petabyte scale.
  4. 4.Apache Druid or ClickHouse replaces DuckDB — distributed OLAP with real-time Kafka ingestion for sub-second queries across billions of rows.
  5. 5.Feast Feature Store replaces ad-hoc feature engineering — versioned, reusable features shared across all ML models with point-in-time correctness.
  6. 6.Kubernetes + MLflow replace local model execution — distributed training, A/B model experiments, canary deployments, automated retraining triggers.
  7. 7.React + Apache Superset replaces Streamlit — production-grade BI with role-based access, embedded analytics, and custom UX.

Why I Built This

After 20+ years of building enterprise data platforms for broking firms, wealth management companies, and capital markets, I have consistently seen the same gap: organisations that understand the value of data intelligence but struggle to architect systems that deliver it at scale.

The engineering principles behind this platform — semantic modelling, statistical rigour in experimentation, feature-centric ML, business-question-led dashboard design — apply directly to enterprise BFSI analytics. The technology names change (Kafka instead of NSE feeds, Druid instead of SSAS cubes) but the architectural discipline is identical.

This project exists to demonstrate that discipline concretely, not just in theory.

Explore the Platform

The platform is live at analytics.kpintel.in. The full consulting portfolio — including BFSI-specific case studies, data lakehouse architecture, and AI governance frameworks — is at kpintel.in.

KP

Discuss This with Kiran

If this resonates with challenges your firm is facing, let's have a strategic conversation about your data transformation journey.