# iancooper/pizzashop architecture

> Architecture diagram of the GitHub repository iancooper/pizzashop, 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/iancooper/pizzashop
- Repository: https://github.com/iancooper/pizzashop

## Overview

##### Main Components Identification

a) Service Components:
- StoreFront (API Gateway/Entry Point)
- PizzaShop (Core Business Logic)
- Courier (Delivery Service)
- AppHost (Application Host/Orchestrator)

b) Messaging Infrastructure:
- AsbGateway (Azure Service Bus Gateway)
- KafkaGateway (Kafka Gateway)

##### Component Relationships

- Client → StoreFront
- StoreFront → Message Brokers (through Gateway)
- Message Brokers → Core Services
- Core Services → Message Brokers (for status updates)
- Message Brokers → Courier Service

b) Message Flow for Key Operations:
- Order Placement Flow
- Kitchen Processing Flow
- Delivery Dispatch Flow

##### Specific Elements

a) Message Handlers:
- PlaceOrderHandler
- DeliveryJobHandler

b) Domain Models:
- Order
- Pizza
- DeliveryManifest
- Address

c) Services:
- KitchenService
- DispatchService

##### Technical Details

Annotations for:

- Message pump implementations (AsbMessagePump, KafkaMessagePump)
- Service configurations (reference appsettings.json)
- Message types and routing

##### Architectural Patterns to Highlight

Patterns:

- Message-driven architecture
- Microservices communication
- Event-driven design
- Service isolation

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        C[Client]
    end

    subgraph "Service Layer"
        SF["StoreFront API"]:::service
        click SF "https://github.com/iancooper/PizzaShop/tree/main/PizzaShop/StoreFront"
        
        subgraph "Core Services"
            PS["PizzaShop Core"]:::service
            click PS "https://github.com/iancooper/PizzaShop/tree/main/PizzaShop/PizzaShop"
            
            KS["Kitchen Service"]:::service
            click KS "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/PizzaShop/KitchenService.cs"
            
            DS["Dispatch Service"]:::service
            click DS "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/PizzaShop/DispatchService.cs"
        end
        
        CS["Courier Service"]:::service
        click CS "https://github.com/iancooper/PizzaShop/tree/main/PizzaShop/Courier"
        
        AH["App Host"]:::service
        click AH "https://github.com/iancooper/PizzaShop/tree/main/PizzaShop/AppHost"
    end

    subgraph "Message Handlers"
        POH["Place Order Handler"]:::handler
        click POH "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/PizzaShop/PlaceOrderHandler.cs"
        
        DJH["Delivery Job Handler"]:::handler
        click DJH "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/Courier/DeliveryJobHandler.cs"
    end

    subgraph "Domain Models"
        O["Order"]:::model
        click O "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/PizzaShop/Order.cs"
        
        P["Pizza"]:::model
        click P "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/PizzaShop/Pizza.cs"
        
        DM["Delivery Manifest"]:::model
        click DM "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/PizzaShop/DeliveryManifest.cs"
        
        A["Address"]:::model
        click A "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/PizzaShop/Address.cs"
    end

    subgraph "Message Infrastructure"
        ASB["Azure Service Bus Gateway"]:::messagebroker
        click ASB "https://github.com/iancooper/PizzaShop/tree/main/PizzaShop/AsbGateway"
        
        KF["Kafka Gateway"]:::messagebroker
        click KF "https://github.com/iancooper/PizzaShop/tree/main/PizzaShop/KafkaGateway"
        
        ASBP["ASB Message Pump"]:::messagepump
        click ASBP "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/AsbGateway/AsbMessagePump.cs"
        
        KFP["Kafka Message Pump"]:::messagepump
        click KFP "https://github.com/iancooper/PizzaShop/blob/main/PizzaShop/KafkaGateway/KafkaMessagePump.cs"
    end

    C --> SF
    SF --> ASB & KF
    ASB --> POH
    KF --> POH
    POH --> KS
    KS --> DS
    DS --> DM
    DM --> DJH
    DJH --> CS
    
    O --> POH
    P --> KS
    A --> DM

    ASBP --> ASB
    KFP --> KF

    classDef service fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef handler fill:#ffe6b3,stroke:#333,stroke-width:2px
    classDef model fill:#d9d9d9,stroke:#333,stroke-width:2px
    classDef messagebroker fill:#98fb98,stroke:#333,stroke-width:2px
    classDef messagepump fill:#ffd700,stroke:#333,stroke-width:2px

    subgraph Legend
        L1["Service"]:::service
        L2["Handler"]:::handler
        L3["Model"]:::model
        L4["Message Broker"]:::messagebroker
        L5["Message Pump"]:::messagepump
    end
```
