# ilhamliorahmat/yuk-main architecture

> Architecture diagram of the GitHub repository ilhamliorahmat/yuk-main, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ilhamliorahmat/yuk-main
- Repository: https://github.com/ilhamliorahmat/yuk-main

## Overview

Yuk Main is a mobile-first Indonesian multiplayer party-game hub. Players enter through the hub, authenticate or join a room, then play a selected game through a room view; room actions pass through the platform service to the PHP API, which dispatches authoritative game logic and persists room state. Shared session features cover switching, public stage view, co-seating, invites, and recaps; PWA support is a separate capability. Edge evidence is limited to the README and supplied excerpts/SOURCE INDEX references, so undocumented connections are omitted.

Main entry points: [`components/hub/YukMainAppContent.tsx`](https://github.com/ilhamliorahmat/yuk-main/blob/main/components/hub/YukMainAppContent.tsx) (App entry), [`components/hub/YukMainHub.tsx`](https://github.com/ilhamliorahmat/yuk-main/blob/main/components/hub/YukMainHub.tsx) (Game hub), [`components/games/ActiveRoomContainer.tsx`](https://github.com/ilhamliorahmat/yuk-main/blob/main/components/games/ActiveRoomContainer.tsx) (Room router), [`components/games`](https://github.com/ilhamliorahmat/yuk-main/tree/main/components/games) (Game room views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Hub &amp; identity"]
  node_appcontent["App entry"]
  node_hub["Game hub<br/>[YukMainHub.tsx]"]
  node_auth["Authentication<br/>[use-auth.tsx]"]
end

subgraph group_play["Rooms &amp; games"]
  node_registry["Game registry<br/>[registry.ts]"]
  node_roomcontainer["Room router"]
  node_roomviews["Game room views"]
  node_engines["Game rules"]
  node_sharedtypes["Game state types<br/>[types.ts]"]
end

subgraph group_session["Session features"]
  node_sessionengine["Session scoring<br/>[engine.ts]"]
  node_sessionui["Session controls"]
  node_stage["Public stage"]
end

subgraph group_platform["Platform backend"]
  node_roomhook["Room sync hook"]
  node_roomservice["Room service<br/>[room-service.ts]"]
  node_apiclient["API client<br/>[api-client.ts]"]
  node_phpapi["PHP API routes<br/>[index.php]"]
  node_dispatcher["Action dispatcher<br/>[dispatcher.php]"]
  node_phpengines["Authoritative game rules"]
  node_roomstore[("Room persistence<br/>[rooms.php]")]
end

subgraph group_runtime["Offline runtime"]
  node_pwa["PWA support<br/>[sw.js]"]
  node_offline["Offline notice"]
end

node_player(("Player"))
node_mysql[("MySQL")]

node_player -->|"opens"| node_appcontent
node_appcontent -->|"renders"| node_hub
node_appcontent -->|"uses"| node_auth
node_hub -.->|"lists games"| node_registry
node_hub -.->|"starts room"| node_roomcontainer
node_roomcontainer -.->|"routes by type"| node_roomviews
node_roomviews -.->|"uses rules"| node_engines
node_engines -->|"uses types"| node_sharedtypes
node_roomcontainer -.->|"subscribes"| node_roomhook
node_roomhook -->|"fetches snapshots"| node_apiclient
node_roomservice -->|"sends actions"| node_apiclient
node_roomservice -->|"sanitizes settings"| node_engines
node_apiclient -->|"HTTP requests"| node_phpapi
node_phpapi -->|"routes actions"| node_dispatcher
node_dispatcher -->|"dispatches rules"| node_phpengines
node_dispatcher -.->|"updates rooms"| node_roomstore
node_roomstore -.->|"reads and writes"| node_mysql
node_sessionui -.->|"records recaps"| node_sessionengine
node_roomviews -.->|"offers controls"| node_sessionui
node_stage -.->|"reads public room"| node_roomservice
node_pwa -.->|"supports offline notice"| node_offline

click node_appcontent "https://github.com/ilhamliorahmat/yuk-main/blob/main/components/hub/YukMainAppContent.tsx"
click node_hub "https://github.com/ilhamliorahmat/yuk-main/blob/main/components/hub/YukMainHub.tsx"
click node_auth "https://github.com/ilhamliorahmat/yuk-main/blob/main/hooks/use-auth.tsx"
click node_registry "https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/games/registry.ts"
click node_roomcontainer "https://github.com/ilhamliorahmat/yuk-main/blob/main/components/games/ActiveRoomContainer.tsx"
click node_roomviews "https://github.com/ilhamliorahmat/yuk-main/tree/main/components/games"
click node_engines "https://github.com/ilhamliorahmat/yuk-main/tree/main/lib/games"
click node_sharedtypes "https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/games/types.ts"
click node_sessionengine "https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/games/session/engine.ts"
click node_sessionui "https://github.com/ilhamliorahmat/yuk-main/tree/main/components/games/session"
click node_stage "https://github.com/ilhamliorahmat/yuk-main/blob/main/components/games/session/LayarPanggungView.tsx"
click node_roomhook "https://github.com/ilhamliorahmat/yuk-main/blob/main/hooks/use-room-session.ts"
click node_roomservice "https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/platform/room-service.ts"
click node_apiclient "https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/platform/api-client.ts"
click node_phpapi "https://github.com/ilhamliorahmat/yuk-main/blob/main/public/api/index.php"
click node_dispatcher "https://github.com/ilhamliorahmat/yuk-main/blob/main/public/api/lib/dispatcher.php"
click node_phpengines "https://github.com/ilhamliorahmat/yuk-main/tree/main/public/api/lib"
click node_roomstore "https://github.com/ilhamliorahmat/yuk-main/blob/main/public/api/lib/rooms.php"
click node_pwa "https://github.com/ilhamliorahmat/yuk-main/blob/main/public/sw.js"
click node_offline "https://github.com/ilhamliorahmat/yuk-main/blob/main/components/pwa/OfflineNoticeBanner.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_appcontent,node_hub,node_auth toneBlue
class node_registry,node_roomcontainer,node_roomviews,node_engines,node_sharedtypes,node_mysql toneAmber
class node_sessionengine,node_sessionui,node_stage toneMint
class node_roomhook,node_roomservice,node_apiclient,node_phpapi,node_dispatcher,node_phpengines,node_roomstore toneRose
class node_pwa,node_offline,node_player toneIndigo
```

## Components

### Hub & identity

- [App entry](https://github.com/ilhamliorahmat/yuk-main/blob/main/components/hub/YukMainAppContent.tsx): `components/hub/YukMainAppContent.tsx`
- [Game hub](https://github.com/ilhamliorahmat/yuk-main/blob/main/components/hub/YukMainHub.tsx): `components/hub/YukMainHub.tsx`
- [Authentication](https://github.com/ilhamliorahmat/yuk-main/blob/main/hooks/use-auth.tsx): `hooks/use-auth.tsx`

### Rooms & games

- [Game registry](https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/games/registry.ts): `lib/games/registry.ts`
- [Room router](https://github.com/ilhamliorahmat/yuk-main/blob/main/components/games/ActiveRoomContainer.tsx): `components/games/ActiveRoomContainer.tsx`
- [Game room views](https://github.com/ilhamliorahmat/yuk-main/tree/main/components/games): `components/games`
- [Game rules](https://github.com/ilhamliorahmat/yuk-main/tree/main/lib/games): `lib/games`
- [Game state types](https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/games/types.ts): `lib/games/types.ts`

### Session features

- [Session scoring](https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/games/session/engine.ts): `lib/games/session/engine.ts`
- [Session controls](https://github.com/ilhamliorahmat/yuk-main/tree/main/components/games/session): `components/games/session`
- [Public stage](https://github.com/ilhamliorahmat/yuk-main/blob/main/components/games/session/LayarPanggungView.tsx): `components/games/session/LayarPanggungView.tsx`

### Platform backend

- [Room sync hook](https://github.com/ilhamliorahmat/yuk-main/blob/main/hooks/use-room-session.ts): `hooks/use-room-session.ts`
- [Room service](https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/platform/room-service.ts): `lib/platform/room-service.ts`
- [API client](https://github.com/ilhamliorahmat/yuk-main/blob/main/lib/platform/api-client.ts): `lib/platform/api-client.ts`
- [PHP API routes](https://github.com/ilhamliorahmat/yuk-main/blob/main/public/api/index.php): `public/api/index.php`
- [Action dispatcher](https://github.com/ilhamliorahmat/yuk-main/blob/main/public/api/lib/dispatcher.php): `public/api/lib/dispatcher.php`
- [Authoritative game rules](https://github.com/ilhamliorahmat/yuk-main/tree/main/public/api/lib): `public/api/lib`
- [Room persistence](https://github.com/ilhamliorahmat/yuk-main/blob/main/public/api/lib/rooms.php): `public/api/lib/rooms.php`

### Offline runtime

- [PWA support](https://github.com/ilhamliorahmat/yuk-main/blob/main/public/sw.js): `public/sw.js`
- [Offline notice](https://github.com/ilhamliorahmat/yuk-main/blob/main/components/pwa/OfflineNoticeBanner.tsx): `components/pwa/OfflineNoticeBanner.tsx`

### Other components

- **Player**
- **MySQL**

## Connections

- Player → App entry: opens
- App entry → Game hub: renders (evidence: `components/hub/YukMainAppContent.tsx`)
- App entry → Authentication: uses (evidence: `components/hub/YukMainAppContent.tsx`)
- Game hub → Game registry: lists games
- Game hub → Room router: starts room
- Room router → Game room views: routes by type
- Game room views → Game rules: uses rules
- Game rules → Game state types: uses types (evidence: `lib/games/bos-kaki-lima/engine.ts`)
- Room router → Room sync hook: subscribes
- Room sync hook → API client: fetches snapshots (evidence: `hooks/use-room-session.ts`)
- Room service → API client: sends actions (evidence: `lib/platform/room-service.ts`)
- Room service → Game rules: sanitizes settings (evidence: `lib/platform/room-service.ts`)
- API client → PHP API routes: HTTP requests (evidence: `lib/platform/api-client.ts`)
- PHP API routes → Action dispatcher: routes actions (evidence: `public/api/index.php`)
- Action dispatcher → Authoritative game rules: dispatches rules
- Action dispatcher → Room persistence: updates rooms
- Room persistence → MySQL: reads and writes
- Session controls → Session scoring: records recaps
- Game room views → Session controls: offers controls
- Public stage → Room service: reads public room
- PWA support → Offline notice: supports offline notice
