# suspect147/lucky-cubes architecture

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

- Interactive diagram: https://gitdiagram.com/suspect147/lucky-cubes
- Repository: https://github.com/suspect147/lucky-cubes

## Overview

Lucky Cubes is a browser-based idle cube game, presented in a Telegram-oriented context. Players roll the cube to gain XP and coins, progress through levels and Rainbow Mode, then use progression and currency across quests, skins, boosts, cases, and social features. The graph includes documented major features whose code was not sampled; their paths use supported enclosing directories. Edges are limited to relationships visible in excerpts or stated in the README, so several feature branches remain unconnected where wiring was not shown.

Main entry points: [`scr/js/game/game.js`](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/game.js) (Roll and rewards), [`scr/js/api.js`](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/api.js) (Authenticated API), [`scr/js/game/loader.js`](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/loader.js) (Cube animations), [`scr/js/ui/inventory.js`](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/inventory.js) (Inventory and cases)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Core gameplay"]
  node_roll_ui["Roll interaction<br/>[events.js]"]
  node_game["Roll and rewards<br/>[game.js]"]
  node_animations["Cube animations<br/>[loader.js]"]
  node_assets["TGS skin assets"]
end

subgraph group_progress["Progression"]
  node_levels["XP and levels<br/>[game.js]"]
  node_rainbow["Rainbow Mode<br/>[game.js]"]
end

subgraph group_features["Game features"]
  node_quests["Quests<br/>[quests.js]"]
  node_daily["Daily rewards<br/>[daily-login.js]"]
  node_shop["Shop and boosts<br/>[shop.js]"]
  node_inventory["Inventory and cases<br/>[inventory.js]"]
  node_leaderboard["Leaderboard<br/>[leaderboard.js]"]
  node_squads["Squads<br/>[squads.js]"]
  node_menu["Game menus<br/>[menu.js]"]
  node_onboarding["Onboarding<br/>[onboarding.js]"]
end

subgraph group_platform["Platform services"]
  node_api["Authenticated API<br/>[api.js]"]
  node_server["Game server"]
  node_config["Game configuration<br/>[config.js]"]
  node_wallet["Wallet and top-ups<br/>[wallet.js]"]
  node_translations["Translations<br/>[lang.js]"]
  node_backend["Backend client<br/>[backend.js]"]
end

node_player(("Player"))

node_player -->|"taps cube"| node_roll_ui
node_roll_ui -->|"invokes roll"| node_game
node_game -.->|"requests roll"| node_api
node_api -->|"sends requests"| node_server
node_server -->|"returns state"| node_api
node_game -.->|"loads animations"| node_animations
node_animations -->|"fetches TGS"| node_assets
node_config -->|"configures assets"| node_animations
node_game -->|"awards XP"| node_levels
node_game -->|"triggers mode"| node_rainbow
node_player -.->|"views goals"| node_quests
node_player -.->|"claims rewards"| node_daily
node_player -.->|"browses items"| node_shop
node_shop -->|"updates owned skins"| node_inventory
node_player -.->|"opens inventory"| node_inventory
node_inventory -->|"opens cases"| node_api
node_player -.->|"views rankings"| node_leaderboard
node_player -.->|"manages squad"| node_squads
node_player -.->|"connects wallet"| node_wallet
node_wallet -->|"submits donation"| node_api
node_player -.->|"navigates"| node_menu
node_player -.->|"starts game"| node_onboarding
node_translations -.->|"translates interface"| node_menu
node_backend -.->|"sends requests"| node_server

