# madelyyn/thearchivesurvivalgameapi-mineflayer-plugin architecture

> Architecture diagram of the GitHub repository madelyyn/thearchivesurvivalgameapi-mineflayer-plugin, 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/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin
- Repository: https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin

## Overview

This package extends a Mineflayer bot with request and response APIs for TheArchive Survival Game. A bot user calls a query method; the plugin encodes and sends a custom-payload request, then dispatches and parses the matching response so the query can resolve. The README demonstrates player-list lookup followed by Plan stats; the tree also documents inventory, Minecraft statistics, and uptime. Some request/response modules and channel implementation were not sampled, so their detailed wiring is represented only where imports or names support it.

Main entry points: [`src/in/handlers.js`](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/handlers.js) (Payload dispatcher), [`src/channel.js`](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/channel.js) (Channel transport), [`src/main.js`](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/main.js) (Plugin setup), [`src/out/playerListRequest.js`](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/playerListRequest.js) (Player-list query)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_plugin["Plugin Setup"]
  node_plugin_entry["Plugin entry<br/>[index.js]"]
  node_plugin_setup["Plugin setup<br/>[main.js]"]
end

subgraph group_outbound["Outbound API"]
  node_playerlist_request["Player-list query"]
  node_plan_stats_request["Plan-stats query"]
  node_minecraft_stat_request["Minecraft-stat query"]
  node_inventory_request["Inventory query"]
  node_uptime_request["Uptime query<br/>[uptimeRequest.js]"]
end

subgraph group_inbound["Inbound API"]
  node_handlers["Payload dispatcher<br/>[handlers.js]"]
  node_playerlist_response["Player-list parser"]
  node_plan_stats_response["Plan-stats parser"]
  node_minecraft_stat_response["Minecraft-stat parser"]
  node_inventory_response["Inventory parser"]
  node_uptime_response["Uptime parser<br/>[uptimeResponse.js]"]
end

subgraph group_wire["Wire Protocol"]
  node_channel["Channel transport<br/>[channel.js]"]
  node_protocol["Packet codec<br/>[protocol.js]"]
end

node_bot_user(("Bot user"))
node_archive_server(("Archive server"))

node_bot_user -->|"loads plugin"| node_plugin_entry
node_plugin_entry -->|"exports"| node_plugin_setup
node_plugin_setup -->|"registers"| node_playerlist_request
node_plugin_setup -->|"registers"| node_plan_stats_request
node_plugin_setup -->|"registers"| node_minecraft_stat_request
node_plugin_setup -->|"registers"| node_inventory_request
node_plugin_setup -->|"registers"| node_uptime_request
node_plugin_setup -->|"registers"| node_handlers
node_bot_user -->|"calls query"| node_playerlist_request
node_bot_user -->|"calls query"| node_plan_stats_request
node_bot_user -->|"calls query"| node_minecraft_stat_request
node_bot_user -->|"calls query"| node_inventory_request
node_bot_user -->|"calls query"| node_uptime_request
node_playerlist_request -->|"encodes request"| node_protocol
node_plan_stats_request -->|"encodes request"| node_protocol
node_minecraft_stat_request -->|"encodes request"| node_protocol
node_inventory_request -->|"encodes request"| node_protocol
node_uptime_request -->|"encodes request"| node_protocol
node_playerlist_request -->|"sends request"| node_channel
node_plan_stats_request -->|"sends request"| node_channel
node_minecraft_stat_request -->|"sends request"| node_channel
node_inventory_request -->|"sends request"| node_channel
node_uptime_request -->|"sends request"| node_channel
node_channel -->|"transmits payload"| node_archive_server
node_archive_server -->|"returns payload"| node_channel
node_channel -->|"delivers payload"| node_handlers
node_handlers -->|"decodes packet"| node_protocol
node_handlers -->|"dispatches"| node_playerlist_response
node_handlers -->|"dispatches"| node_plan_stats_response
node_handlers -->|"dispatches"| node_minecraft_stat_response
node_handlers -->|"dispatches"| node_inventory_response
node_handlers -->|"dispatches"| node_uptime_response
node_playerlist_response -->|"emits response"| node_playerlist_request
node_plan_stats_response -->|"emits response"| node_plan_stats_request
node_minecraft_stat_response -->|"emits response"| node_minecraft_stat_request
node_inventory_response -->|"emits response"| node_inventory_request
node_uptime_response -->|"emits response"| node_uptime_request
node_playerlist_request -->|"returns players"| node_bot_user
node_plan_stats_request -->|"returns stats"| node_bot_user
node_minecraft_stat_request -->|"returns statistic"| node_bot_user
node_inventory_request -->|"returns items"| node_bot_user
node_uptime_request -->|"returns uptime"| node_bot_user

