# mal-xa/soratechtip.gamehub architecture

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

- Interactive diagram: https://gitdiagram.com/mal-xa/soratechtip.gamehub
- Repository: https://github.com/mal-xa/soratechtip.gamehub

## Overview

Game Haven Hub is a mobile-oriented React gaming app with a hidden account and encrypted-chat feature. Users select a game from the menu; a fixed-cell sequence in Sudoku opens the hidden area, where they can register, log in or recover an account and then chat. The graph preserves the documented games and the auth/chat stages. Edges rely on the README, sampled source, or SOURCE INDEX references; unsampled implementation details are not inferred.

Main entry points: [`src/pages/Index.tsx`](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/pages/Index.tsx) (Screen selector), [`src/lib/audio.ts`](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/lib/audio.ts) (Audio and haptics), [`src/App.tsx`](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/App.tsx) (App routes), [`src/components/games/SudokuGame.tsx`](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/SudokuGame.tsx) (Sudoku)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App navigation"]
  node_app["App routes<br/>[App.tsx]"]
  node_index["Screen selector<br/>[Index.tsx]"]
end

subgraph group_games["Games and unlock"]
  node_menu["Game menu<br/>[MainMenu.tsx]"]
  node_sudoku["Sudoku<br/>[SudokuGame.tsx]"]
  node_flappy["Flappy Bird<br/>[FlappyGame.tsx]"]
  node_game2048["2048<br/>[Game2048.tsx]"]
  node_snake["Snake<br/>[SnakeGame.tsx]"]
  node_header["Game header<br/>[GameHeader.tsx]"]
  node_unlock["Hidden unlock<br/>[HiddenUnlock.tsx]"]
end

subgraph group_secure["Accounts and chat"]
  node_authui["Account UI<br/>[HiddenAuth.tsx]"]
  node_chatui["Chat UI<br/>[HiddenChat.tsx]"]
  node_authhook["Auth state<br/>[useAuth.ts]"]
  node_chathook["Chat state<br/>[useChat.ts]"]
  node_authservice["Account service<br/>[authService.ts]"]
  node_chatservice["Message service<br/>[chatService.ts]"]
  node_encryption["Encryption"]
  node_firebaseconfig["Firebase setup<br/>[firebase.ts]"]
end

subgraph group_shared["Shared runtime"]
  node_audio["Audio and haptics<br/>[audio.ts]"]
  node_uikit["UI primitives"]
  node_toasthook["Toast state<br/>[use-toast.ts]"]
  node_toastui["Toast components<br/>[toast.tsx]"]
  node_toaster["Toast host<br/>[toaster.tsx]"]
  node_tooltip["Tooltip<br/>[tooltip.tsx]"]
end

node_user(("Player"))
node_firestore[("Firestore")]

node_user -->|"opens"| node_app
node_app -->|"routes to"| node_index
node_index -->|"shows"| node_menu
node_index -->|"selects"| node_sudoku
node_index -->|"selects"| node_flappy
node_index -->|"selects"| node_game2048
node_index -->|"selects"| node_snake
node_index -->|"shows"| node_unlock
node_sudoku -->|"unlocks on sequence"| node_unlock
node_flappy -->|"renders"| node_header
node_game2048 -->|"renders"| node_header
node_snake -->|"renders"| node_header
node_sudoku -->|"renders"| node_header
node_menu -->|"plays effects"| node_audio
node_sudoku -->|"plays effects"| node_audio
node_flappy -->|"plays effects"| node_audio
node_game2048 -->|"plays effects"| node_audio
node_snake -->|"plays effects"| node_audio
node_unlock -->|"renders"| node_authui
node_unlock -->|"renders"| node_chatui
node_authui -->|"uses"| node_authhook
node_authhook -->|"calls"| node_authservice
node_chatui -->|"uses"| node_chathook
node_chathook -->|"calls"| node_chatservice
node_authservice -->|"hashes with"| node_encryption
node_authservice -->|"uses"| node_firebaseconfig
node_chatservice -->|"encrypts and decrypts"| node_encryption
node_chatservice -->|"uses"| node_firebaseconfig
node_firebaseconfig -.->|"configures"| node_firestore
node_authservice -->|"reads and writes"| node_firestore
node_chatservice -->|"sends and subscribes"| node_firestore
node_app -->|"mounts"| node_toaster
node_app -->|"provides"| node_tooltip
node_toaster -->|"uses"| node_toasthook
node_toaster -->|"renders"| node_toastui

