# ramzygirgis/pokedex architecture

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

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

## Overview

The Pokedex CLI accepts commands through a REPL, then lists and explores locations, attempts Pokémon catches, and lets users inspect or list caught Pokémon. The command handlers coordinate API requests, cached location and encounter data, and the in-memory Pokedex; the API client fetches and decodes PokeAPI responses. The README is only a title, so capability details come from the sampled source. The graph reflects those files and does not assume additional behavior.

Main entry points: [`repl.go`](https://github.com/ramzygirgis/pokedex/blob/main/repl.go) (REPL), [`commands.go`](https://github.com/ramzygirgis/pokedex/blob/main/commands.go) (Map commands), [`internal/pokeapi/client.go`](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/client.go) (HTTP client), [`internal/pokeapi/location_list.go`](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/location_list.go) (Location fetch)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_main["Startup<br/>[main.go]"]
  node_repl["REPL<br/>[repl.go]"]
  node_navigation["Map commands<br/>[commands.go]"]
  node_explore["Explore command<br/>[commands.go]"]
  node_catch["Catch command<br/>[commands.go]"]
  node_inspect["Inspect command<br/>[commands.go]"]
  node_pokedex["Pokedex command<br/>[commands.go]"]
end

subgraph group_api["PokeAPI access"]
  node_client["HTTP client<br/>[client.go]"]
  node_locations["Location fetch<br/>[location_list.go]"]
  node_location_listing["Location listing<br/>[location_list.go]"]
  node_encounters["Encounter fetch"]
  node_encounter_listing["Encounter listing"]
  node_pokemon_fetch["Pokémon fetch<br/>[get_pokemon.go]"]
  node_catch_probability["Catch probability<br/>[get_pokemon.go]"]
  node_pokemon_print["Pokémon display<br/>[get_pokemon.go]"]
end

subgraph group_state["Local state"]
  node_location_cache[("Location cache<br/>[type_cache.go]")]
  node_encounter_cache[("Encounter cache<br/>[type_cache.go]")]
  node_caught_data[("Caught Pokémon<br/>[repl.go]")]
end

node_user(("User"))
node_pokeapi["PokeAPI"]

node_main -->|"starts"| node_repl
node_user -->|"enters commands"| node_repl
node_repl -->|"dispatches map"| node_navigation
node_repl -->|"dispatches explore"| node_explore
node_repl -->|"dispatches catch"| node_catch
node_repl -->|"dispatches inspect"| node_inspect
node_repl -->|"dispatches list"| node_pokedex
node_navigation -->|"reads and writes"| node_location_cache
node_navigation -->|"fetches on miss"| node_locations
node_navigation -->|"lists results"| node_location_listing
node_explore -->|"reads and writes"| node_encounter_cache
node_explore -->|"fetches on miss"| node_encounters
node_explore -->|"prints encounters"| node_encounter_listing
node_catch -->|"fetches Pokémon"| node_pokemon_fetch
node_catch -->|"calculates odds"| node_catch_probability
node_catch -->|"stores caught"| node_caught_data
node_inspect -->|"reads caught"| node_caught_data
node_inspect -->|"prints details"| node_pokemon_print
node_pokedex -->|"lists caught"| node_caught_data
node_locations -->|"uses HTTP"| node_client
node_encounters -->|"uses HTTP"| node_client
node_pokemon_fetch -->|"uses HTTP"| node_client
node_client -->|"sends requests"| node_pokeapi

click node_main "https://github.com/ramzygirgis/pokedex/blob/main/main.go"
click node_repl "https://github.com/ramzygirgis/pokedex/blob/main/repl.go"
click node_navigation "https://github.com/ramzygirgis/pokedex/blob/main/commands.go"
click node_explore "https://github.com/ramzygirgis/pokedex/blob/main/commands.go"
click node_catch "https://github.com/ramzygirgis/pokedex/blob/main/commands.go"
click node_inspect "https://github.com/ramzygirgis/pokedex/blob/main/commands.go"
click node_pokedex "https://github.com/ramzygirgis/pokedex/blob/main/commands.go"
click node_client "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/client.go"
click node_locations "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/location_list.go"
click node_location_listing "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/location_list.go"
click node_encounters "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/explore_location.go"
click node_encounter_listing "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/explore_location.go"
click node_pokemon_fetch "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/get_pokemon.go"
click node_catch_probability "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/get_pokemon.go"
click node_pokemon_print "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/get_pokemon.go"
click node_location_cache "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokecache/type_cache.go"
click node_encounter_cache "https://github.com/ramzygirgis/pokedex/blob/main/internal/pokecache/type_cache.go"
click node_caught_data "https://github.com/ramzygirgis/pokedex/blob/main/repl.go"

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_main,node_repl,node_navigation,node_explore,node_catch,node_inspect,node_pokedex,node_user toneBlue
class node_client,node_locations,node_location_listing,node_encounters,node_encounter_listing,node_pokemon_fetch,node_catch_probability,node_pokemon_print toneAmber
class node_location_cache,node_encounter_cache,node_caught_data,node_pokeapi toneMint
```

## Components

### CLI workflow

- [Startup](https://github.com/ramzygirgis/pokedex/blob/main/main.go): `main.go`
- [REPL](https://github.com/ramzygirgis/pokedex/blob/main/repl.go): `repl.go`
- [Map commands](https://github.com/ramzygirgis/pokedex/blob/main/commands.go): `commands.go`
- [Explore command](https://github.com/ramzygirgis/pokedex/blob/main/commands.go): `commands.go`
- [Catch command](https://github.com/ramzygirgis/pokedex/blob/main/commands.go): `commands.go`
- [Inspect command](https://github.com/ramzygirgis/pokedex/blob/main/commands.go): `commands.go`
- [Pokedex command](https://github.com/ramzygirgis/pokedex/blob/main/commands.go): `commands.go`

### PokeAPI access

- [HTTP client](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/client.go): `internal/pokeapi/client.go`
- [Location fetch](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/location_list.go): `internal/pokeapi/location_list.go`
- [Location listing](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/location_list.go): `internal/pokeapi/location_list.go`
- [Encounter fetch](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/explore_location.go): `internal/pokeapi/explore_location.go`
- [Encounter listing](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/explore_location.go): `internal/pokeapi/explore_location.go`
- [Pokémon fetch](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/get_pokemon.go): `internal/pokeapi/get_pokemon.go`
- [Catch probability](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/get_pokemon.go): `internal/pokeapi/get_pokemon.go`
- [Pokémon display](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokeapi/get_pokemon.go): `internal/pokeapi/get_pokemon.go`

### Local state

- [Location cache](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokecache/type_cache.go): `internal/pokecache/type_cache.go`
- [Encounter cache](https://github.com/ramzygirgis/pokedex/blob/main/internal/pokecache/type_cache.go): `internal/pokecache/type_cache.go`
- [Caught Pokémon](https://github.com/ramzygirgis/pokedex/blob/main/repl.go): `repl.go`

### Other components

- **User**
- **PokeAPI**

## Connections

- Startup → REPL: starts
- User → REPL: enters commands
- REPL → Map commands: dispatches map
- REPL → Explore command: dispatches explore
- REPL → Catch command: dispatches catch
- REPL → Inspect command: dispatches inspect
- REPL → Pokedex command: dispatches list
- Map commands → Location cache: reads and writes
- Map commands → Location fetch: fetches on miss
- Map commands → Location listing: lists results
- Explore command → Encounter cache: reads and writes
- Explore command → Encounter fetch: fetches on miss
- Explore command → Encounter listing: prints encounters
- Catch command → Pokémon fetch: fetches Pokémon
- Catch command → Catch probability: calculates odds
- Catch command → Caught Pokémon: stores caught
- Inspect command → Caught Pokémon: reads caught
- Inspect command → Pokémon display: prints details
- Pokedex command → Caught Pokémon: lists caught
- Location fetch → HTTP client: uses HTTP
- Encounter fetch → HTTP client: uses HTTP
- Pokémon fetch → HTTP client: uses HTTP
- HTTP client → PokeAPI: sends requests
