# dbt-labs/jaffle-shop-classic architecture

> Architecture diagram of the GitHub repository dbt-labs/jaffle-shop-classic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dbt-labs/jaffle-shop-classic
- Repository: https://github.com/dbt-labs/jaffle-shop-classic

## Overview

##### Main Components

a) Data Sources Layer:
- Raw Data Files (Seeds)
- raw_customers.csv
- raw_orders.csv
- raw_payments.csv

b) Staging Layer:
- stg_customers
- stg_orders
- stg_payments

c) Core Transformation Layer:
- customers (final model)
- orders (final model)

##### Key Elements to Highlight

a) Configuration Components:
- dbt_project.yml (project configuration)
- schema.yml files (model specifications)
- Documentation files (docs.md, overview.md)

b) Data Flow:
- How raw data is loaded via dbt seed
- Transformations from staging to final models
- Testing and documentation generation flows

##### Specific Implementation Details

**[Data Sources]**

- ▼
**[Staging Layer]**

- ▼
**[Core Models]**

- ▼
**[Documentation & Testing]**

Relationships:
- raw_customers.csv → stg_customers.sql → customers.sql
- raw_orders.csv → stg_orders.sql → orders.sql
- raw_payments.csv → stg_payments.sql → orders.sql

##### Technical Details to Note

- How the dbt project structure enforces modularity
- Where tests are defined (schema.yml files)
- Documentation generation flow
- Reference to the target data warehouse

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Sources
        RC[raw_customers.csv]:::source
        RO[raw_orders.csv]:::source
        RP[raw_payments.csv]:::source
    end

    subgraph Staging
        SC[stg_customers.sql]:::staging
        SO[stg_orders.sql]:::staging
        SP[stg_payments.sql]:::staging
    end

    subgraph Core
        C[customers.sql]:::core
        O[orders.sql]:::core
    end

    subgraph Config
        PC[dbt_project.yml]:::config
        CS["/models/schema.yml"]:::config
        SS["/models/staging/schema.yml"]:::config
    end

    subgraph Docs
        D[docs.md]:::docs
        OV[overview.md]:::docs
        ERD[dbdiagram_definition.txt]:::docs
    end

    RC --> SC
    RO --> SO
    RP --> SP

    SC --> C
    SO --> O
    SP --> O

    PC -.-> SC & SO & SP & C & O
    CS -.-> C & O
    SS -.-> SC & SO & SP
    
    D -.-> C & O
    OV -.-> C & O
    ERD -.-> C & O

    %% Click events for file navigation
    click RC "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/seeds/raw_customers.csv"
    click RO "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/seeds/raw_orders.csv"
    click RP "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/seeds/raw_payments.csv"
    click SC "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/staging/stg_customers.sql"
    click SO "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/staging/stg_orders.sql"
    click SP "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/staging/stg_payments.sql"
    click C "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/customers.sql"
    click O "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/orders.sql"
    click PC "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/dbt_project.yml"
    click CS "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/schema.yml"
    click SS "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/staging/schema.yml"
    click D "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/docs.md"
    click OV "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/models/overview.md"
    click ERD "https://github.com/dbt-labs/jaffle-shop-classic/blob/main/etc/dbdiagram_definition.txt"

    %% Styling
    classDef source fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef staging fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef core fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef config fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef docs fill:#FFE4B5,stroke:#333,stroke-width:2px;

    %% Legend
    subgraph Legend
        L1[Raw Data Sources]:::source
        L2[Staging Models]:::staging
        L3[Core Models]:::core
        L4[Configuration]:::config
        L5[Documentation]:::docs
        L6[" "]
        L7["→ Direct Transformation"]
        L8["-.-> Configuration/Documentation Link"]
    end
```
