Skip to content

Entity Relation Diagram

Conceptual ERD across all Zwerfkei domains. This diagram represents the key entities and their relationships at a high level.

Conceptual model

This is a conceptual ERD intended to communicate domain structure and relationships. Implementation details (column names, data types, indexes) are documented in the codebase and database migrations.


Catalog & Price

erDiagram
    Category {
        int id
        string name
        int parent_id
    }
    Product {
        int id
        string sku
        string title
    }
    ProductVariant {
        int id
        int product_id
        string sku
    }
    ProductImage {
        int id
        int product_id
        string url
        int sort_order
    }
    AttributeGroup {
        int id
        string name
    }
    Attribute {
        int id
        int attribute_group_id
        string name
        string type
    }
    AttributeOption {
        int id
        int attribute_id
        string value
    }
    AttributeValue {
        int id
        int attribute_id
        int product_id
        int product_variant_id
        string value
    }
    Price {
        int id
        int product_variant_id
        decimal base_price
        decimal discount
        decimal tax_rate
        decimal shipping_uplift
    }

    Category ||--o{ Category : "parent"
    Category ||--o{ Product : "contains"
    Product ||--o{ ProductVariant : "has"
    Product ||--o{ ProductImage : "has"
    AttributeGroup ||--o{ Attribute : "contains"
    Attribute ||--o{ AttributeOption : "has options"
    Attribute ||--o{ AttributeValue : "has values"
    Product ||--o{ AttributeValue : "described by"
    ProductVariant ||--o{ AttributeValue : "described by"
    ProductVariant ||--|| Price : "priced by"

Customer, Wishlist & Compare

erDiagram
    Customer {
        int id
        string email
        string name
        int customer_group_id
    }
    CustomerGroup {
        int id
        string name
    }
    CustomerAddress {
        int id
        int customer_id
        string type
        string street
        string city
        string country
    }
    Wishlist {
        int id
        int customer_id
    }
    WishlistItem {
        int id
        int wishlist_id
        int product_variant_id
    }
    Compare {
        int id
        int customer_id
    }
    CompareItem {
        int id
        int compare_id
        int product_id
    }

    CustomerGroup ||--o{ Customer : "classifies"
    Customer ||--o{ CustomerAddress : "has"
    Customer ||--|| Wishlist : "owns"
    Wishlist ||--o{ WishlistItem : "contains"
    Customer ||--o| Compare : "has"
    Compare ||--o{ CompareItem : "contains"

Cart

erDiagram
    Cart {
        int id
        int customer_id
        string session_id
        int fulfilment_method_id
    }
    CartItem {
        int id
        int cart_id
        int product_variant_id
        int quantity
        decimal unit_price
    }
    FulfilmentMethod {
        int id
        string name
        string carrier
        string product_code
    }

    Cart ||--o{ CartItem : "contains"
    Cart ||--o| FulfilmentMethod : "selects"

Order

erDiagram
    Order {
        int id
        int customer_id
        string status
        decimal total
        datetime placed_at
    }
    OrderLine {
        int id
        int order_id
        int product_variant_id
        int quantity
        decimal unit_price
    }
    OrderTransaction {
        int id
        int order_id
        string payment_method
        string status
        string paynl_reference
    }
    OrderFulfilment {
        int id
        int order_id
        int fulfilment_method_id
        string track_trace_code
        string label_url
    }
    OrderDiscount {
        int id
        int order_id
        string code
        string type
        decimal value
    }
    OrderAddress {
        int id
        int order_id
        string type
        string street
        string city
        string country
    }

    Order ||--o{ OrderLine : "contains"
    Order ||--o{ OrderTransaction : "has"
    Order ||--|| OrderFulfilment : "fulfilled by"
    Order ||--o{ OrderDiscount : "has"
    Order ||--o{ OrderAddress : "has"

Fulfilment & Review

erDiagram
    FulfilmentMethod {
        int id
        string name
        string carrier
        string product_code
    }
    FulfilmentRule {
        int id
        int fulfilment_method_id
        string constraint_type
        string constraint_value
    }
    Shipment {
        int id
        int order_id
        string track_trace_code
        string label_url
        datetime created_at
    }
    Review {
        int id
        int product_id
        string author
        int rating
        string body
        datetime published_at
    }

    FulfilmentMethod ||--o{ FulfilmentRule : "constrained by"
    FulfilmentMethod ||--o{ Shipment : "used in"