# subinkhullar/mystery-of-the-eternal-diya-rpg-game architecture

> Architecture diagram of the GitHub repository subinkhullar/mystery-of-the-eternal-diya-rpg-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game
- Repository: https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game

## Overview

Mystery of the Eternal Diya is a browser-based Diwali detective adventure and installable PWA. The player explores locations, finds evidence and fragments, solves puzzles, investigates suspects, and reaches an accusation and ending; game progress and rewards support that journey. The README also documents AI-generated content, analytics, customization, save import/export, and offline play. Most runtime behavior lives in app.js; the README establishes product capabilities, while excerpts show state persistence, Gemini key handling, and service-worker caching. Unsampled app.js sections limit verification of detailed calls between game systems.

Main entry points: [`app.js`](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js) (Game interface), [`service-worker.js`](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/service-worker.js) (Offline cache worker), [`index.html`](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/index.html) (Web app shell), [`manifest.json`](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/manifest.json) (PWA manifest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Adventure and investigation"]
  node_game_app["Game interface<br/>[app.js]"]
  node_exploration["Location exploration<br/>[app.js]"]
  node_puzzles["Escape puzzles<br/>[app.js]"]
  node_investigation["Suspect investigation<br/>[app.js]"]
  node_evidence["Evidence board<br/>[app.js]"]
  node_final_case["Accusation and endings<br/>[app.js]"]
  node_ai_content["AI content generation<br/>[app.js]"]
end

subgraph group_progress["Player progression"]
  node_state["Game state manager<br/>[app.js]"]
  node_local_storage[("Browser local storage")]
  node_rewards["Rewards and achievements<br/>[app.js]"]
  node_save_tools["Save import and export<br/>[app.js]"]
  node_analytics["Statistics dashboard<br/>[app.js]"]
end

subgraph group_experience["Player experience"]
  node_settings["Themes and settings<br/>[app.js]"]
  node_audio["Audio feedback<br/>[app.js]"]
end

subgraph group_runtime["Browser runtime"]
  node_web_shell["Web app shell<br/>[index.html]"]
  node_manifest["PWA manifest<br/>[manifest.json]"]
  node_worker["Offline cache worker<br/>[service-worker.js]"]
  node_asset_cache[("Asset cache")]
end

node_player(("Player"))
node_gemini{{"Gemini API"}}

node_player -->|"plays"| node_game_app
node_game_app -->|"explores"| node_exploration
node_game_app -->|"solves"| node_puzzles
node_game_app -->|"investigates"| node_investigation
node_game_app -->|"tracks evidence"| node_evidence
node_game_app -->|"accuses"| node_final_case
node_game_app -->|"requests content"| node_ai_content
node_ai_content -.->|"generates content"| node_gemini
node_game_app -.->|"updates state"| node_state
node_state -->|"loads and saves"| node_local_storage
node_game_app -->|"awards progress"| node_rewards
node_game_app -->|"imports and exports"| node_save_tools
node_game_app -->|"displays statistics"| node_analytics
node_game_app -->|"configures"| node_settings
node_game_app -.->|"plays feedback"| node_audio
node_web_shell -->|"hosts game"| node_game_app
node_web_shell -->|"supports installation"| node_manifest
node_worker -->|"caches assets"| node_asset_cache
node_worker -->|"serves offline"| node_web_shell
node_worker -->|"caches asset"| node_manifest

click node_game_app "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_exploration "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_puzzles "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_investigation "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_evidence "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_final_case "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_ai_content "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_state "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_rewards "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_save_tools "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_analytics "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_settings "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_audio "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js"
click node_web_shell "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/index.html"
click node_manifest "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/manifest.json"
click node_worker "https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/service-worker.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_game_app,node_exploration,node_puzzles,node_investigation,node_evidence,node_final_case,node_ai_content toneBlue
class node_state,node_local_storage,node_rewards,node_save_tools,node_analytics toneAmber
class node_settings,node_audio,node_gemini toneMint
class node_web_shell,node_manifest,node_worker,node_asset_cache toneRose
class node_player toneIndigo
```

## Components

### Adventure and investigation

- [Game interface](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [Location exploration](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [Escape puzzles](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [Suspect investigation](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [Evidence board](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [Accusation and endings](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [AI content generation](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`

### Player progression

- [Game state manager](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- **Browser local storage**
- [Rewards and achievements](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [Save import and export](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [Statistics dashboard](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`

### Player experience

- [Themes and settings](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`
- [Audio feedback](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/app.js): `app.js`

### Browser runtime

- [Web app shell](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/index.html): `index.html`
- [PWA manifest](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/manifest.json): `manifest.json`
- [Offline cache worker](https://github.com/subinkhullar/mystery-of-the-eternal-diya-rpg-game/blob/main/service-worker.js): `service-worker.js`
- **Asset cache**

### Other components

- **Player**
- **Gemini API**

## Connections

- Player → Game interface: plays (evidence: `README.md`)
- Game interface → Location exploration: explores (evidence: `README.md`)
- Game interface → Escape puzzles: solves (evidence: `README.md`)
- Game interface → Suspect investigation: investigates (evidence: `README.md`)
- Game interface → Evidence board: tracks evidence (evidence: `README.md`)
- Game interface → Accusation and endings: accuses (evidence: `README.md`)
- Game interface → AI content generation: requests content (evidence: `README.md`)
- AI content generation → Gemini API: generates content (evidence: `README.md`)
- Game interface → Game state manager: updates state (evidence: `app.js`)
- Game state manager → Browser local storage: loads and saves (evidence: `app.js`)
- Game interface → Rewards and achievements: awards progress (evidence: `README.md`)
- Game interface → Save import and export: imports and exports (evidence: `README.md`)
- Game interface → Statistics dashboard: displays statistics (evidence: `README.md`)
- Game interface → Themes and settings: configures (evidence: `README.md`)
- Game interface → Audio feedback: plays feedback (evidence: `app.js`)
- Web app shell → Game interface: hosts game (evidence: `README.md`)
- Web app shell → PWA manifest: supports installation (evidence: `README.md`)
- Offline cache worker → Asset cache: caches assets (evidence: `service-worker.js`)
- Offline cache worker → Web app shell: serves offline (evidence: `service-worker.js`)
- Offline cache worker → PWA manifest: caches asset (evidence: `service-worker.js`)
