# narimanhasni/poker-buyouts architecture

> Architecture diagram of the GitHub repository narimanhasni/poker-buyouts, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/narimanhasni/poker-buyouts
- Repository: https://github.com/narimanhasni/poker-buyouts

## Overview

Poker Settler is a browser-based tool for entering a home-game roster and chip totals, previewing a minimized payment settlement, and saving confirmed results to a shared Supabase-backed Hall of Fame. The workflow and major documented capabilities are represented, including leaderboard and session history, clearing history, sharing, and mobile interactions. The implementation is largely concentrated in `script.js`; the source excerpts are partial, so uncertain internal wiring is omitted.

Main entry points: [`script.js`](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js) (Supabase Client), [`index.html`](https://github.com/narimanhasni/poker-buyouts/blob/main/index.html) (App Shell), [`supabase_schema.sql`](https://github.com/narimanhasni/poker-buyouts/blob/main/supabase_schema.sql) (Game History Store), [`config.js`](https://github.com/narimanhasni/poker-buyouts/blob/main/config.js) (Supabase Credentials)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Game Interface"]
  node_shell["App Shell<br/>[index.html]"]
  node_styles["Responsive Styling<br/>[styles.css]"]
  node_client["App Logic<br/>[script.js]"]
end

subgraph group_settlement["Settlement Workflow"]
  node_player_entry["Player Entry<br/>[script.js]"]
  node_chip_conversion["Chip Conversion<br/>[script.js]"]
  node_net_calculation["Net Calculation<br/>[script.js]"]
  node_payment_optimizer["Payment Optimizer<br/>[script.js]"]
  node_settlement_preview["Settlement Preview<br/>[script.js]"]
  node_save_confirmation["Save Confirmation<br/>[script.js]"]
  node_sharing["Result Sharing<br/>[script.js]"]
end

subgraph group_hall["Shared Hall of Fame"]
  node_hof_load["Hall Data Loading<br/>[script.js]"]
  node_stat_cards["Stat Cards<br/>[script.js]"]
  node_leaderboard["Leaderboard<br/>[script.js]"]
  node_stats_table["SQL Stats Table<br/>[script.js]"]
  node_session_history["Session History<br/>[script.js]"]
  node_clear_history["Clear History<br/>[script.js]"]
end

subgraph group_persistence["Supabase Storage"]
  node_credentials["Supabase Credentials<br/>[config.js]"]
  node_supabase_client["Supabase Client<br/>[script.js]"]
  node_database[("Game History Store")]
end

node_crew(("Game Crew"))
node_group_chat(("Group Chat"))

node_crew -->|"opens app"| node_shell
node_shell -->|"loads logic"| node_client
node_shell -->|"applies styles"| node_styles
node_crew -->|"enters game"| node_player_entry
node_player_entry -->|"sets rate"| node_chip_conversion
node_chip_conversion -->|"converts chips"| node_net_calculation
node_net_calculation -->|"computes nets"| node_payment_optimizer
node_payment_optimizer -->|"previews transfers"| node_settlement_preview
node_crew -->|"confirms save"| node_save_confirmation
node_save_confirmation -->|"saves session"| node_supabase_client
node_supabase_client -->|"writes results"| node_database
node_credentials -->|"configures client"| node_supabase_client
node_crew -->|"requests share"| node_sharing
node_sharing -.->|"shares results"| node_group_chat
node_crew -->|"opens Hall"| node_hof_load
node_hof_load -->|"loads history"| node_supabase_client
node_supabase_client -->|"reads stats"| node_database
node_hof_load -->|"renders stats"| node_stat_cards
node_hof_load -->|"renders rankings"| node_leaderboard
node_hof_load -->|"renders table"| node_stats_table
node_hof_load -->|"renders sessions"| node_session_history
node_crew -->|"clears history"| node_clear_history
node_clear_history -->|"deletes sessions"| node_supabase_client
node_supabase_client -->|"clears records"| node_database

click node_shell "https://github.com/narimanhasni/poker-buyouts/blob/main/index.html"
click node_styles "https://github.com/narimanhasni/poker-buyouts/blob/main/styles.css"
click node_client "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_credentials "https://github.com/narimanhasni/poker-buyouts/blob/main/config.js"
click node_player_entry "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_chip_conversion "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_net_calculation "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_payment_optimizer "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_settlement_preview "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_save_confirmation "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_sharing "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_hof_load "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_stat_cards "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_leaderboard "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_stats_table "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_session_history "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_clear_history "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_supabase_client "https://github.com/narimanhasni/poker-buyouts/blob/main/script.js"
click node_database "https://github.com/narimanhasni/poker-buyouts/blob/main/supabase_schema.sql"

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_shell,node_styles,node_client toneBlue
class node_player_entry,node_chip_conversion,node_net_calculation,node_payment_optimizer,node_settlement_preview,node_save_confirmation,node_sharing toneAmber
class node_hof_load,node_stat_cards,node_leaderboard,node_stats_table,node_session_history,node_clear_history toneMint
class node_credentials,node_supabase_client,node_database toneRose
class node_crew,node_group_chat toneIndigo
```

## Components

### Game Interface

- [App Shell](https://github.com/narimanhasni/poker-buyouts/blob/main/index.html): `index.html`
- [Responsive Styling](https://github.com/narimanhasni/poker-buyouts/blob/main/styles.css): `styles.css`
- [App Logic](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`

### Settlement Workflow

- [Player Entry](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Chip Conversion](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Net Calculation](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Payment Optimizer](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Settlement Preview](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Save Confirmation](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Result Sharing](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`

### Shared Hall of Fame

- [Hall Data Loading](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Stat Cards](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Leaderboard](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [SQL Stats Table](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Session History](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Clear History](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`

### Supabase Storage

- [Supabase Credentials](https://github.com/narimanhasni/poker-buyouts/blob/main/config.js): `config.js`
- [Supabase Client](https://github.com/narimanhasni/poker-buyouts/blob/main/script.js): `script.js`
- [Game History Store](https://github.com/narimanhasni/poker-buyouts/blob/main/supabase_schema.sql): `supabase_schema.sql`

### Other components

- **Game Crew**
- **Group Chat**

## Connections

- Game Crew → App Shell: opens app
- App Shell → App Logic: loads logic
- App Shell → Responsive Styling: applies styles
- Game Crew → Player Entry: enters game
- Player Entry → Chip Conversion: sets rate
- Chip Conversion → Net Calculation: converts chips
- Net Calculation → Payment Optimizer: computes nets
- Payment Optimizer → Settlement Preview: previews transfers
- Game Crew → Save Confirmation: confirms save
- Save Confirmation → Supabase Client: saves session
- Supabase Client → Game History Store: writes results
- Supabase Credentials → Supabase Client: configures client
- Game Crew → Result Sharing: requests share
- Result Sharing → Group Chat: shares results
- Game Crew → Hall Data Loading: opens Hall
- Hall Data Loading → Supabase Client: loads history
- Supabase Client → Game History Store: reads stats
- Hall Data Loading → Stat Cards: renders stats
- Hall Data Loading → Leaderboard: renders rankings
- Hall Data Loading → SQL Stats Table: renders table
- Hall Data Loading → Session History: renders sessions
- Game Crew → Clear History: clears history
- Clear History → Supabase Client: deletes sessions
- Supabase Client → Game History Store: clears records
