# ld2000king/zbang-pwa architecture

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

- Interactive diagram: https://gitdiagram.com/ld2000king/zbang-pwa
- Repository: https://github.com/ld2000king/zbang-pwa

## Overview

Zabang Royale is a Hebrew word-game PWA with a Capacitor native shell. Players enter the main game, find words on a letter board, and earn scores and progression; separate modes include a spell-tower game and multiplayer battles. The runtime also supports themed arenas, purchases, cloud saves, and community word moderation. The excerpts show dictionary merging, multiplayer submission, and Firebase-backed features, but omit the HTML wiring and much of the main game implementation, so several relationships are intentionally left unspecified.

Main entry points: [`game.js`](https://github.com/ld2000king/zbang-pwa/blob/main/game.js) (Word game), [`multiplayer.js`](https://github.com/ld2000king/zbang-pwa/blob/main/multiplayer.js) (Battle royale), [`words.js`](https://github.com/ld2000king/zbang-pwa/blob/main/words.js) (Word packs), [`words-bulk.js`](https://github.com/ld2000king/zbang-pwa/blob/main/words-bulk.js) (Bulk word pack)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Game play"]
  node_main["Word game<br/>[game.js]"]
  node_tower["Tower mode<br/>[tower.js]"]
  node_multiplayer["Battle royale<br/>[multiplayer.js]"]
end

subgraph group_content["Game content"]
  node_dictionary["Base dictionary<br/>[game.js]"]
  node_wordpack["Word packs<br/>[words.js]"]
  node_bulkpack["Bulk word pack<br/>[words-bulk.js]"]
end

subgraph group_online["Online services"]
  node_moderation["Word moderation<br/>[admin.js]"]
  node_cloud["Cloud saves<br/>[cloudsave.js]"]
  node_config["Firebase setup<br/>[firebase-config.js]"]
end

subgraph group_presentation["Presentation and commerce"]
  node_themes["City themes<br/>[themes.js]"]
  node_avatars["Avatars<br/>[avatars.js]"]
  node_icons["SVG icons<br/>[icons.js]"]
  node_payments["In-app purchases<br/>[iap.js]"]
end

node_player(("Player"))
node_firebase[("Firebase")]

node_player -.->|"plays"| node_main
node_main -->|"merges words"| node_dictionary
node_wordpack -->|"adds words"| node_dictionary
node_bulkpack -.->|"adds words"| node_dictionary
node_main -->|"submits words"| node_multiplayer
node_multiplayer -->|"reads and writes"| node_firebase
node_moderation -->|"moderates words"| node_firebase
node_cloud -.->|"syncs saves"| node_firebase
node_config -.->|"configures access"| node_firebase

click node_main "https://github.com/ld2000king/zbang-pwa/blob/main/game.js"
click node_tower "https://github.com/ld2000king/zbang-pwa/blob/main/tower.js"
click node_multiplayer "https://github.com/ld2000king/zbang-pwa/blob/main/multiplayer.js"
click node_dictionary "https://github.com/ld2000king/zbang-pwa/blob/main/game.js"
click node_wordpack "https://github.com/ld2000king/zbang-pwa/blob/main/words.js"
click node_bulkpack "https://github.com/ld2000king/zbang-pwa/blob/main/words-bulk.js"
click node_moderation "https://github.com/ld2000king/zbang-pwa/blob/main/admin.js"
click node_cloud "https://github.com/ld2000king/zbang-pwa/blob/main/cloudsave.js"
click node_themes "https://github.com/ld2000king/zbang-pwa/blob/main/themes.js"
click node_avatars "https://github.com/ld2000king/zbang-pwa/blob/main/avatars.js"
click node_icons "https://github.com/ld2000king/zbang-pwa/blob/main/icons.js"
click node_payments "https://github.com/ld2000king/zbang-pwa/blob/main/iap.js"
click node_config "https://github.com/ld2000king/zbang-pwa/blob/main/firebase-config.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_main,node_tower,node_multiplayer toneBlue
class node_dictionary,node_wordpack,node_bulkpack,node_firebase toneAmber
class node_moderation,node_cloud,node_config toneMint
class node_themes,node_avatars,node_icons,node_payments toneRose
class node_player toneIndigo
```

## Components

### Game play

- [Word game](https://github.com/ld2000king/zbang-pwa/blob/main/game.js): `game.js`
- [Tower mode](https://github.com/ld2000king/zbang-pwa/blob/main/tower.js): `tower.js`
- [Battle royale](https://github.com/ld2000king/zbang-pwa/blob/main/multiplayer.js): `multiplayer.js`

### Game content

- [Base dictionary](https://github.com/ld2000king/zbang-pwa/blob/main/game.js): `game.js`
- [Word packs](https://github.com/ld2000king/zbang-pwa/blob/main/words.js): `words.js`
- [Bulk word pack](https://github.com/ld2000king/zbang-pwa/blob/main/words-bulk.js): `words-bulk.js`

### Online services

- [Word moderation](https://github.com/ld2000king/zbang-pwa/blob/main/admin.js): `admin.js`
- [Cloud saves](https://github.com/ld2000king/zbang-pwa/blob/main/cloudsave.js): `cloudsave.js`
- [Firebase setup](https://github.com/ld2000king/zbang-pwa/blob/main/firebase-config.js): `firebase-config.js`

### Presentation and commerce

- [City themes](https://github.com/ld2000king/zbang-pwa/blob/main/themes.js): `themes.js`
- [Avatars](https://github.com/ld2000king/zbang-pwa/blob/main/avatars.js): `avatars.js`
- [SVG icons](https://github.com/ld2000king/zbang-pwa/blob/main/icons.js): `icons.js`
- [In-app purchases](https://github.com/ld2000king/zbang-pwa/blob/main/iap.js): `iap.js`

### Other components

- **Player**
- **Firebase**

## Connections

- Player → Word game: plays
- Word game → Base dictionary: merges words (evidence: `game.js`)
- Word packs → Base dictionary: adds words (evidence: `words.js`)
- Bulk word pack → Base dictionary: adds words
- Word game → Battle royale: submits words (evidence: `multiplayer.js`)
- Battle royale → Firebase: reads and writes (evidence: `multiplayer.js`)
- Word moderation → Firebase: moderates words (evidence: `admin.js`)
- Cloud saves → Firebase: syncs saves
- Firebase setup → Firebase: configures access
