# thomasrush/amazonscrape architecture

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

- Interactive diagram: https://gitdiagram.com/thomasrush/amazonscrape
- Repository: https://github.com/thomasrush/amazonscrape

## Overview

##### Project type and purpose
- This is a standalone WPF desktop application written in C# (.NET).
- Its purpose is to scrape Amazon product data, apply search and validation logic, and display sortable results in a rich UI.

##### File structure
- Top-level artifacts:
- AmazonScrape.sln / .csproj – the Visual Studio solution and project file
- App.xaml / App.xaml.cs – application entry point and resource declarations
- Constants.cs – global constants used across the app
- README.md – high-level description
- “Model” folder: contains two subpackages:
- Logic – business-logic classes (SearchManager, Scraper, Parser, PageManager, ItemValidator)
- Structure – domain entities and data contracts (AmazonItem, Result, SearchCriteria, ScoreDistribution)
- “UI” folder: WPF presentation layer
- Controls – custom user controls (RangeSlider, DataGridPlus, ScoreDistributionControl, etc.)
- MainWindow.xaml / MainWindow.xaml.cs – main window and its code-behind
- Resources – styles, images, resource loader
- “UtilityClasses”: reusable helper classes for range types and converters
- Configuration files: App.config, packages.config, Properties/Settings

##### README for additional insights
- Confirms the project is “Amazon Product scraper” with search tools and sortable results
- No further architectural details are given, so we infer a 3-layer structure: Presentation (UI), Business Logic (Model/Logic), Data/Domain (Model/Structure), plus an external HTTP layer (Amazon).

##### Elements
- UI → Logic.SearchManager → Logic.Scraper → External Service
- Scraper → Parser → Domain.AmazonItem
- Parser → Domain.Result → UI

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "UI Layer"
        direction TB
        MainXAML["MainWindow.xaml"]:::frontend
        MainCode["MainWindow.xaml.cs"]:::frontend
        Controls["Controls/"]:::frontend
        Resources["Resources/"]:::frontend
    end

    %% Business Logic Layer
    subgraph "Logic Layer"
        direction TB
        SearchManager["SearchManager.cs"]:::logic
        PageManager["PageManager.cs"]:::logic
        Scraper["Scraper.cs"]:::logic
        Parser["Parser.cs"]:::logic
        ItemValidator["ItemValidator.cs"]:::logic
    end

    %% Domain/Data Layer
    subgraph "Domain Layer"
        direction TB
        AmazonItem["AmazonItem.cs"]:::domain
        SearchCriteria["SearchCriteria.cs"]:::domain
        IValidatable["IValidatable.cs"]:::domain
        ResultModel["Result.cs"]:::domain
        ScoreDistribution["ScoreDistribution.cs"]:::domain
    end

    %% Utility Layer
    subgraph "Utility Layer"
        direction TB
        UtilityClasses["UtilityClasses/"]:::utility
    end

    %% Configuration & Constants
    subgraph "Configuration"
        direction TB
        AppConfig["App.config"]:::config
        Constants["Constants.cs"]:::config
        PackagesConfig["packages.config"]:::config
        Properties["Properties/"]:::config
    end

    %% External Service
    Amazon["Amazon Web Pages"]:::external

    %% Connections
    MainXAML -->|"initiates search"| SearchManager
    MainCode -->|binds results| ResultModel
    Controls -->|used in UI binding| MainXAML
    Resources -->|styles/resources| MainXAML

    SearchManager -->|manages flow| PageManager
    PageManager -->|fetch pages| Scraper
    Scraper -->|HTTP requests| Amazon
    Scraper -->|provides HTML| Parser
    Parser -->|creates entities| AmazonItem
    Parser -->|creates results| ResultModel
    AmazonItem -->|validated by| ItemValidator
    ItemValidator -->|outputs| ResultModel
    ResultModel -->|displayed by| MainCode

    UtilityClasses -->|types/converters| SearchManager
    UtilityClasses -->|types/converters| MainXAML

    AppConfig -->|settings| Scraper
    AppConfig -->|settings| MainXAML
    Constants -->|global values| SearchManager
    Constants -->|global values| MainXAML
    PackagesConfig -->|dependencies| SearchManager
    Properties -->|resources/settings| MainXAML

    %% Click Events
    click MainXAML "https://github.com/thomasrush/amazonscrape/blob/master/UI/MainWindow.xaml"
    click MainCode "https://github.com/thomasrush/amazonscrape/blob/master/UI/MainWindow.xaml.cs"
    click Controls "https://github.com/thomasrush/amazonscrape/tree/master/UI/Controls/"
    click Resources "https://github.com/thomasrush/amazonscrape/tree/master/UI/Resources/"
    click SearchManager "https://github.com/thomasrush/amazonscrape/blob/master/Model/Logic/SearchManager.cs"
    click PageManager "https://github.com/thomasrush/amazonscrape/blob/master/Model/Logic/PageManager.cs"
    click Scraper "https://github.com/thomasrush/amazonscrape/blob/master/Model/Logic/Scraper.cs"
    click Parser "https://github.com/thomasrush/amazonscrape/blob/master/Model/Logic/Parser.cs"
    click ItemValidator "https://github.com/thomasrush/amazonscrape/blob/master/Model/Logic/ItemValidator.cs"
    click AmazonItem "https://github.com/thomasrush/amazonscrape/blob/master/Model/Structure/AmazonItem.cs"
    click SearchCriteria "https://github.com/thomasrush/amazonscrape/blob/master/Model/Structure/SearchCriteria.cs"
    click IValidatable "https://github.com/thomasrush/amazonscrape/blob/master/Model/Structure/IValidatable.cs"
    click ResultModel "https://github.com/thomasrush/amazonscrape/blob/master/Model/Structure/Result.cs"
    click ScoreDistribution "https://github.com/thomasrush/amazonscrape/blob/master/Model/Structure/ScoreDistribution.cs"
    click UtilityClasses "https://github.com/thomasrush/amazonscrape/tree/master/UtilityClasses/"
    click AppConfig "https://github.com/thomasrush/amazonscrape/blob/master/App.config"
    click Constants "https://github.com/thomasrush/amazonscrape/blob/master/Constants.cs"
    click PackagesConfig "https://github.com/thomasrush/amazonscrape/blob/master/packages.config"
    click Properties "https://github.com/thomasrush/amazonscrape/tree/master/Properties/"
    click Amazon "https://github.com/thomasrush/amazonscrape/blob/master/AmazonScrape.sln"
    click Amazon "https://github.com/thomasrush/amazonscrape/blob/master/AmazonScrape.csproj"

    %% Styles
    classDef frontend fill:#D0E6FF,stroke:#0366D6,color:#0366D6
    classDef logic fill:#E2F0D9,stroke:#4CAF50,color:#388E3C
    classDef domain fill:#FFF4E5,stroke:#FF9800,color:#E65100
    classDef utility fill:#F3E5F5,stroke:#9C27B0,color:#6A1B9A
    classDef config fill:#F5F5F5,stroke:#9E9E9E,color:#424242
    classDef external fill:#FFEBEE,stroke:#E53935,color:#B71C1C
```