click node_app "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/App.tsx"
click node_index "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/pages/Index.tsx"
click node_menu "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/MainMenu.tsx"
click node_sudoku "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/SudokuGame.tsx"
click node_flappy "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/FlappyGame.tsx"
click node_game2048 "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/Game2048.tsx"
click node_snake "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/SnakeGame.tsx"
click node_header "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/GameHeader.tsx"
click node_unlock "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/components/HiddenUnlock.tsx"
click node_authui "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/components/HiddenAuth.tsx"
click node_chatui "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/components/HiddenChat.tsx"
click node_authhook "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/hooks/useAuth.ts"
click node_chathook "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/hooks/useChat.ts"
click node_authservice "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/services/authService.ts"
click node_chatservice "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/services/chatService.ts"
click node_encryption "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/services/encryptionService.ts"
click node_firebaseconfig "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/firebase/firebase.ts"
click node_audio "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/lib/audio.ts"
click node_uikit "https://github.com/mal-xa/soratechtip.gamehub/tree/main/src/components/ui"
click node_toasthook "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hooks/use-toast.ts"
click node_toastui "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/ui/toast.tsx"
click node_toaster "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/ui/toaster.tsx"
click node_tooltip "https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/ui/tooltip.tsx"

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_index toneBlue
class node_menu,node_sudoku,node_flappy,node_game2048,node_snake,node_header,node_unlock,node_firestore toneAmber
class node_authui,node_chatui,node_authhook,node_chathook,node_authservice,node_chatservice,node_encryption,node_firebaseconfig toneMint
class node_audio,node_uikit,node_toasthook,node_toastui,node_toaster,node_tooltip toneRose
class node_user toneIndigo
```

## Components

### App navigation

- [App routes](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/App.tsx): `src/App.tsx`
- [Screen selector](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/pages/Index.tsx): `src/pages/Index.tsx`

### Games and unlock

- [Game menu](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/MainMenu.tsx): `src/components/games/MainMenu.tsx`
- [Sudoku](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/SudokuGame.tsx): `src/components/games/SudokuGame.tsx`
- [Flappy Bird](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/FlappyGame.tsx): `src/components/games/FlappyGame.tsx`
- [2048](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/Game2048.tsx): `src/components/games/Game2048.tsx`
- [Snake](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/SnakeGame.tsx): `src/components/games/SnakeGame.tsx`
- [Game header](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/games/GameHeader.tsx): `src/components/games/GameHeader.tsx`
- [Hidden unlock](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/components/HiddenUnlock.tsx): `src/hidden/components/HiddenUnlock.tsx`

### Accounts and chat

- [Account UI](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/components/HiddenAuth.tsx): `src/hidden/components/HiddenAuth.tsx`
- [Chat UI](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/components/HiddenChat.tsx): `src/hidden/components/HiddenChat.tsx`
- [Auth state](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/hooks/useAuth.ts): `src/hidden/hooks/useAuth.ts`
- [Chat state](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/hooks/useChat.ts): `src/hidden/hooks/useChat.ts`
- [Account service](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/services/authService.ts): `src/hidden/services/authService.ts`
- [Message service](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/services/chatService.ts): `src/hidden/services/chatService.ts`
- [Encryption](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/services/encryptionService.ts): `src/hidden/services/encryptionService.ts`
- [Firebase setup](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hidden/firebase/firebase.ts): `src/hidden/firebase/firebase.ts`

### Shared runtime

- [Audio and haptics](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/lib/audio.ts): `src/lib/audio.ts`
- [UI primitives](https://github.com/mal-xa/soratechtip.gamehub/tree/main/src/components/ui): `src/components/ui`
- [Toast state](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/hooks/use-toast.ts): `src/hooks/use-toast.ts`
- [Toast components](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/ui/toast.tsx): `src/components/ui/toast.tsx`
- [Toast host](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/ui/toaster.tsx): `src/components/ui/toaster.tsx`
- [Tooltip](https://github.com/mal-xa/soratechtip.gamehub/blob/main/src/components/ui/tooltip.tsx): `src/components/ui/tooltip.tsx`

### Other components

- **Player**
- **Firestore**

## Connections

- Player → App routes: opens
- App routes → Screen selector: routes to (evidence: `src/App.tsx`)
- Screen selector → Game menu: shows (evidence: `src/pages/Index.tsx`)
- Screen selector → Sudoku: selects (evidence: `src/pages/Index.tsx`)
- Screen selector → Flappy Bird: selects (evidence: `src/pages/Index.tsx`)
- Screen selector → 2048: selects (evidence: `src/pages/Index.tsx`)
- Screen selector → Snake: selects (evidence: `src/pages/Index.tsx`)
- Screen selector → Hidden unlock: shows (evidence: `src/pages/Index.tsx`)
- Sudoku → Hidden unlock: unlocks on sequence (evidence: `src/components/games/SudokuGame.tsx`)
- Flappy Bird → Game header: renders (evidence: `src/components/games/FlappyGame.tsx`)
- 2048 → Game header: renders (evidence: `src/components/games/Game2048.tsx`)
- Snake → Game header: renders (evidence: `src/components/games/SnakeGame.tsx`)
- Sudoku → Game header: renders (evidence: `src/components/games/SudokuGame.tsx`)
- Game menu → Audio and haptics: plays effects (evidence: `src/components/games/MainMenu.tsx`)
- Sudoku → Audio and haptics: plays effects (evidence: `src/components/games/SudokuGame.tsx`)
- Flappy Bird → Audio and haptics: plays effects (evidence: `src/components/games/FlappyGame.tsx`)
- 2048 → Audio and haptics: plays effects (evidence: `src/components/games/Game2048.tsx`)
- Snake → Audio and haptics: plays effects (evidence: `src/components/games/SnakeGame.tsx`)
- Hidden unlock → Account UI: renders (evidence: `src/hidden/components/HiddenUnlock.tsx`)
- Hidden unlock → Chat UI: renders (evidence: `src/hidden/components/HiddenUnlock.tsx`)
- Account UI → Auth state: uses (evidence: `src/hidden/components/HiddenAuth.tsx`)
- Auth state → Account service: calls (evidence: `src/hidden/hooks/useAuth.ts`)
- Chat UI → Chat state: uses (evidence: `src/hidden/components/HiddenChat.tsx`)
- Chat state → Message service: calls (evidence: `src/hidden/hooks/useChat.ts`)
- Account service → Encryption: hashes with (evidence: `src/hidden/services/authService.ts`)
- Account service → Firebase setup: uses (evidence: `src/hidden/services/authService.ts`)
- Message service → Encryption: encrypts and decrypts (evidence: `src/hidden/services/chatService.ts`)
- Message service → Firebase setup: uses (evidence: `src/hidden/services/chatService.ts`)
- Firebase setup → Firestore: configures
- Account service → Firestore: reads and writes (evidence: `src/hidden/services/authService.ts`)
- Message service → Firestore: sends and subscribes (evidence: `src/hidden/services/chatService.ts`)
- App routes → Toast host: mounts (evidence: `src/App.tsx`)
- App routes → Tooltip: provides (evidence: `src/App.tsx`)
- Toast host → Toast state: uses (evidence: `src/components/ui/toaster.tsx`)
- Toast host → Toast components: renders (evidence: `src/components/ui/toaster.tsx`)
