# yimp0/proyectopokemon architecture

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

- Interactive diagram: https://gitdiagram.com/yimp0/proyectopokemon
- Repository: https://github.com/yimp0/proyectopokemon

## Overview

This is a browser-based Pokémon teambuilder with a Pokédex, configurable teams, practice battles, and online multiplayer. Users can find Pokémon, add and tune a team, then use it in a local or network battle; team import/export and a usage guide are additional features. The browser client fetches Pokémon data and stores teams locally, while a small WebSocket server coordinates multiplayer rooms and turns. Some cross-module wiring is inferred only where an excerpt shows a direct call; unsampled subsystems are represented by their known source paths.

Main entry points: [`js/api.js`](https://github.com/yimp0/proyectopokemon/blob/main/js/api.js) (Pokémon data access), [`js/importar-exportar.js`](https://github.com/yimp0/proyectopokemon/blob/main/js/importar-exportar.js) (Team import/export), [`js/persistencia.js`](https://github.com/yimp0/proyectopokemon/blob/main/js/persistencia.js) (Saved teams), [`js/multiplayer.js`](https://github.com/yimp0/proyectopokemon/blob/main/js/multiplayer.js) (Multiplayer client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Pokémon discovery"]
  node_api["Pokémon data access<br/>[api.js]"]
  node_pokedex["Pokédex search<br/>[pokedex.js]"]
  node_selector["Team Pokémon selector<br/>[teambuilder.js]"]
end

subgraph group_team["Team building"]
  node_team_editor["Team configuration<br/>[teambuilder.js]"]
  node_team_state[("Team state<br/>[estado.js]")]
  node_persistence[("Saved teams<br/>[persistencia.js]")]
  node_team_io["Team import/export"]
end

subgraph group_battle["Battle modes"]
  node_practice["Practice battle<br/>[battle.js]"]
  node_multiplayer["Multiplayer client<br/>[multiplayer.js]"]
  node_server["Room and turn server<br/>[server.js]"]
end

subgraph group_support["App support"]
  node_navigation["Page navigation<br/>[navegacion.js]"]
  node_guide["Interactive guide<br/>[guia.js]"]
  node_constants["Game constants<br/>[constantes.js]"]
end

node_trainer(("Trainer"))
node_pokeapi["PokéAPI"]
node_opponent(("Remote trainer"))
node_local_storage[("Browser localStorage")]
node_showdown_sprites["Pokémon Showdown sprites"]

node_trainer -->|"selects page"| node_navigation
node_navigation -->|"generates export"| node_team_io
node_api -->|"fetches data"| node_pokeapi
node_pokedex -->|"adds Pokémon"| node_team_editor
node_persistence -->|"loads Pokémon"| node_api
node_persistence -->|"restores team"| node_team_state
node_persistence -->|"reads and writes"| node_local_storage
node_team_io -->|"imports and exports"| node_team_state
node_team_io -->|"saves imported team"| node_persistence
node_team_io -->|"resolves Pokémon"| node_api
node_multiplayer -->|"reads selected team"| node_team_state
node_multiplayer -->|"exchanges room messages"| node_server
node_opponent -.->|"sends battle moves"| node_server
node_server -->|"sends battle results"| node_multiplayer
node_trainer -->|"plays practice battle"| node_practice
node_practice -->|"loads Pokémon"| node_api
node_trainer -->|"creates or joins room"| node_multiplayer
node_trainer -->|"configures team"| node_team_editor
node_trainer -->|"searches entries"| node_pokedex
node_trainer -.->|"opens guide"| node_guide
node_constants -.->|"provides API settings"| node_api
node_api -->|"builds sprite URLs"| node_showdown_sprites

click node_navigation "https://github.com/yimp0/proyectopokemon/blob/main/js/navegacion.js"
click node_guide "https://github.com/yimp0/proyectopokemon/blob/main/js/guia.js"
click node_constants "https://github.com/yimp0/proyectopokemon/blob/main/js/constantes.js"
click node_api "https://github.com/yimp0/proyectopokemon/blob/main/js/api.js"
click node_pokedex "https://github.com/yimp0/proyectopokemon/blob/main/js/pokedex.js"
click node_selector "https://github.com/yimp0/proyectopokemon/blob/main/js/teambuilder.js"
click node_team_editor "https://github.com/yimp0/proyectopokemon/blob/main/js/teambuilder.js"
click node_team_state "https://github.com/yimp0/proyectopokemon/blob/main/js/estado.js"
click node_persistence "https://github.com/yimp0/proyectopokemon/blob/main/js/persistencia.js"
click node_team_io "https://github.com/yimp0/proyectopokemon/blob/main/js/importar-exportar.js"
click node_practice "https://github.com/yimp0/proyectopokemon/blob/main/js/battle.js"
click node_multiplayer "https://github.com/yimp0/proyectopokemon/blob/main/js/multiplayer.js"
click node_server "https://github.com/yimp0/proyectopokemon/blob/main/servidor/server.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_api,node_pokedex,node_selector toneBlue
class node_team_editor,node_team_state,node_persistence,node_team_io,node_local_storage toneAmber
class node_practice,node_multiplayer,node_server,node_pokeapi toneMint
class node_navigation,node_guide,node_constants toneRose
class node_trainer,node_opponent,node_showdown_sprites toneIndigo
```

## Components

### Pokémon discovery

- [Pokémon data access](https://github.com/yimp0/proyectopokemon/blob/main/js/api.js): `js/api.js`
- [Pokédex search](https://github.com/yimp0/proyectopokemon/blob/main/js/pokedex.js): `js/pokedex.js`
- [Team Pokémon selector](https://github.com/yimp0/proyectopokemon/blob/main/js/teambuilder.js): `js/teambuilder.js`

### Team building

- [Team configuration](https://github.com/yimp0/proyectopokemon/blob/main/js/teambuilder.js): `js/teambuilder.js`
- [Team state](https://github.com/yimp0/proyectopokemon/blob/main/js/estado.js): `js/estado.js`
- [Saved teams](https://github.com/yimp0/proyectopokemon/blob/main/js/persistencia.js): `js/persistencia.js`
- [Team import/export](https://github.com/yimp0/proyectopokemon/blob/main/js/importar-exportar.js): `js/importar-exportar.js`

### Battle modes

- [Practice battle](https://github.com/yimp0/proyectopokemon/blob/main/js/battle.js): `js/battle.js`
- [Multiplayer client](https://github.com/yimp0/proyectopokemon/blob/main/js/multiplayer.js): `js/multiplayer.js`
- [Room and turn server](https://github.com/yimp0/proyectopokemon/blob/main/servidor/server.js): `servidor/server.js`

### App support

- [Page navigation](https://github.com/yimp0/proyectopokemon/blob/main/js/navegacion.js): `js/navegacion.js`
- [Interactive guide](https://github.com/yimp0/proyectopokemon/blob/main/js/guia.js): `js/guia.js`
- [Game constants](https://github.com/yimp0/proyectopokemon/blob/main/js/constantes.js): `js/constantes.js`

### Other components

- **Trainer**
- **PokéAPI**
- **Remote trainer**
- **Browser localStorage**
- **Pokémon Showdown sprites**

## Connections

- Trainer → Page navigation: selects page (evidence: `js/navegacion.js`)
- Page navigation → Team import/export: generates export (evidence: `js/navegacion.js`)
- Pokémon data access → PokéAPI: fetches data (evidence: `js/api.js`)
- Pokédex search → Team configuration: adds Pokémon (evidence: `js/pokedex.js`)
- Saved teams → Pokémon data access: loads Pokémon (evidence: `js/persistencia.js`)
- Saved teams → Team state: restores team (evidence: `js/persistencia.js`)
- Saved teams → Browser localStorage: reads and writes (evidence: `js/persistencia.js`)
- Team import/export → Team state: imports and exports (evidence: `js/importar-exportar.js`)
- Team import/export → Saved teams: saves imported team (evidence: `js/importar-exportar.js`)
- Team import/export → Pokémon data access: resolves Pokémon (evidence: `js/importar-exportar.js`)
- Multiplayer client → Team state: reads selected team (evidence: `js/multiplayer.js`)
- Multiplayer client → Room and turn server: exchanges room messages (evidence: `js/multiplayer.js`)
- Remote trainer → Room and turn server: sends battle moves
- Room and turn server → Multiplayer client: sends battle results (evidence: `servidor/server.js`)
- Trainer → Practice battle: plays practice battle (evidence: `js/battle.js`)
- Practice battle → Pokémon data access: loads Pokémon (evidence: `js/battle.js`)
- Trainer → Multiplayer client: creates or joins room (evidence: `js/multiplayer.js`)
- Trainer → Team configuration: configures team (evidence: `js/teambuilder.js`)
- Trainer → Pokédex search: searches entries (evidence: `js/pokedex.js`)
- Trainer → Interactive guide: opens guide
- Game constants → Pokémon data access: provides API settings
- Pokémon data access → Pokémon Showdown sprites: builds sprite URLs (evidence: `js/api.js`)
