# sudheer-ranga/aliexpress-product-scraper architecture

> Architecture diagram of the GitHub repository sudheer-ranga/aliexpress-product-scraper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sudheer-ranga/aliexpress-product-scraper
- Repository: https://github.com/sudheer-ranga/aliexpress-product-scraper

## Overview

This package scrapes an AliExpress product page and returns normalized product JSON. The workflow starts with a caller invoking the public entry point, which launches a stealth-enabled browser, captures product API data, fetches optional description content and reviews, then builds the result with shipping and variant details. The README also documents product, store, rating, image, and price fields represented in the normalized result. Source excerpts show the main calls; external AliExpress API behavior is documented and implemented through response interception.

Main entry points: [`src/aliexpressProductScraper.js`](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/aliexpressProductScraper.js) (Page Scraper), [`src/transform.js`](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/transform.js) (Product JSON Builder), [`index.js`](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/index.js) (Scrape API), [`src/reviews.js`](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/reviews.js) (Review Fetcher)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Package Entry"]
  node_public_api["Scrape API<br/>[index.js]"]
end

subgraph group_scrape["Scraping and Enrichment"]
  node_scraper["Page Scraper"]
  node_api_parser["API Data Parser<br/>[parsers.js]"]
  node_description["Description Extraction"]
  node_review_fetcher["Review Fetcher<br/>[reviews.js]"]
end

subgraph group_normalize["Product Normalization"]
  node_product_builder["Product JSON Builder<br/>[transform.js]"]
  node_variant_mapper["Variant Mapper<br/>[variants.js]"]
  node_shipping_mapper["Shipping Mapper<br/>[shipping.js]"]
end

node_caller(("Package Caller"))
node_aliexpress["AliExpress"]
node_feedback_service["AliExpress Feedback"]

node_caller -->|"invokes"| node_public_api
node_public_api -->|"delegates to"| node_scraper
node_scraper -->|"navigates page"| node_aliexpress
node_aliexpress -->|"sends API response"| node_scraper
node_scraper -->|"parses response"| node_api_parser
node_scraper -->|"extracts description"| node_description
node_scraper -->|"fetches reviews"| node_review_fetcher
node_review_fetcher -->|"requests review pages"| node_feedback_service
node_scraper -->|"builds result"| node_product_builder
node_product_builder -->|"maps variants"| node_variant_mapper
node_product_builder -->|"maps shipping"| node_shipping_mapper

click node_public_api "https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/index.js"
click node_scraper "https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/aliexpressProductScraper.js"
click node_api_parser "https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/parsers.js"
click node_description "https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/aliexpressProductScraper.js"
click node_review_fetcher "https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/reviews.js"
click node_product_builder "https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/transform.js"
click node_variant_mapper "https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/variants.js"
click node_shipping_mapper "https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/shipping.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_public_api toneBlue
class node_scraper,node_api_parser,node_description,node_review_fetcher toneAmber
class node_product_builder,node_variant_mapper,node_shipping_mapper toneMint
class node_caller,node_aliexpress,node_feedback_service toneIndigo
```

## Components

### Package Entry

- [Scrape API](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/index.js): `index.js`

### Scraping and Enrichment

- [Page Scraper](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/aliexpressProductScraper.js): `src/aliexpressProductScraper.js`
- [API Data Parser](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/parsers.js): `src/parsers.js`
- [Description Extraction](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/aliexpressProductScraper.js): `src/aliexpressProductScraper.js`
- [Review Fetcher](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/reviews.js): `src/reviews.js`

### Product Normalization

- [Product JSON Builder](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/transform.js): `src/transform.js`
- [Variant Mapper](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/variants.js): `src/variants.js`
- [Shipping Mapper](https://github.com/sudheer-ranga/aliexpress-product-scraper/blob/master/src/shipping.js): `src/shipping.js`

### Other components

- **Package Caller**
- **AliExpress**
- **AliExpress Feedback**

## Connections

- Package Caller → Scrape API: invokes (evidence: `README.md`)
- Scrape API → Page Scraper: delegates to (evidence: `index.js`)
- Page Scraper → AliExpress: navigates page (evidence: `src/aliexpressProductScraper.js`)
- AliExpress → Page Scraper: sends API response (evidence: `src/aliexpressProductScraper.js`)
- Page Scraper → API Data Parser: parses response (evidence: `src/aliexpressProductScraper.js`)
- Page Scraper → Description Extraction: extracts description (evidence: `src/aliexpressProductScraper.js`)
- Page Scraper → Review Fetcher: fetches reviews (evidence: `src/aliexpressProductScraper.js`)
- Review Fetcher → AliExpress Feedback: requests review pages (evidence: `src/reviews.js`)
- Page Scraper → Product JSON Builder: builds result (evidence: `src/aliexpressProductScraper.js`)
- Product JSON Builder → Variant Mapper: maps variants (evidence: `src/transform.js`)
- Product JSON Builder → Shipping Mapper: maps shipping (evidence: `src/transform.js`)
