# d-rehoune/ecommerce-analytics-platform architecture

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

- Interactive diagram: https://gitdiagram.com/d-rehoune/ecommerce-analytics-platform
- Repository: https://github.com/d-rehoune/ecommerce-analytics-platform

## Overview

This dbt project transforms e-commerce sales, Google Sheets mapping, and GA4 event data into reporting models. The documented workflow is raw sources → staging → intermediate models → mart; the main result is a daily order report by customer state and account manager. The graph preserves the documented staging and intermediate model families. Source excerpts were unavailable, so model-to-model dependencies are shown only at the documented layer level, not guessed individually.

Main entry points: [`models/intermediate`](https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/intermediate) (Intermediate Layer), [`models/staging`](https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/staging) (Staging Layer), [`models/staging/sales_database`](https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/staging/sales_database) (Sales Staging), [`models/staging/google_sheets/stg_google_sheets__account_manager_region_mapping.sql`](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/staging/google_sheets/stg_google_sheets__account_manager_region_mapping.sql) (Account Mapping)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sources["Data Sources"]
  node_sales_raw[("Sales Database")]
  node_sheets_raw[("Google Sheets")]
  node_ga_raw[("GA4 Events")]
end

subgraph group_staging["Staging Models"]
  node_sales_staging["Sales Staging"]
  node_sheets_staging["Account Mapping"]
  node_ga_staging["Flattened Events"]
  node_staging_layer["Staging Layer"]
end

subgraph group_intermediate["Intermediate Models"]
  node_int_order["Enriched Orders"]
  node_int_order_item["Order Items"]
  node_int_user["User Aggregates"]
  node_int_favorite["Favorite Products"]
  node_int_session["GA Sessions"]
  node_intermediate_layer["Intermediate Layer"]
end

subgraph group_mart["Reporting Mart"]
  node_daily_report["Daily Order Report"]
end

node_sales_raw -->|"stages tables"| node_sales_staging
node_sheets_raw -->|"stages mapping"| node_sheets_staging
node_ga_raw -->|"flattens events"| node_ga_staging
node_sales_staging -->|"joins layer"| node_staging_layer
node_sheets_staging -->|"joins layer"| node_staging_layer
node_ga_staging -->|"joins layer"| node_staging_layer
node_staging_layer -->|"feeds layer"| node_intermediate_layer
node_intermediate_layer -->|"builds models"| node_int_order
node_intermediate_layer -->|"builds models"| node_int_order_item
node_intermediate_layer -->|"builds models"| node_int_user
node_intermediate_layer -->|"builds models"| node_int_favorite
node_intermediate_layer -->|"builds models"| node_int_session
node_intermediate_layer -->|"feeds mart"| node_daily_report

click node_sales_staging "https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/staging/sales_database"
click node_sheets_staging "https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/staging/google_sheets/stg_google_sheets__account_manager_region_mapping.sql"
click node_ga_staging "https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/staging/google_analytics/stg_google_analytics__event_flattened.sql"
click node_staging_layer "https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/staging"
click node_int_order "https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/sales_database/int_sales_database__order.sql"
click node_int_order_item "https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/sales_database/int_sales_database__order_item.sql"
click node_int_user "https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/sales_database/int_sales_database__user.sql"
click node_int_favorite "https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/sales_database/int_sales_database__user_favorite_product.sql"
click node_int_session "https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/google_analytics/int_google_analytics__session.sql"
click node_intermediate_layer "https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/intermediate"
click node_daily_report "https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/mart/mrt_order_daily_report.sql"

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_sales_raw,node_sheets_raw,node_ga_raw toneBlue
class node_sales_staging,node_sheets_staging,node_ga_staging,node_staging_layer toneAmber
class node_int_order,node_int_order_item,node_int_user,node_int_favorite,node_int_session,node_intermediate_layer toneMint
class node_daily_report toneRose
```

## Components

### Data Sources

- **Sales Database**
- **Google Sheets**
- **GA4 Events**

### Staging Models

- [Sales Staging](https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/staging/sales_database): `models/staging/sales_database`
- [Account Mapping](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/staging/google_sheets/stg_google_sheets__account_manager_region_mapping.sql): `models/staging/google_sheets/stg_google_sheets__account_manager_region_mapping.sql`
- [Flattened Events](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/staging/google_analytics/stg_google_analytics__event_flattened.sql): `models/staging/google_analytics/stg_google_analytics__event_flattened.sql`
- [Staging Layer](https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/staging): `models/staging`

### Intermediate Models

- [Enriched Orders](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/sales_database/int_sales_database__order.sql): `models/intermediate/sales_database/int_sales_database__order.sql`
- [Order Items](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/sales_database/int_sales_database__order_item.sql): `models/intermediate/sales_database/int_sales_database__order_item.sql`
- [User Aggregates](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/sales_database/int_sales_database__user.sql): `models/intermediate/sales_database/int_sales_database__user.sql`
- [Favorite Products](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/sales_database/int_sales_database__user_favorite_product.sql): `models/intermediate/sales_database/int_sales_database__user_favorite_product.sql`
- [GA Sessions](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/intermediate/google_analytics/int_google_analytics__session.sql): `models/intermediate/google_analytics/int_google_analytics__session.sql`
- [Intermediate Layer](https://github.com/d-rehoune/ecommerce-analytics-platform/tree/main/models/intermediate): `models/intermediate`

### Reporting Mart

- [Daily Order Report](https://github.com/d-rehoune/ecommerce-analytics-platform/blob/main/models/mart/mrt_order_daily_report.sql): `models/mart/mrt_order_daily_report.sql`

## Connections

- Sales Database → Sales Staging: stages tables (evidence: `README.md`)
- Google Sheets → Account Mapping: stages mapping (evidence: `README.md`)
- GA4 Events → Flattened Events: flattens events (evidence: `README.md`)
- Sales Staging → Staging Layer: joins layer (evidence: `README.md`)
- Account Mapping → Staging Layer: joins layer (evidence: `README.md`)
- Flattened Events → Staging Layer: joins layer (evidence: `README.md`)
- Staging Layer → Intermediate Layer: feeds layer (evidence: `README.md`)
- Intermediate Layer → Enriched Orders: builds models (evidence: `README.md`)
- Intermediate Layer → Order Items: builds models (evidence: `README.md`)
- Intermediate Layer → User Aggregates: builds models (evidence: `README.md`)
- Intermediate Layer → Favorite Products: builds models (evidence: `README.md`)
- Intermediate Layer → GA Sessions: builds models (evidence: `README.md`)
- Intermediate Layer → Daily Order Report: feeds mart (evidence: `README.md`)
