A comprehensive Data Warehouse + Real-Time Analytics Platform combining transactional microservices with a cloud-native data pipeline.
┌───────────────────────────────────────────────────────────────────┐
│ OPERATIONAL LAYER (GKE/Cloud Run) │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌─────────────┐ │
│ │ Order API│ │ Payment │ │Inventory │ │ Shipping │ │
│ │ (WebFlux)│ │ Service │ │ Service │ │ Service │ │
│ └────┬─────┘ └────┬─────┘ └────┬─────┘ └──────┬──────┘ │
│ │ │ │ │ │
│ └─────────────┴─────────────┴───────────────┘ │
│ │ │
│ ┌────────▼─────────┐ │
│ │ Kafka Cluster │ │
│ │ (Event Stream) │ │
│ └────────┬─────────┘ │
└─────────────────────────────┼─────────────────────────────────────┘
│
┌─────────────────────────────▼─────────────────────────────────────┐
│ INGESTION LAYER (GCP + K8s) │
│ ┌─────────────┐ ┌─────────────┐ ┌──────────────┐ │
│ │ Debezium │ │ Pub/Sub │ │ Dataflow │ │
│ │ CDC │ │ (Events) │ │ (Streaming) │ │
│ └──────┬──────┘ └──────┬──────┘ └──────┬───────┘ │
│ │ │ │ │
│ └────────────────┴────────────────┘ │
│ │ │
└──────────────────────────┼────────────────────────────────────────┘
│
┌──────────────────────────▼───────────────────────────────────────┐
│ RAW DATA LAYER (GCS + BigQuery) │
│ ┌────────────────┐ ┌────────────────┐ ┌─────────────────┐ │
│ │ GCS Buckets │ │ BigQuery │ │ Bigtable │ │
│ │ (Data Lake) │ │ (Raw Tables) │ │ (Time-Series) │ │
│ │ - bronze/ │ │ - raw_orders │ │ - event_stream │ │
│ │ - silver/ │ │ - raw_payments │ │ - clickstream │ │
│ │ - gold/ │ │ - raw_shipping │ └─────────────────┘ │
│ └───────┬────────┘ └───────┬────────┘ │
└──────────┼───────────────────┼───────────────────────────────────┘
│ │
┌──────────▼───────────────────▼────────────────────────────────────┐
│ TRANSFORMATION LAYER (dbt + Dataform) │
│ ┌────────────────────────────────────────────────────┐ │
│ │ dbt Models (SQL) │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────────┐ │ │
│ │ │ Staging │→ │ Marts │→ │ Aggregates │ │ │
│ │ │ (Clean) │ │(Business)│ │ (Metrics) │ │ │
│ │ └──────────┘ └──────────┘ └──────────────┘ │ │
│ └────────────────────────────────────────────────────┘ │
│ Data Quality: Great Expectations + Soda │
└──────────────────────────┬────────────────────────────────────────┘
│
┌──────────────────────────▼───────────────────────────────────────┐
│ SERVING LAYER (BigQuery + GCS) │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
│ │ Dimensional │ │ Aggregate │ │ ML Ready │ │
│ │ Models │ │ Tables │ │ Features │ │
│ │ - dim_* │ │ - fact_* │ │ - feature_* │ │
│ │ - fact_* │ │ - metrics_* │ └──────────────┘ │
│ └──────────────┘ └──────────────┘ │
└──────────────────────────┬───────────────────────────────────────┘
│
┌──────────────────────────▼───────────────────────────────────────┐
│ CONSUMPTION LAYER (BI + Apps) │
│ ┌─────────────┐ ┌────────────┐ ┌─────────────┐ │
│ │ React UI │ │ Grafana │ │ Looker │ │
│ │ (Dashboard) │ │ (Metrics) │ │ (Reports) │ │
│ └─────────────┘ └────────────┘ └─────────────┘ │
└──────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────┐
│ ORCHESTRATION: Cloud Composer (Airflow) │
│ INFRASTRUCTURE: Terraform + Helm │
│ GOVERNANCE: Dataplex + Data Catalog │
└─────────────────────────────────────────────────┘
order-analytics-platform/
├── terraform/ # Infrastructure as Code
│ ├── modules/ # Reusable Terraform modules
│ │ ├── bigquery/ # BigQuery datasets, tables, views
│ │ ├── gke-cluster/ # GKE cluster (optional - can use Cloud Run)
│ │ ├── cloud-run/ # Cloud Run services (recommended)
│ │ ├── vpc/ # VPC, subnets, firewall rules
│ │ ├── pubsub/ # Pub/Sub topics and subscriptions
│ │ ├── composer/ # Cloud Composer (Airflow)
│ │ ├── gcs-buckets/ # GCS buckets for data lake
│ │ ├── iam/ # Service accounts and IAM roles
│ │ └── cloud-sql/ # PostgreSQL (operational DB)
│ └── environments/ # Environment-specific configs
│ ├── dev/
│ ├── staging/
│ └── prod/
├── scripts/ # Deployment and utility scripts
│ ├── deploy-cloud-run.sh # Deploy services to Cloud Run
│ ├── setup-database.sh # Initialize databases
│ └── quick-start.sh # Quick setup script
├── dbt/ # Data transformations
│ ├── models/
│ │ ├── staging/ # Cleaned source tables
│ │ ├── marts/ # Business logic models
│ │ └── aggregates/ # Pre-aggregated metrics
│ ├── tests/ # Data quality tests
│ ├── macros/ # Reusable SQL functions
│ └── seeds/ # Static lookup data
├── airflow/ # Orchestration
│ ├── dags/ # DAG definitions
│ ├── plugins/ # Custom operators
│ └── config/ # Airflow configuration
├── services/ # Microservices
│ ├── order-service/ # Spring Boot WebFlux
│ ├── payment-service/ # Payment processing
│ ├── inventory-service/ # Inventory management
│ ├── shipping-service/ # Shipping logic
│ ├── saga-coordinator/ # Saga orchestration
│ ├── analytics-api/ # Analytics API
│ └── api-gateway/ # Spring Cloud Gateway
├── ui-vite/ # React Dashboard
│ ├── public/
│ └── src/
│ ├── components/ # Reusable UI components
│ ├── pages/ # Page-level components
│ ├── services/ # API clients
│ └── utils/ # Helper functions
├── docs/ # Documentation
└── dataflow/ # Dataflow pipelines
- GCP Account with billing enabled
- Terraform >= 1.6.0
- kubectl >= 1.28.0
- gcloud CLI >= 450.0.0
- Docker >= 24.0.0
- Node.js >= 18.0.0 (for React UI)
- dbt >= 1.7.0
# Set environment variables
export PROJECT_ID="order-analytics-platform"
export REGION="asia-south1"
export ENV="dev"
# Authenticate with GCP
gcloud auth login
gcloud config set project $PROJECT_ID
# Enable required APIs
gcloud services enable \
compute.googleapis.com \
container.googleapis.com \
bigquery.googleapis.com \
composer.googleapis.com \
pubsub.googleapis.com \
storage-api.googleapis.com \
dataflow.googleapis.comcd terraform
# Initialize Terraform
terraform init
# Plan infrastructure changes
terraform plan -var-file=environments/$ENV/terraform.tfvars
# Deploy infrastructure
terraform apply -var-file=environments/$ENV/terraform.tfvarsThis creates:
- Cloud Run services for all microservices (or GKE cluster if preferred)
- BigQuery datasets (raw, staging, prod)
- GCS buckets (data lake with bronze/silver/gold layers)
- Cloud Composer environment (Airflow)
- Cloud SQL PostgreSQL instance
- Pub/Sub topics for CDC
- VPC network with private subnets
- Service accounts with IAM roles
# Deploy all services
bash scripts/deploy-cloud-run.sh dev
# Or deploy individual services
gcloud run deploy order-service-dev \
--image=gcr.io/$PROJECT_ID/order-service:latest \
--region=$REGION \
--allow-unauthenticated \
--port=8081Alternative: Deploy to GKE (if using Kubernetes)
# Get GKE credentials
gcloud container clusters get-credentials order-platform-$ENV --region=$REGION
# Apply Kubernetes manifests (if using GKE)
kubectl apply -f kubernetes/base/
# Verify deployment
kubectl get pods -n order-systemcd dbt
# Install dbt dependencies
pip install dbt-bigquery
# Configure dbt profile
cat > ~/.dbt/profiles.yml <<EOF
order_analytics:
target: $ENV
outputs:
dev:
type: bigquery
method: service-account
project: $PROJECT_ID
dataset: staging_dev
keyfile: /path/to/service-account.json
location: $REGION
threads: 4
EOF
# Run dbt models
dbt run --target=$ENV
# Run dbt tests
dbt test --target=$ENVcd airflow
# Upload DAGs to Cloud Composer
gcloud composer environments storage dags import \
--environment=order-data-pipeline-$ENV \
--location=$REGION \
--source=dags/
# Trigger DAG manually
gcloud composer environments run order-data-pipeline-$ENV \
--location=$REGION \
dags trigger -- daily_etl_pipelinecd ui
# Install dependencies
npm install
# Configure environment
cat > .env.local <<EOF
REACT_APP_API_URL=http://localhost:8080
REACT_APP_BIGQUERY_PROJECT=$PROJECT_ID
REACT_APP_ENV=$ENV
EOF
# Start development server
npm start
# Build for production
npm run buildAccess UI at: http://localhost:3000
Order API → PostgreSQL → Debezium → Kafka → BigQuery Sink → BigQuery (raw)
↓ ↓
Kafka Streams Pub/Sub → Dataflow → BigQuery
BigQuery (raw) → dbt Staging → dbt Marts → BigQuery (prod)
↓
Data Quality Tests (Great Expectations)
↓
Airflow DAG Orchestration
React UI → API Gateway → BigQuery REST API → BigQuery (prod tables)
↓
Cache Layer (Redis)
- ✅ Modular design with reusable components
- ✅ Environment separation (dev/staging/prod)
- ✅ Remote state management in GCS
- ✅ Automated CI/CD with GitHub Actions
- ✅ Medallion architecture (bronze/silver/gold)
- ✅ Partitioning by date for query optimization
- ✅ Clustering on high-cardinality columns
- ✅ Materialized views for fast aggregations
- ✅ Dimensional modeling (star schema)
- ✅ Incremental models for efficiency
- ✅ Staging → Marts → Aggregates pipeline
- ✅ Built-in data quality tests
- ✅ Macros for reusable SQL logic
- ✅ Documentation generation
- ✅ DAG-based workflow management
- ✅ SLA monitoring and alerting
- ✅ Retry logic with exponential backoff
- ✅ Integration with dbt, BigQuery, Dataflow
- ✅ Custom operators for business logic
- ✅ Kafka for event streaming
- ✅ Debezium CDC from PostgreSQL
- ✅ Kafka Streams for aggregations
- ✅ Sub-second latency for critical events
- ✅ Spring Boot WebFlux (reactive)
- ✅ Circuit Breaker pattern (Resilience4j)
- ✅ Saga pattern for distributed transactions
- ✅ Auto-scaling (Cloud Run scales to zero)
- ✅ Serverless or Kubernetes deployment options
- ✅ Real-time metrics visualization
- ✅ Interactive charts (Recharts, D3.js)
- ✅ Order management interface
- ✅ Data quality monitoring
- ✅ Pipeline observability
- Prometheus for metrics collection
- Grafana for dashboards
- Custom metrics for pipeline health
- Cloud Logging for centralized logs
- Log aggregation from Kubernetes pods
- Airflow task logs
- Jaeger for distributed tracing
- OpenTelemetry instrumentation
- End-to-end request tracking
- SLA violations in Airflow
- Data quality test failures
- Pipeline lag monitoring
- Resource utilization alerts
| Metric | Target | Actual |
|---|---|---|
| Order API Latency (P95) | < 100ms | 73ms |
| BigQuery Query Latency | < 5s | 2.3s |
| dbt Full Refresh Time | < 30 min | 18 min |
| Kafka → BigQuery Lag | < 10s | 6s |
| Dashboard Load Time | < 2s | 1.4s |
| Daily Pipeline SLA | 2 hours | 1.5 hours |
# Start local services with Docker Compose
docker-compose up -d
# Run dbt models locally
dbt run --target=dev
# Start React UI
cd ui && npm start# Run unit tests
mvn test # Java services
pytest # Python code
npm test # React UI
# Run dbt tests
dbt test
# Run integration tests
./scripts/integration-tests.sh# Deploy infrastructure changes
cd terraform && terraform apply
# Deploy Kubernetes changes
kubectl apply -k kubernetes/overlays/$ENV
# Deploy dbt changes
dbt run --target=$ENV
# Deploy Airflow DAGs
./scripts/deploy-airflow-dags.sh- Workload Identity for GKE → GCP service authentication
- Private GKE cluster with authorized networks
- Cloud Armor for DDoS protection
- Secret Manager for sensitive credentials
- IAM roles with least privilege principle
- VPC Service Controls for data exfiltration prevention
- Encryption at rest for all data stores
- Architecture Deep Dive
- Terraform Modules
- dbt Models
- Airflow DAGs
- API Documentation
- Troubleshooting Guide
- Data Engineering: ETL/ELT pipelines, dbt models
- Platform Engineering: Terraform, Kubernetes, CI/CD
- Backend Engineering: Microservices, APIs
- Frontend Engineering: React dashboard
- Data Analytics: SQL queries, dashboards
- reactive-order-processing - Original transactional system
- gcp-data-pipeline - GCP data pipeline templates