# andresepenagosp/mokepon architecture

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

- Interactive diagram: https://gitdiagram.com/andresepenagosp/mokepon
- Repository: https://github.com/andresepenagosp/mokepon

## Overview

Mokepon is a browser-based multiplayer creature-battle game. A player joins, selects a creature, explores a canvas map, and battles using attack choices; the Express server assigns player IDs and keeps player, position, and attack data in memory. The principal client logic is concentrated in one file, so several domain responsibilities share that path. The README is empty, and the sampled client excerpt is partial; unverified client-to-server interactions are omitted.

Main entry points: [`index.js`](https://github.com/andresepenagosp/mokepon/blob/main/index.js) (Express Routes), [`public/js/mokepon.js`](https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js) (Game Client), [`public/assets`](https://github.com/andresepenagosp/mokepon/tree/main/public/assets) (Creature Artwork)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Browser Game"]
  node_game_client["Game Client<br/>[mokepon.js]"]
  node_creature_selection["Creature Selection<br/>[mokepon.js]"]
  node_map_play["Map Movement<br/>[mokepon.js]"]
  node_enemy_sync["Enemy Sync<br/>[mokepon.js]"]
  node_combat["Battle Resolution<br/>[mokepon.js]"]
end

subgraph group_server["Game Server"]
  node_api["Express Routes<br/>[index.js]"]
  node_player_state[("Player Registry<br/>[index.js]")]
  node_static_files["Static Assets<br/>[index.js]"]
end

subgraph group_assets["Game Assets"]
  node_game_art["Creature Artwork"]
end

node_player(("Player"))

node_player -->|"plays"| node_game_client
node_game_client -->|"requests ID"| node_api
node_api -->|"registers players"| node_player_state
node_api -->|"updates player data"| node_player_state
node_creature_selection -.->|"assigns creature"| node_api
node_map_play -.->|"updates position"| node_enemy_sync
node_enemy_sync -.->|"requests opponents"| node_api
node_game_client -->|"selects creature"| node_creature_selection
node_creature_selection -->|"starts map"| node_map_play
node_creature_selection -->|"loads attacks"| node_combat
node_combat -.->|"submits attacks"| node_api
node_game_client -->|"serves game files"| node_static_files
node_static_files -.->|"serves artwork"| node_game_art

click node_game_client "https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js"
click node_creature_selection "https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js"
click node_map_play "https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js"
click node_enemy_sync "https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js"
click node_combat "https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js"
click node_api "https://github.com/andresepenagosp/mokepon/blob/main/index.js"
click node_player_state "https://github.com/andresepenagosp/mokepon/blob/main/index.js"
click node_static_files "https://github.com/andresepenagosp/mokepon/blob/main/index.js"
click node_game_art "https://github.com/andresepenagosp/mokepon/tree/main/public/assets"

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_game_client,node_creature_selection,node_map_play,node_enemy_sync,node_combat toneBlue
class node_api,node_player_state,node_static_files toneAmber
class node_game_art toneMint
class node_player toneIndigo
```

## Components

### Browser Game

- [Game Client](https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js): `public/js/mokepon.js`
- [Creature Selection](https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js): `public/js/mokepon.js`
- [Map Movement](https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js): `public/js/mokepon.js`
- [Enemy Sync](https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js): `public/js/mokepon.js`
- [Battle Resolution](https://github.com/andresepenagosp/mokepon/blob/main/public/js/mokepon.js): `public/js/mokepon.js`

### Game Server

- [Express Routes](https://github.com/andresepenagosp/mokepon/blob/main/index.js): `index.js`
- [Player Registry](https://github.com/andresepenagosp/mokepon/blob/main/index.js): `index.js`
- [Static Assets](https://github.com/andresepenagosp/mokepon/blob/main/index.js): `index.js`

### Game Assets

- [Creature Artwork](https://github.com/andresepenagosp/mokepon/tree/main/public/assets): `public/assets`

### Other components

- **Player**

## Connections

- Player → Game Client: plays (evidence: `public/js/mokepon.js`)
- Game Client → Express Routes: requests ID (evidence: `public/js/mokepon.js`)
- Express Routes → Player Registry: registers players (evidence: `index.js`)
- Express Routes → Player Registry: updates player data (evidence: `index.js`)
- Creature Selection → Express Routes: assigns creature
- Map Movement → Enemy Sync: updates position (evidence: `public/js/mokepon.js`)
- Enemy Sync → Express Routes: requests opponents
- Game Client → Creature Selection: selects creature (evidence: `public/js/mokepon.js`)
- Creature Selection → Map Movement: starts map (evidence: `public/js/mokepon.js`)
- Creature Selection → Battle Resolution: loads attacks (evidence: `public/js/mokepon.js`)
- Battle Resolution → Express Routes: submits attacks
- Game Client → Static Assets: serves game files (evidence: `index.js`)
- Static Assets → Creature Artwork: serves artwork
