# monii-dev/minigame architecture

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

- Interactive diagram: https://gitdiagram.com/monii-dev/minigame
- Repository: https://github.com/monii-dev/minigame

## Overview

ARCADE is a static browser arcade: players browse the catalog, open a game, and—where supported—play online through ChronoMesh. The README documents the room-creation and invitation flow, sequential admission, encrypted P2P with MQTT fallback, and the single-player Ocean Abyss branch. The graph also preserves the information and microphone gates and ChronoMesh’s crypto, transport, routing, and physics layers. Several game pages and ChronoMesh modules were not excerpted, so only documented or excerpt-visible relationships are connected.

Main entry points: [`catalog.js`](https://github.com/monii-dev/minigame/blob/main/catalog.js) (Game catalog), [`shared/chronomesh/chronomesh.mjs`](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/chronomesh.mjs) (Game client API), [`shared/chronomesh/mesh.mjs`](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/mesh.mjs) (Peer mesh), [`shared/chronomesh/mqtt.mjs`](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/mqtt.mjs) (MQTT transport)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_arcade["Arcade experience"]
  node_catalog["Game catalog<br/>[catalog.js]"]
  node_plan["Game plan<br/>[plan.js]"]
end

subgraph group_games["Game experiences"]
  node_bumper["Bumper Arena"]
  node_draw["Draw Talk"]
  node_wink["Wink Mafia"]
  node_ocean["Ocean Abyss"]
end

subgraph group_network["ChronoMesh networking"]
  node_client["Game client API<br/>[chronomesh.mjs]"]
  node_mesh["Peer mesh<br/>[mesh.mjs]"]
  node_crypto["Identity and encryption<br/>[crypto.mjs]"]
  node_mqtt["MQTT transport<br/>[mqtt.mjs]"]
  node_core["Routing and timing<br/>[core.mjs]"]
  node_physics["Game physics<br/>[physics.mjs]"]
end

subgraph group_platform["Shared services"]
  node_info["Safety information<br/>[info.js]"]
  node_mic["Microphone gate<br/>[mic-gate.js]"]
  node_back["Return navigation<br/>[arcade-back.js]"]
end

node_player(("Player"))
node_broker{{"EMQX MQTT broker"}}
node_stun{{"Google STUN"}}

node_player -->|"browses"| node_catalog
node_catalog -.->|"reads listings"| node_plan
node_catalog -->|"opens game"| node_bumper
node_catalog -->|"opens game"| node_draw
node_catalog -->|"opens game"| node_wink
node_catalog -->|"opens game"| node_ocean
node_catalog -->|"checks access"| node_mic
node_player -->|"reviews risks"| node_info
node_bumper -->|"uses online play"| node_client
node_draw -->|"uses online play"| node_client
node_wink -->|"uses online play"| node_client
node_player -->|"plays solo"| node_ocean
node_client -->|"creates mesh"| node_mesh
node_client -->|"configures transport"| node_mqtt
node_client -->|"uses tokens"| node_crypto
node_client -->|"exports physics"| node_physics
node_mesh -->|"encrypts messages"| node_crypto
node_mesh -->|"signals via"| node_mqtt
node_mesh -->|"uses routing"| node_core
node_mqtt -->|"connects to"| node_broker
node_mesh -->|"configures ICE"| node_stun

click node_catalog "https://github.com/monii-dev/minigame/blob/main/catalog.js"
click node_plan "https://github.com/monii-dev/minigame/blob/main/plan.js"
click node_info "https://github.com/monii-dev/minigame/blob/main/shared/info.js"
click node_mic "https://github.com/monii-dev/minigame/blob/main/shared/mic-gate.js"
click node_back "https://github.com/monii-dev/minigame/blob/main/shared/arcade-back.js"
click node_bumper "https://github.com/monii-dev/minigame/tree/main/games/bumper-arena"
click node_draw "https://github.com/monii-dev/minigame/tree/main/games/draw-talk"
click node_wink "https://github.com/monii-dev/minigame/tree/main/games/wink-mafia"
click node_ocean "https://github.com/monii-dev/minigame/tree/main/games/ocean-abyss"
click node_client "https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/chronomesh.mjs"
click node_mesh "https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/mesh.mjs"
click node_crypto "https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/crypto.mjs"
click node_mqtt "https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/mqtt.mjs"
click node_core "https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/core.mjs"
click node_physics "https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/physics.mjs"

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_catalog,node_plan toneBlue
class node_bumper,node_draw,node_wink,node_ocean toneAmber
class node_client,node_mesh,node_crypto,node_mqtt,node_core,node_physics toneMint
class node_info,node_mic,node_back toneRose
class node_player,node_broker,node_stun toneIndigo
```

## Components

### Arcade experience

- [Game catalog](https://github.com/monii-dev/minigame/blob/main/catalog.js): `catalog.js`
- [Game plan](https://github.com/monii-dev/minigame/blob/main/plan.js): `plan.js`

### Game experiences

- [Bumper Arena](https://github.com/monii-dev/minigame/tree/main/games/bumper-arena): `games/bumper-arena`
- [Draw Talk](https://github.com/monii-dev/minigame/tree/main/games/draw-talk): `games/draw-talk`
- [Wink Mafia](https://github.com/monii-dev/minigame/tree/main/games/wink-mafia): `games/wink-mafia`
- [Ocean Abyss](https://github.com/monii-dev/minigame/tree/main/games/ocean-abyss): `games/ocean-abyss`

### ChronoMesh networking

- [Game client API](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/chronomesh.mjs): `shared/chronomesh/chronomesh.mjs`
- [Peer mesh](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/mesh.mjs): `shared/chronomesh/mesh.mjs`
- [Identity and encryption](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/crypto.mjs): `shared/chronomesh/crypto.mjs`
- [MQTT transport](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/mqtt.mjs): `shared/chronomesh/mqtt.mjs`
- [Routing and timing](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/core.mjs): `shared/chronomesh/core.mjs`
- [Game physics](https://github.com/monii-dev/minigame/blob/main/shared/chronomesh/physics.mjs): `shared/chronomesh/physics.mjs`

### Shared services

- [Safety information](https://github.com/monii-dev/minigame/blob/main/shared/info.js): `shared/info.js`
- [Microphone gate](https://github.com/monii-dev/minigame/blob/main/shared/mic-gate.js): `shared/mic-gate.js`
- [Return navigation](https://github.com/monii-dev/minigame/blob/main/shared/arcade-back.js): `shared/arcade-back.js`

### Other components

- **Player**
- **EMQX MQTT broker**
- **Google STUN**

## Connections

- Player → Game catalog: browses (evidence: `README.txt`)
- Game catalog → Game plan: reads listings
- Game catalog → Bumper Arena: opens game (evidence: `catalog.js`)
- Game catalog → Draw Talk: opens game (evidence: `catalog.js`)
- Game catalog → Wink Mafia: opens game (evidence: `catalog.js`)
- Game catalog → Ocean Abyss: opens game (evidence: `catalog.js`)
- Game catalog → Microphone gate: checks access (evidence: `catalog.js`)
- Player → Safety information: reviews risks (evidence: `README.txt`)
- Bumper Arena → Game client API: uses online play (evidence: `README.txt`)
- Draw Talk → Game client API: uses online play (evidence: `README.txt`)
- Wink Mafia → Game client API: uses online play (evidence: `README.txt`)
- Player → Ocean Abyss: plays solo (evidence: `README.txt`)
- Game client API → Peer mesh: creates mesh (evidence: `shared/chronomesh/chronomesh.mjs`)
- Game client API → MQTT transport: configures transport (evidence: `shared/chronomesh/chronomesh.mjs`)
- Game client API → Identity and encryption: uses tokens (evidence: `shared/chronomesh/chronomesh.mjs`)
- Game client API → Game physics: exports physics (evidence: `shared/chronomesh/chronomesh.mjs`)
- Peer mesh → Identity and encryption: encrypts messages (evidence: `shared/chronomesh/mesh.mjs`)
- Peer mesh → MQTT transport: signals via (evidence: `shared/chronomesh/mesh.mjs`)
- Peer mesh → Routing and timing: uses routing (evidence: `shared/chronomesh/mesh.mjs`)
- MQTT transport → EMQX MQTT broker: connects to (evidence: `shared/chronomesh/mqtt.mjs`)
- Peer mesh → Google STUN: configures ICE (evidence: `shared/chronomesh/mesh.mjs`)