click node_plugin_entry "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/index.js"
click node_plugin_setup "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/main.js"
click node_channel "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/channel.js"
click node_protocol "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/protocol.js"
click node_handlers "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/handlers.js"
click node_playerlist_request "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/playerListRequest.js"
click node_plan_stats_request "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/planStatsRequest.js"
click node_minecraft_stat_request "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/minecraftStatRequest.js"
click node_inventory_request "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/inventoryRequest.js"
click node_uptime_request "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/uptimeRequest.js"
click node_playerlist_response "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/playerListResponse.js"
click node_plan_stats_response "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/planStatsResponse.js"
click node_minecraft_stat_response "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/minecraftStatResponse.js"
click node_inventory_response "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/inventoryResponse.js"
click node_uptime_response "https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/uptimeResponse.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_plugin_entry,node_plugin_setup,node_bot_user toneBlue
class node_playerlist_request,node_plan_stats_request,node_minecraft_stat_request,node_inventory_request,node_uptime_request toneAmber
class node_handlers,node_playerlist_response,node_plan_stats_response,node_minecraft_stat_response,node_inventory_response,node_uptime_response,node_archive_server toneMint
class node_channel,node_protocol toneRose
```

## Components

### Plugin Setup

- [Plugin entry](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/index.js): `index.js`
- [Plugin setup](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/main.js): `src/main.js`

### Outbound API

- [Player-list query](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/playerListRequest.js): `src/out/playerListRequest.js`
- [Plan-stats query](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/planStatsRequest.js): `src/out/planStatsRequest.js`
- [Minecraft-stat query](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/minecraftStatRequest.js): `src/out/minecraftStatRequest.js`
- [Inventory query](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/inventoryRequest.js): `src/out/inventoryRequest.js`
- [Uptime query](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/out/uptimeRequest.js): `src/out/uptimeRequest.js`

### Inbound API

- [Payload dispatcher](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/handlers.js): `src/in/handlers.js`
- [Player-list parser](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/playerListResponse.js): `src/in/playerListResponse.js`
- [Plan-stats parser](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/planStatsResponse.js): `src/in/planStatsResponse.js`
- [Minecraft-stat parser](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/minecraftStatResponse.js): `src/in/minecraftStatResponse.js`
- [Inventory parser](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/inventoryResponse.js): `src/in/inventoryResponse.js`
- [Uptime parser](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/in/uptimeResponse.js): `src/in/uptimeResponse.js`

### Wire Protocol

- [Channel transport](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/channel.js): `src/channel.js`
- [Packet codec](https://github.com/madelyyn/thearchivesurvivalgameapi-mineflayer-plugin/blob/main/src/protocol.js): `src/protocol.js`

### Other components

- **Bot user**
- **Archive server**

## Connections

- Bot user → Plugin entry: loads plugin
- Plugin entry → Plugin setup: exports
- Plugin setup → Player-list query: registers
- Plugin setup → Plan-stats query: registers
- Plugin setup → Minecraft-stat query: registers
- Plugin setup → Inventory query: registers
- Plugin setup → Uptime query: registers
- Plugin setup → Payload dispatcher: registers
- Bot user → Player-list query: calls query
- Bot user → Plan-stats query: calls query
- Bot user → Minecraft-stat query: calls query
- Bot user → Inventory query: calls query
- Bot user → Uptime query: calls query
- Player-list query → Packet codec: encodes request
- Plan-stats query → Packet codec: encodes request
- Minecraft-stat query → Packet codec: encodes request
- Inventory query → Packet codec: encodes request
- Uptime query → Packet codec: encodes request
- Player-list query → Channel transport: sends request
- Plan-stats query → Channel transport: sends request
- Minecraft-stat query → Channel transport: sends request
- Inventory query → Channel transport: sends request
- Uptime query → Channel transport: sends request
- Channel transport → Archive server: transmits payload
- Archive server → Channel transport: returns payload
- Channel transport → Payload dispatcher: delivers payload
- Payload dispatcher → Packet codec: decodes packet
- Payload dispatcher → Player-list parser: dispatches
- Payload dispatcher → Plan-stats parser: dispatches
- Payload dispatcher → Minecraft-stat parser: dispatches
- Payload dispatcher → Inventory parser: dispatches
- Payload dispatcher → Uptime parser: dispatches
- Player-list parser → Player-list query: emits response
- Plan-stats parser → Plan-stats query: emits response
- Minecraft-stat parser → Minecraft-stat query: emits response
- Inventory parser → Inventory query: emits response
- Uptime parser → Uptime query: emits response
- Player-list query → Bot user: returns players
- Plan-stats query → Bot user: returns stats
- Minecraft-stat query → Bot user: returns statistic
- Inventory query → Bot user: returns items
- Uptime query → Bot user: returns uptime
