# golrol/pokedex architecture

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

- Interactive diagram: https://gitdiagram.com/golrol/pokedex
- Repository: https://github.com/golrol/pokedex

## Overview

##### Project type and purpose
- This is a lightweight full-stack web application (“Pokedex”) built with Node.js and Express that serves static HTML/CSS/JS pages and JSON-based data about Pokémon.
- Purpose: Allow users to browse all Pokémon, view details of a specific Pokémon, and see “most viewed” statistics using a simple file-based data store.

##### File structure
- Top level
- server.js – the Express HTTP server entry point
- package.json / package-lock.json – node dependencies (Express, etc.) and scripts
- README.md – project overview and run instructions
- data/ – file-based data store and assets
- pokemon-data/pokemons.json – core JSON data
- pokemon-data/images/ – Pokémon images
- scripts/helperFuncs.js – shared JS logic (e.g., view-count logic)
- styles/*.css – styling for pages
- pages/ – static HTML templates
- index.html – homepage
- allPokemons.html – list view
- specificPokemon.html – detail view
- No external databases or third-party services

##### README for additional insights
- Running instructions emphasize npm start ⇒ server.js listens on port 3000
- Screenshots suggest three main UI states: homepage, list, detail

##### Essential details
- Filename(s) used by each component (e.g. pokemons.json, index.html)
- Both dynamic operations (template rendering) and static asset serving

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Client Tier
    Browser["Web Browser"]:::browser

    %% Application Tier - Project Root
    subgraph "Project Root"
        direction TB
        ServerNode["Express Server\n(Node.js)\nPort 3000"]:::server
        PackageJSON["package.json"]:::config
        PackageLock["package-lock.json"]:::config
        Readme["README.md"]:::config
        Gitignore[".gitignore"]:::config
    end

    %% Data & Assets Tier
    subgraph "Data & Assets"
        direction TB
        subgraph "JSON Data"
            direction TB
            JSONData["pokemons.json"]:::data
        end
        subgraph Images["Images"]
            direction TB
            ImagesDir["/data/pokemon-data/images"]:::data
        end
        subgraph Styles["CSS Styles"]
            direction TB
            StyleIndex["index_style.css"]:::data
            StyleList["pokemons_style.css"]:::data
        end
        subgraph Scripts["Client JS"]
            direction TB
            Helper["helperFuncs.js"]:::data
        end
        subgraph "HTML Templates"
            direction TB
            HomePage["index.html"]:::data
            ListPage["allPokemons.html"]:::data
            DetailPage["specificPokemon.html"]:::data
        end
    end

    %% Interactions
    Browser -->|"HTTP GET /\n, /all, /pokemon/:id"| ServerNode
    ServerNode -->|"read JSON\n(fs.readFile)"| JSONData
    ServerNode -->|"read Templates"| HomePage
    ServerNode -->|"read Templates"| ListPage
    ServerNode -->|"read Templates"| DetailPage
    ServerNode -->|"serve Images"| ImagesDir
    ServerNode -->|"serve CSS"| StyleIndex
    ServerNode -->|"serve CSS"| StyleList
    ServerNode -->|"serve JS"| Helper
    ServerNode -->|"HTTP Response\n(HTML with assets)"| Browser
    Browser -->|"load CSS"| StyleIndex
    Browser -->|"load CSS"| StyleList
    Browser -->|"load JS"| Helper
    Browser -->|"render Images"| ImagesDir

    %% Version control files click
    click ServerNode "https://github.com/golrol/pokedex/blob/main/server.js"
    click PackageJSON "https://github.com/golrol/pokedex/blob/main/package.json"
    click PackageLock "https://github.com/golrol/pokedex/blob/main/package-lock.json"
    click Readme "https://github.com/golrol/pokedex/blob/main/README.md"
    click Gitignore "https://github.com/golrol/pokedex/blob/main/.gitignore"

    %% Data & Assets click
    click JSONData "https://github.com/golrol/pokedex/blob/main/data/pokemon-data/pokemons.json"
    click ImagesDir "https://github.com/golrol/pokedex/tree/main/data/pokemon-data/images"
    click StyleIndex "https://github.com/golrol/pokedex/blob/main/data/styles/index_style.css"
    click StyleList "https://github.com/golrol/pokedex/blob/main/data/styles/pokemons_style.css"
    click Helper "https://github.com/golrol/pokedex/blob/main/data/scripts/helperFuncs.js"
    click HomePage "https://github.com/golrol/pokedex/blob/main/pages/index.html"
    click ListPage "https://github.com/golrol/pokedex/blob/main/pages/allPokemons.html"
    click DetailPage "https://github.com/golrol/pokedex/blob/main/pages/specificPokemon.html"

    %% Styles
    classDef browser fill:#AED6F1,stroke:#1B4F72,color:#000
    classDef server fill:#ABEBC6,stroke:#145A32,color:#000
    classDef data fill:#F9E79F,stroke:#7D6608,color:#000
    classDef config fill:#D6EAF8,stroke:#1A5276,color:#000
```
