# dmich98/pokemon-parser architecture

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

- Interactive diagram: https://gitdiagram.com/dmich98/pokemon-parser
- Repository: https://github.com/dmich98/pokemon-parser

## Overview

This is a Pokémon catalog scraper: it fetches catalog pages, extracts product URLs, fetches each product page, parses Pokémon fields, and can serialize records to CSV. The catalog and product scraping stages each own their HTTP and parser calls. The shared parsers use a Cheerio-backed base, while Pokémon field values are normalized into the Pokémon model. CSV storage is a separate capability. The available excerpts do not show how `main.ts` wires these components or invokes storage, so those links are omitted.

Main entry points: [`src/parsers/PokemonParser.ts`](https://github.com/dmich98/pokemon-parser/blob/main/src/parsers/PokemonParser.ts) (Pokémon parser), [`src/services/HttpClient.ts`](https://github.com/dmich98/pokemon-parser/blob/main/src/services/HttpClient.ts) (HTTP client), [`src/scrapers/CatalogScraper.ts`](https://github.com/dmich98/pokemon-parser/blob/main/src/scrapers/CatalogScraper.ts) (Catalog scraper), [`src/scrapers/PokemonScraper.ts`](https://github.com/dmich98/pokemon-parser/blob/main/src/scrapers/PokemonScraper.ts) (Pokémon scraper)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scraping["Scraping"]
  node_catalog_scraper["Catalog scraper<br/>[CatalogScraper.ts]"]
  node_pokemon_scraper["Pokémon scraper<br/>[PokemonScraper.ts]"]
end

subgraph group_parsing["Parsing"]
  node_catalog_parser["Catalog parser<br/>[CatalogParser.ts]"]
  node_pokemon_parser["Pokémon parser<br/>[PokemonParser.ts]"]
  node_base_parser["HTML parser base<br/>[BaseParser.ts]"]
end

subgraph group_domain["Domain and storage"]
  node_normalization["Value normalization<br/>[normalize.ts]"]
  node_pokemon_model["Pokémon record<br/>[Pokemon.ts]"]
  node_csv_storage["CSV storage<br/>[CsvStorage.ts]"]
end

subgraph group_transport["Transport"]
  node_http_client["HTTP client<br/>[HttpClient.ts]"]
end

node_main["Application entry<br/>[main.ts]"]
node_web(("Web server"))

node_catalog_scraper -->|"fetches pages"| node_http_client
node_catalog_scraper -->|"parses HTML"| node_catalog_parser
node_pokemon_scraper -->|"fetches products"| node_http_client
node_pokemon_scraper -->|"parses HTML"| node_pokemon_parser
node_catalog_parser -->|"extends"| node_base_parser
node_pokemon_parser -->|"extends"| node_base_parser
node_pokemon_parser -->|"normalizes fields"| node_normalization
node_pokemon_parser -->|"creates record"| node_pokemon_model
node_http_client -->|"requests pages"| node_web

click node_main "https://github.com/dmich98/pokemon-parser/blob/main/src/main.ts"
click node_catalog_scraper "https://github.com/dmich98/pokemon-parser/blob/main/src/scrapers/CatalogScraper.ts"
click node_pokemon_scraper "https://github.com/dmich98/pokemon-parser/blob/main/src/scrapers/PokemonScraper.ts"
click node_catalog_parser "https://github.com/dmich98/pokemon-parser/blob/main/src/parsers/CatalogParser.ts"
click node_pokemon_parser "https://github.com/dmich98/pokemon-parser/blob/main/src/parsers/PokemonParser.ts"
click node_base_parser "https://github.com/dmich98/pokemon-parser/blob/main/src/parsers/BaseParser.ts"
click node_normalization "https://github.com/dmich98/pokemon-parser/blob/main/src/utils/normalize.ts"
click node_pokemon_model "https://github.com/dmich98/pokemon-parser/blob/main/src/models/Pokemon.ts"
click node_csv_storage "https://github.com/dmich98/pokemon-parser/blob/main/src/storage/CsvStorage.ts"
click node_http_client "https://github.com/dmich98/pokemon-parser/blob/main/src/services/HttpClient.ts"

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_catalog_scraper,node_pokemon_scraper toneBlue
class node_catalog_parser,node_pokemon_parser,node_base_parser toneAmber
class node_normalization,node_pokemon_model,node_csv_storage,node_web toneMint
class node_http_client toneRose
class node_main toneTeal
```

## Components

### Scraping

- [Catalog scraper](https://github.com/dmich98/pokemon-parser/blob/main/src/scrapers/CatalogScraper.ts): `src/scrapers/CatalogScraper.ts`
- [Pokémon scraper](https://github.com/dmich98/pokemon-parser/blob/main/src/scrapers/PokemonScraper.ts): `src/scrapers/PokemonScraper.ts`

### Parsing

- [Catalog parser](https://github.com/dmich98/pokemon-parser/blob/main/src/parsers/CatalogParser.ts): `src/parsers/CatalogParser.ts`
- [Pokémon parser](https://github.com/dmich98/pokemon-parser/blob/main/src/parsers/PokemonParser.ts): `src/parsers/PokemonParser.ts`
- [HTML parser base](https://github.com/dmich98/pokemon-parser/blob/main/src/parsers/BaseParser.ts): `src/parsers/BaseParser.ts`

### Domain and storage

- [Value normalization](https://github.com/dmich98/pokemon-parser/blob/main/src/utils/normalize.ts): `src/utils/normalize.ts`
- [Pokémon record](https://github.com/dmich98/pokemon-parser/blob/main/src/models/Pokemon.ts): `src/models/Pokemon.ts`
- [CSV storage](https://github.com/dmich98/pokemon-parser/blob/main/src/storage/CsvStorage.ts): `src/storage/CsvStorage.ts`

### Transport

- [HTTP client](https://github.com/dmich98/pokemon-parser/blob/main/src/services/HttpClient.ts): `src/services/HttpClient.ts`

### Other components

- [Application entry](https://github.com/dmich98/pokemon-parser/blob/main/src/main.ts): `src/main.ts`
- **Web server**

## Connections

- Catalog scraper → HTTP client: fetches pages (evidence: `src/scrapers/CatalogScraper.ts`)
- Catalog scraper → Catalog parser: parses HTML (evidence: `src/scrapers/CatalogScraper.ts`)
- Pokémon scraper → HTTP client: fetches products (evidence: `src/scrapers/PokemonScraper.ts`)
- Pokémon scraper → Pokémon parser: parses HTML (evidence: `src/scrapers/PokemonScraper.ts`)
- Catalog parser → HTML parser base: extends (evidence: `src/parsers/CatalogParser.ts`)
- Pokémon parser → HTML parser base: extends (evidence: `src/parsers/PokemonParser.ts`)
- Pokémon parser → Value normalization: normalizes fields (evidence: `src/parsers/PokemonParser.ts`)
- Pokémon parser → Pokémon record: creates record (evidence: `src/parsers/PokemonParser.ts`)
- HTTP client → Web server: requests pages (evidence: `src/services/HttpClient.ts`)
