# drawrowfly/amazon-product-api architecture

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

- Interactive diagram: https://gitdiagram.com/drawrowfly/amazon-product-api
- Repository: https://github.com/drawrowfly/amazon-product-api

## Overview

Amazon Buddy is an unofficial Amazon data scraper, exposed as both a Node.js module and a command-line tool. Users request product search, ASIN details, reviews, categories, or marketplace information; the library normalizes options and dispatches scraping work to the scraper, which extracts Amazon data. Results may be returned directly or saved as JSON/CSV. The sampled code shows the entry-point dispatch and scraper’s parsing responsibilities; detailed request, filtering, and file-writing flows are only partially visible, so those relationships are not expanded.

Main entry points: [`lib/Amazon.js`](https://github.com/drawrowfly/amazon-product-api/blob/master/lib/Amazon.js) (Scraper engine), [`lib/index.js`](https://github.com/drawrowfly/amazon-product-api/blob/master/lib/index.js) (Scraper API), [`bin/cli.js`](https://github.com/drawrowfly/amazon-product-api/blob/master/bin/cli.js) (CLI commands), [`lib/constant.js`](https://github.com/drawrowfly/amazon-product-api/blob/master/lib/constant.js) (Marketplace data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI commands<br/>[cli.js]"]
  node_api["Scraper API<br/>[index.js]"]
end

subgraph group_scraping["Scraping and extraction"]
  node_engine["Scraper engine<br/>[Amazon.js]"]
  node_export["JSON/CSV output<br/>[Amazon.js]"]
end

subgraph group_configuration["Marketplace configuration"]
  node_marketplaces["Marketplace data<br/>[constant.js]"]
end

node_user(("User"))
node_amazon["Amazon marketplaces"]

node_user -->|"runs commands"| node_cli
node_user -->|"calls methods"| node_api
node_cli -->|"dispatches commands"| node_api
node_api -->|"starts scraper"| node_engine
node_api -->|"selects locale"| node_marketplaces
node_engine -->|"uses locale data"| node_marketplaces
node_engine -.->|"requests product data"| node_amazon
node_engine -.->|"saves results"| node_export

click node_cli "https://github.com/drawrowfly/amazon-product-api/blob/master/bin/cli.js"
click node_api "https://github.com/drawrowfly/amazon-product-api/blob/master/lib/index.js"
click node_engine "https://github.com/drawrowfly/amazon-product-api/blob/master/lib/Amazon.js"
click node_export "https://github.com/drawrowfly/amazon-product-api/blob/master/lib/Amazon.js"
click node_marketplaces "https://github.com/drawrowfly/amazon-product-api/blob/master/lib/constant.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_cli,node_api,node_user toneBlue
class node_engine,node_export toneAmber
class node_marketplaces toneMint
class node_amazon toneIndigo
```

## Components

### User interfaces

- [CLI commands](https://github.com/drawrowfly/amazon-product-api/blob/master/bin/cli.js): `bin/cli.js`
- [Scraper API](https://github.com/drawrowfly/amazon-product-api/blob/master/lib/index.js): `lib/index.js`

### Scraping and extraction

- [Scraper engine](https://github.com/drawrowfly/amazon-product-api/blob/master/lib/Amazon.js): `lib/Amazon.js`
- [JSON/CSV output](https://github.com/drawrowfly/amazon-product-api/blob/master/lib/Amazon.js): `lib/Amazon.js`

### Marketplace configuration

- [Marketplace data](https://github.com/drawrowfly/amazon-product-api/blob/master/lib/constant.js): `lib/constant.js`

### Other components

- **User**
- **Amazon marketplaces**

## Connections

- User → CLI commands: runs commands (evidence: `README.md`)
- User → Scraper API: calls methods (evidence: `README.md`)
- CLI commands → Scraper API: dispatches commands (evidence: `bin/cli.js`)
- Scraper API → Scraper engine: starts scraper (evidence: `lib/index.js`)
- Scraper API → Marketplace data: selects locale (evidence: `lib/index.js`)
- Scraper engine → Marketplace data: uses locale data (evidence: `lib/Amazon.js`)
- Scraper engine → Amazon marketplaces: requests product data
- Scraper engine → JSON/CSV output: saves results (evidence: `lib/Amazon.js`)