click node_roll_ui "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/events.js"
click node_game "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/game.js"
click node_animations "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/loader.js"
click node_assets "https://github.com/suspect147/lucky-cubes/tree/main/assets/UI/cubics"
click node_api "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/api.js"
click node_config "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/config.js"
click node_levels "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/game.js"
click node_rainbow "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/game.js"
click node_quests "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/quests.js"
click node_daily "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/daily-login.js"
click node_shop "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/shop.js"
click node_inventory "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/inventory.js"
click node_leaderboard "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/leaderboard.js"
click node_squads "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/squads.js"
click node_wallet "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/wallet.js"
click node_menu "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/menu.js"
click node_onboarding "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/onboarding.js"
click node_translations "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/utils/lang.js"
click node_backend "https://github.com/suspect147/lucky-cubes/blob/main/scr/js/backend.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_roll_ui,node_game,node_animations,node_assets toneBlue
class node_levels,node_rainbow toneAmber
class node_quests,node_daily,node_shop,node_inventory,node_leaderboard,node_squads,node_menu,node_onboarding toneMint
class node_api,node_server,node_config,node_wallet,node_translations,node_backend toneRose
class node_player toneIndigo
```

## Components

### Core gameplay

- [Roll interaction](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/events.js): `scr/js/game/events.js`
- [Roll and rewards](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/game.js): `scr/js/game/game.js`
- [Cube animations](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/loader.js): `scr/js/game/loader.js`
- [TGS skin assets](https://github.com/suspect147/lucky-cubes/tree/main/assets/UI/cubics): `assets/UI/cubics`

### Progression

- [XP and levels](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/game.js): `scr/js/game/game.js`
- [Rainbow Mode](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/game/game.js): `scr/js/game/game.js`

### Game features

- [Quests](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/quests.js): `scr/js/ui/quests.js`
- [Daily rewards](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/daily-login.js): `scr/js/ui/daily-login.js`
- [Shop and boosts](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/shop.js): `scr/js/ui/shop.js`
- [Inventory and cases](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/inventory.js): `scr/js/ui/inventory.js`
- [Leaderboard](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/leaderboard.js): `scr/js/ui/leaderboard.js`
- [Squads](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/squads.js): `scr/js/ui/squads.js`
- [Game menus](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/menu.js): `scr/js/ui/menu.js`
- [Onboarding](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/ui/onboarding.js): `scr/js/ui/onboarding.js`

### Platform services

- [Authenticated API](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/api.js): `scr/js/api.js`
- **Game server**
- [Game configuration](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/config.js): `scr/js/config.js`
- [Wallet and top-ups](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/wallet.js): `scr/js/wallet.js`
- [Translations](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/utils/lang.js): `scr/js/utils/lang.js`
- [Backend client](https://github.com/suspect147/lucky-cubes/blob/main/scr/js/backend.js): `scr/js/backend.js`

### Other components

- **Player**

## Connections

- Player → Roll interaction: taps cube (evidence: `scr/js/game/events.js`)
- Roll interaction → Roll and rewards: invokes roll (evidence: `scr/js/game/events.js`)
- Roll and rewards → Authenticated API: requests roll
- Authenticated API → Game server: sends requests (evidence: `scr/js/api.js`)
- Game server → Authenticated API: returns state (evidence: `scr/js/api.js`)
- Roll and rewards → Cube animations: loads animations
- Cube animations → TGS skin assets: fetches TGS (evidence: `scr/js/game/loader.js`)
- Game configuration → Cube animations: configures assets (evidence: `scr/js/game/loader.js`)
- Roll and rewards → XP and levels: awards XP (evidence: `README.md`)
- Roll and rewards → Rainbow Mode: triggers mode (evidence: `README.md`)
- Player → Quests: views goals
- Player → Daily rewards: claims rewards
- Player → Shop and boosts: browses items
- Shop and boosts → Inventory and cases: updates owned skins (evidence: `scr/js/ui/shop.js`)
- Player → Inventory and cases: opens inventory
- Inventory and cases → Authenticated API: opens cases (evidence: `scr/js/ui/inventory.js`)
- Player → Leaderboard: views rankings
- Player → Squads: manages squad
- Player → Wallet and top-ups: connects wallet
- Wallet and top-ups → Authenticated API: submits donation (evidence: `scr/js/wallet.js`)
- Player → Game menus: navigates
- Player → Onboarding: starts game
- Translations → Game menus: translates interface
- Backend client → Game server: sends requests
