# fasterflash/realtime_ecommerce_observability_platform architecture

> Architecture diagram of the GitHub repository fasterflash/realtime_ecommerce_observability_platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fasterflash/realtime_ecommerce_observability_platform
- Repository: https://github.com/fasterflash/realtime_ecommerce_observability_platform

## Overview

This repository implements a simulated e-commerce observability platform. Its central workflow generates probabilistic customer-session events, streams and validates them, stores raw and structured data, and refreshes analytical KPIs. Dashboards expose business, operational, and recovery views; anomaly detection and DLQ replay handle incidents and failed events, while Airflow automates alerts and reports. The graph follows README-documented data flows and the sampled producer/anomaly calls. Several consumer, recovery, and dashboard implementations were not sampled, so their internal call relationships are not expanded.

Main entry points: [`consumers/raw_event_consumer.py`](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/raw_event_consumer.py) (Event validation), [`consumers/silver_session_consumer.py`](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/silver_session_consumer.py) (Silver processing), [`observability/anomaly_engine_v2.py`](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/observability/anomaly_engine_v2.py) (Anomaly scoring), [`dashboard_v2/intelligence/analysis_engine.py`](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/dashboard_v2/intelligence/analysis_engine.py) (AI analytics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation and Ingestion"]
  node_producer["Session simulator<br/>[session.py]"]
  node_producer_main["Traffic runner<br/>[main.py]"]
  node_kafka["Kafka topics"]
  node_validator["Event validation"]
  node_dlq["Dead-letter handling<br/>[dlq_consumer.py]"]
end

subgraph group_data["Storage and Analytics"]
  node_minio[("Raw archive")]
  node_silver["Silver processing"]
  node_gold["Gold KPI refresh"]
  node_platform_kpis["Platform KPI refresh"]
  node_postgres[("PostgreSQL warehouse")]
end

subgraph group_operations["Detection and Operations"]
  node_anomaly_engine["Anomaly scoring"]
  node_anomaly_features["Anomaly features"]
  node_incident_store[("Incident state<br/>[incident_store.py]")]
end

subgraph group_interfaces["Dashboards and Recovery"]
  node_business_dashboard["Business dashboard<br/>[app.py]"]
  node_ops_dashboard["Operations dashboard<br/>[app_ops.py]"]
  node_ai_analytics["AI analytics<br/>[analysis_engine.py]"]
  node_recovery_dashboard["Recovery dashboard"]
  node_replay["Replay workflow<br/>[replay_worker.py]"]
end

subgraph group_automation["Automation and Monitoring"]
  node_airflow["Scheduled reports"]
  node_logs["Pipeline logging<br/>[platform_logger.py]"]
  node_monitoring["Infrastructure monitoring"]
end

node_operator(("Platform user"))
node_gemini["Gemini API"]

node_operator -.->|"starts simulation"| node_producer_main
node_producer_main -->|"runs sessions"| node_producer
node_producer -->|"streams events"| node_kafka
node_kafka -->|"consumes events"| node_validator
node_validator -->|"routes failures"| node_dlq
node_validator -->|"routes clean events"| node_silver
node_kafka -->|"archives raw events"| node_minio
node_silver -->|"writes validated data"| node_postgres
node_silver -->|"feeds aggregates"| node_gold
node_gold -->|"refreshes KPI tables"| node_postgres
node_platform_kpis -->|"refreshes platform KPIs"| node_postgres
node_postgres -->|"supplies KPI snapshots"| node_anomaly_engine
node_anomaly_engine -->|"gets features"| node_anomaly_features
node_anomaly_engine -->|"creates or resolves"| node_incident_store
node_postgres -->|"serves analytics"| node_business_dashboard
node_postgres -->|"serves operational views"| node_ops_dashboard
node_incident_store -->|"supplies incidents"| node_ops_dashboard
node_business_dashboard -->|"offers AI analysis"| node_ai_analytics
node_ai_analytics -->|"queries warehouse"| node_postgres
node_ai_analytics -->|"requests interpretation"| node_gemini
node_operator -->|"reviews failures"| node_recovery_dashboard
node_recovery_dashboard -->|"initiates replay"| node_replay
node_replay -->|"publishes corrected events"| node_kafka
node_airflow -->|"checks incidents"| node_incident_store
node_airflow -->|"checks pipeline logs"| node_logs
node_logs -->|"publishes log events"| node_kafka
node_monitoring -.->|"scrapes service metrics"| node_kafka

click node_producer "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/producer/session.py"
click node_producer_main "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/producer/main.py"
click node_validator "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/raw_event_consumer.py"
click node_dlq "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/dlq_consumer.py"
click node_silver "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/silver_session_consumer.py"
click node_gold "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/gold_kpi_consumer.py"
click node_platform_kpis "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/platform_kpi_materializer.py"
click node_anomaly_engine "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/observability/anomaly_engine_v2.py"
click node_anomaly_features "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/observability/anomaly_features.py"
click node_incident_store "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/observability/incident_store.py"
click node_business_dashboard "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/dashboard_v2/app.py"
click node_ops_dashboard "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/dashboard_ops/app_ops.py"
click node_ai_analytics "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/dashboard_v2/intelligence/analysis_engine.py"
click node_recovery_dashboard "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/replay/recovery_dashboard.py"
click node_replay "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/replay/replay_worker.py"
click node_airflow "https://github.com/fasterflash/realtime_ecommerce_observability_platform/tree/main/airflow/dags"
click node_logs "https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/logs/platform_logger.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_producer,node_producer_main,node_kafka,node_validator,node_dlq,node_operator toneBlue
class node_minio,node_silver,node_gold,node_platform_kpis,node_postgres toneAmber
class node_anomaly_engine,node_anomaly_features,node_incident_store,node_gemini toneMint
class node_business_dashboard,node_ops_dashboard,node_ai_analytics,node_recovery_dashboard,node_replay toneRose
class node_airflow,node_logs,node_monitoring toneIndigo
```

## Components

### Simulation and Ingestion

- [Session simulator](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/producer/session.py): `producer/session.py`
- [Traffic runner](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/producer/main.py): `producer/main.py`
- **Kafka topics**
- [Event validation](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/raw_event_consumer.py): `consumers/raw_event_consumer.py`
- [Dead-letter handling](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/dlq_consumer.py): `consumers/dlq_consumer.py`

### Storage and Analytics

- **Raw archive**
- [Silver processing](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/silver_session_consumer.py): `consumers/silver_session_consumer.py`
- [Gold KPI refresh](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/gold_kpi_consumer.py): `consumers/gold_kpi_consumer.py`
- [Platform KPI refresh](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/consumers/platform_kpi_materializer.py): `consumers/platform_kpi_materializer.py`
- **PostgreSQL warehouse**

### Detection and Operations

- [Anomaly scoring](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/observability/anomaly_engine_v2.py): `observability/anomaly_engine_v2.py`
- [Anomaly features](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/observability/anomaly_features.py): `observability/anomaly_features.py`
- [Incident state](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/observability/incident_store.py): `observability/incident_store.py`

### Dashboards and Recovery

- [Business dashboard](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/dashboard_v2/app.py): `dashboard_v2/app.py`
- [Operations dashboard](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/dashboard_ops/app_ops.py): `dashboard_ops/app_ops.py`
- [AI analytics](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/dashboard_v2/intelligence/analysis_engine.py): `dashboard_v2/intelligence/analysis_engine.py`
- [Recovery dashboard](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/replay/recovery_dashboard.py): `replay/recovery_dashboard.py`
- [Replay workflow](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/replay/replay_worker.py): `replay/replay_worker.py`

### Automation and Monitoring

- [Scheduled reports](https://github.com/fasterflash/realtime_ecommerce_observability_platform/tree/main/airflow/dags): `airflow/dags`
- [Pipeline logging](https://github.com/fasterflash/realtime_ecommerce_observability_platform/blob/main/logs/platform_logger.py): `logs/platform_logger.py`
- **Infrastructure monitoring**

### Other components

- **Platform user**
- **Gemini API**

## Connections

- Platform user → Traffic runner: starts simulation
- Traffic runner → Session simulator: runs sessions (evidence: `producer/main.py`)
- Session simulator → Kafka topics: streams events
- Kafka topics → Event validation: consumes events
- Event validation → Dead-letter handling: routes failures
- Event validation → Silver processing: routes clean events
- Kafka topics → Raw archive: archives raw events
- Silver processing → PostgreSQL warehouse: writes validated data
- Silver processing → Gold KPI refresh: feeds aggregates
- Gold KPI refresh → PostgreSQL warehouse: refreshes KPI tables
- Platform KPI refresh → PostgreSQL warehouse: refreshes platform KPIs
- PostgreSQL warehouse → Anomaly scoring: supplies KPI snapshots
- Anomaly scoring → Anomaly features: gets features (evidence: `observability/anomaly_engine_v2.py`)
- Anomaly scoring → Incident state: creates or resolves (evidence: `observability/anomaly_engine_v2.py`)
- PostgreSQL warehouse → Business dashboard: serves analytics
- PostgreSQL warehouse → Operations dashboard: serves operational views
- Incident state → Operations dashboard: supplies incidents
- Business dashboard → AI analytics: offers AI analysis
- AI analytics → PostgreSQL warehouse: queries warehouse (evidence: `dashboard_v2/intelligence/analysis_engine.py`)
- AI analytics → Gemini API: requests interpretation
- Platform user → Recovery dashboard: reviews failures
- Recovery dashboard → Replay workflow: initiates replay
- Replay workflow → Kafka topics: publishes corrected events
- Scheduled reports → Incident state: checks incidents
- Scheduled reports → Pipeline logging: checks pipeline logs
- Pipeline logging → Kafka topics: publishes log events (evidence: `logs/platform_logger.py`)
- Infrastructure monitoring → Kafka topics: scrapes service metrics
