# manepallyharshit/hushodyssey architecture

> Architecture diagram of the GitHub repository manepallyharshit/hushodyssey, 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/manepallyharshit/hushodyssey
- Repository: https://github.com/manepallyharshit/hushodyssey

## Overview

Hush Odyssey is a browser-based Unity game with a React console, wallet-based POAP minting on Hush Chain, and an optional in-memory player/leaderboard API. The documented loop runs from gem collection through altar validation to a signed on-chain mint. Unity gameplay internals and some UI wiring are described by the README or tree but were not sampled, so their connections are limited to documented bridge events and visible application calls.

Main entry points: [`frontend/src/App.jsx`](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/App.jsx) (App Orchestrator), [`frontend/src/hooks/useMint.js`](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/hooks/useMint.js) (Mint Hook), [`frontend/src/hooks/useUnityBridge.js`](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/hooks/useUnityBridge.js) (Unity Bridge Hook), [`unity/Assets/Plugins/WebGLBridge.jslib`](https://github.com/manepallyharshit/hushodyssey/blob/main/unity/Assets/Plugins/WebGLBridge.jslib) (WebGL Event Bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["React Console"]
  node_app["App Orchestrator<br/>[App.jsx]"]
  node_unityhook["Unity Bridge Hook<br/>[useUnityBridge.js]"]
  node_hud["Bento HUD<br/>[BentoHUD.jsx]"]
  node_mintui["Mint Overlay<br/>[MintOverlay.jsx]"]
  node_wallethook["Wallet Hook<br/>[useWallet.js]"]
  node_minthook["Mint Hook<br/>[useMint.js]"]
end

subgraph group_game["Unity Gameplay"]
  node_unitygame["Game Simulation"]
  node_altar["Genesis Altar<br/>[GenesisAltar.cs]"]
  node_unitybridge["WebGL Event Bridge<br/>[WebGLBridge.jslib]"]
  node_webbuild["Unity WebGL Build<br/>[WebBuild.loader.js]"]
end

subgraph group_memory["Player Memory"]
  node_api["Player API<br/>[server.js]"]
  node_playerstore[("Player Model<br/>[Player.js]")]
end

subgraph group_ledger["Hush Chain Ledger"]
  node_contract["Genesis Protocol"]
end

node_player(("Player"))
node_wallet["MetaMask"]
node_chain[("Hush Chain")]

node_player -->|"uses console"| node_app
node_app -->|"initializes bridge"| node_unityhook
node_unityhook -->|"loads game"| node_webbuild
node_unitygame -->|"emits game events"| node_unitybridge
node_altar -->|"signals mint"| node_unitybridge
node_unitybridge -->|"dispatches events"| node_unityhook
node_unityhook -->|"reports gems and altar"| node_app
node_app -->|"passes player stats"| node_hud
node_app -->|"connects wallet"| node_wallethook
node_wallethook -->|"requests account and network"| node_wallet
node_app -->|"requests mint"| node_minthook
node_minthook -->|"requests signature"| node_wallet
node_minthook -->|"calls mintGenesis"| node_contract
node_contract -->|"records POAP"| node_chain
node_app -->|"passes mint status"| node_mintui
node_app -->|"fetches leaderboard"| node_api
node_api -->|"reads and updates"| node_playerstore
node_minthook -->|"reports mint success"| node_api

click node_app "https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/App.jsx"
click node_unityhook "https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/hooks/useUnityBridge.js"
click node_hud "https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/components/BentoHUD.jsx"
click node_mintui "https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/components/MintOverlay.jsx"
click node_wallethook "https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/hooks/useWallet.js"
click node_minthook "https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/hooks/useMint.js"
click node_unitygame "https://github.com/manepallyharshit/hushodyssey/tree/main/unity/Assets/Scripts"
click node_altar "https://github.com/manepallyharshit/hushodyssey/blob/main/unity/Assets/Scripts/GenesisAltar.cs"
click node_unitybridge "https://github.com/manepallyharshit/hushodyssey/blob/main/unity/Assets/Plugins/WebGLBridge.jslib"
click node_webbuild "https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/public/unity/Build/WebBuild.loader.js"
click node_api "https://github.com/manepallyharshit/hushodyssey/blob/main/backend/server.js"
click node_playerstore "https://github.com/manepallyharshit/hushodyssey/blob/main/backend/models/Player.js"
click node_contract "https://github.com/manepallyharshit/hushodyssey/blob/main/blockchain/contracts/GenesisProtocol.sol"

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_app,node_unityhook,node_hud,node_mintui,node_wallethook,node_minthook toneBlue
class node_unitygame,node_altar,node_unitybridge,node_webbuild,node_chain toneAmber
class node_api,node_playerstore toneMint
class node_contract toneRose
class node_player,node_wallet toneIndigo
```

## Components

### React Console

- [App Orchestrator](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/App.jsx): `frontend/src/App.jsx`
- [Unity Bridge Hook](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/hooks/useUnityBridge.js): `frontend/src/hooks/useUnityBridge.js`
- [Bento HUD](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/components/BentoHUD.jsx): `frontend/src/components/BentoHUD.jsx`
- [Mint Overlay](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/components/MintOverlay.jsx): `frontend/src/components/MintOverlay.jsx`
- [Wallet Hook](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/hooks/useWallet.js): `frontend/src/hooks/useWallet.js`
- [Mint Hook](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/src/hooks/useMint.js): `frontend/src/hooks/useMint.js`

### Unity Gameplay

- [Game Simulation](https://github.com/manepallyharshit/hushodyssey/tree/main/unity/Assets/Scripts): `unity/Assets/Scripts`
- [Genesis Altar](https://github.com/manepallyharshit/hushodyssey/blob/main/unity/Assets/Scripts/GenesisAltar.cs): `unity/Assets/Scripts/GenesisAltar.cs`
- [WebGL Event Bridge](https://github.com/manepallyharshit/hushodyssey/blob/main/unity/Assets/Plugins/WebGLBridge.jslib): `unity/Assets/Plugins/WebGLBridge.jslib`
- [Unity WebGL Build](https://github.com/manepallyharshit/hushodyssey/blob/main/frontend/public/unity/Build/WebBuild.loader.js): `frontend/public/unity/Build/WebBuild.loader.js`

### Player Memory

- [Player API](https://github.com/manepallyharshit/hushodyssey/blob/main/backend/server.js): `backend/server.js`
- [Player Model](https://github.com/manepallyharshit/hushodyssey/blob/main/backend/models/Player.js): `backend/models/Player.js`

### Hush Chain Ledger

- [Genesis Protocol](https://github.com/manepallyharshit/hushodyssey/blob/main/blockchain/contracts/GenesisProtocol.sol): `blockchain/contracts/GenesisProtocol.sol`

### Other components

- **Player**
- **MetaMask**
- **Hush Chain**

## Connections

- Player → App Orchestrator: uses console
- App Orchestrator → Unity Bridge Hook: initializes bridge
- Unity Bridge Hook → Unity WebGL Build: loads game
- Game Simulation → WebGL Event Bridge: emits game events
- Genesis Altar → WebGL Event Bridge: signals mint
- WebGL Event Bridge → Unity Bridge Hook: dispatches events
- Unity Bridge Hook → App Orchestrator: reports gems and altar
- App Orchestrator → Bento HUD: passes player stats
- App Orchestrator → Wallet Hook: connects wallet
- Wallet Hook → MetaMask: requests account and network
- App Orchestrator → Mint Hook: requests mint
- Mint Hook → MetaMask: requests signature
- Mint Hook → Genesis Protocol: calls mintGenesis
- Genesis Protocol → Hush Chain: records POAP
- App Orchestrator → Mint Overlay: passes mint status
- App Orchestrator → Player API: fetches leaderboard
- Player API → Player Model: reads and updates
- Mint Hook → Player API: reports mint success
