# nozzlegear/shopifysharp architecture

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

- Interactive diagram: https://gitdiagram.com/nozzlegear/shopifysharp
- Repository: https://github.com/nozzlegear/shopifysharp

## Overview

##### Main Components

a. Core Library Components:
- Services Layer (Primary API interaction)
- Infrastructure Layer
- Entity Models
- Filters
- Utilities
- WebhookPayloads
- Extensions

b. Integration Components:
- Dependency Injection Extensions
- Experimental Features (F# Implementation)
- Testing Infrastructure

**┌─ Client Applications ─────────────────────────────────────┐**

- ShopifySharp Public Interface ──────────────────────────┤
- ┌─ Service Layer ─────────┐ ┌─ Authentication ─────────┐ │
- Product Service       │ │ - OAuth Utility          │ │
- Order Service        │ │ - Multipass Service      │ │
- Customer Service     │ │ - Access Scopes          │ │
- ┘ └────────────────────────────┘│
- Core Infrastructure ───────────────────────────────────┤
- ┌─ Request Handling ──────┐ ┌─ Rate Limiting ─────────┐ │
- Execution Policies    │ │ - Leaky Bucket         │ │
- Retry Mechanisms     │ │ - Request Queue        │ │
- ┘ └────────────────────────────┘│
- Data Layer ────────────────────────────────────────────┤
- ┌─ Entity Models ─────────┐ ┌─ Serialization ─────────┐ │
- Shop Objects         │ │ - JSON Handling         │ │
- API Resources       │ │ - GraphQL Parsing       │ │
- ┘ └────────────────────────────┘│
- ┘

##### Key Relationships

- How the execution policies interact with request handling
- Relationship between services and their corresponding entities
- Demonstrate how the dependency injection extensions integrate with the core library

##### Implementation Details

- Notes for version compatibility

##### Additional Notes

- A small section showing the experimental F# components
- Integration points with dependency injection
- Webhook handling infrastructure
- Testing infrastructure's relationship to components

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client["Client Applications"]
        App[Client Code]
    end

    subgraph Public["ShopifySharp Public Interface"]
        subgraph Services["Service Layer"]
            PS["Product Service"]:::service
            OS["Order Service"]:::service
            CS["Customer Service"]:::service
            WS["Webhook Service"]:::service
        end

        subgraph Auth["Authentication"]
            OAuth["OAuth Utility"]:::auth
            MP["Multipass Service"]:::auth
            AS["Access Scopes"]:::auth
        end
    end

    subgraph Core["Core Infrastructure"]
        subgraph RH["Request Handling"]
            EP["Execution Policies"]:::infra
            RM["Retry Mechanisms"]:::infra
        end

        subgraph RL["Rate Limiting"]
            LB["Leaky Bucket"]:::infra
            RQ["Request Queue"]:::infra
        end
    end

    subgraph Data["Data Layer"]
        subgraph Models["Entity Models"]
            Entities["Shop Objects & Resources"]:::data
        end

        subgraph Serial["Serialization"]
            JSON["JSON Handling"]:::data
            GQL["GraphQL Parsing"]:::data
        end
    end

    subgraph Integration["Integration Components"]
        DI["Dependency Injection"]:::integration
        EXP["Experimental F#"]:::integration
        Test["Testing Infrastructure"]:::integration
    end

    subgraph External["External Systems"]
        ShopifyAPI["Shopify API"]:::external
    end

    %% Relationships
    App --> Services
    Services --> Core
    Core --> Data
    Core --> ShopifyAPI
    Auth --> ShopifyAPI
    Services --> Auth
    Integration --> Services

    %% Click Events
    click PS "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Services/Product/ProductService.cs"
    click OS "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Services/Order/OrderService.cs"
    click CS "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Services/Customer/CustomerService.cs"
    click WS "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Services/Webhook/WebhookService.cs"
    click OAuth "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Utilities/ShopifyOauthUtility.cs"
    click MP "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Services/Multipass/MultipassService.cs"
    click AS "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Services/AccessScope/AccessScopeService.cs"
    click EP "https://github.com/nozzlegear/ShopifySharp/tree/master/ShopifySharp/Infrastructure/Policies"
    click LB "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Infrastructure/Policies/LeakyBucket/LeakyBucket.cs"
    click RQ "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp/Infrastructure/Policies/LeakyBucket/ContextAwareQueue.cs"
    click Entities "https://github.com/nozzlegear/ShopifySharp/tree/master/ShopifySharp/Entities"
    click Serial "https://github.com/nozzlegear/ShopifySharp/tree/master/ShopifySharp/Infrastructure/Serialization"
    click GQL "https://github.com/nozzlegear/ShopifySharp/tree/master/ShopifySharp/Services/Graph"
    click DI "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp.Extensions.DependencyInjection"
    click EXP "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp.Experimental"
    click Test "https://github.com/nozzlegear/ShopifySharp/blob/master/ShopifySharp.Tests"

    %% Styles
    classDef service fill:#3498db,stroke:#2980b9,color:white
    classDef auth fill:#9b59b6,stroke:#8e44ad,color:white
    classDef infra fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef integration fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1["Service Component"]:::service
        L2["Authentication Component"]:::auth
        L3["Infrastructure Component"]:::infra
        L4["Data Component"]:::data
        L5["Integration Component"]:::integration
        L6["External System"]:::external
    end
```
