# mushtariy0809/cs-482-black-jack architecture

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

- Interactive diagram: https://gitdiagram.com/mushtariy0809/cs-482-black-jack
- Repository: https://github.com/mushtariy0809/cs-482-black-jack

## Overview

This is a multiplayer blackjack web app with virtual chips, accounts, social features, administration and advertising. A player enters through the React app, authenticates or continues as a guest, browses or creates a table, and plays either a local practice hand or a server-run multiplayer round. The app also supports invitations, chat, history, profiles and friend messaging; administrators manage players, feedback and ads. The graph follows documented capabilities and indexed references; unsampled implementation details are not treated as verified call relationships.

Main entry points: [`src/App.jsx`](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/App.jsx) (App orchestration), [`backend/controllers`](https://github.com/mushtariy0809/cs-482-black-jack/tree/main/backend/controllers) (REST controllers), [`src/realtime/useTables.js`](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/realtime/useTables.js) (Realtime client), [`backend/realtime/tableStore.js`](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/tableStore.js) (Live table store)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App orchestration<br/>[App.jsx]"]
  node_authui["Account screens<br/>[AuthScreen.jsx]"]
  node_apiurl["Backend URL<br/>[apiUrl.js]"]
  node_lobby["Lobby and tables"]
  node_tableinfo["Table details<br/>[tableInfo.jsx]"]
  node_invite["Invitations<br/>[inviteLink.js]"]
  node_realtimeclient["Realtime client<br/>[useTables.js]"]
  node_sound["Sound manager<br/>[SoundManager.js]"]
end

subgraph group_play["Gameplay"]
  node_solo["Practice game<br/>[blackjack.js]"]
  node_multiplayerui["Multiplayer table UI"]
  node_rules["Shared game rules<br/>[rules.js]"]
end

subgraph group_social["Player services"]
  node_historyui["Game history screen<br/>[HistoryScreen.jsx]"]
  node_socialui["Friends and messages<br/>[FriendsScreen.jsx]"]
end

subgraph group_server["Backend services"]
  node_rest["REST controllers"]
  node_playerdata[("Player records<br/>[Player.js]")]
  node_tabledata["Live table store<br/>[tableStore.js]"]
  node_round["Round engine<br/>[round.js]"]
  node_socket["Socket handlers<br/>[socket.js]"]
  node_mongodata[("MongoDB")]
end

subgraph group_adsadmin["Ads and administration"]
  node_adminui["Admin dashboard<br/>[AdminDashboard.jsx]"]
  node_adrevenue["Ad revenue tools<br/>[AdRevenue.jsx]"]
  node_adflow["Video ad flow<br/>[useVideoAds.js]"]
  node_adpolicy["Shared ad policy<br/>[ads.js]"]
  node_adstore["Ad runtime<br/>[adStore.js]"]
end

node_player(("Player"))
node_admin(("Administrator"))

node_player -->|"uses"| node_app
node_admin -->|"manages"| node_adminui
node_app -->|"shows"| node_authui
node_app -->|"shows"| node_lobby
node_app -->|"starts"| node_solo
node_app -->|"shows"| node_multiplayerui
node_app -->|"shows"| node_adminui
node_lobby -->|"uses"| node_tableinfo
node_app -->|"reads"| node_invite
node_multiplayerui -->|"uses"| node_realtimeclient
node_realtimeclient -->|"configures"| node_apiurl
node_realtimeclient -->|"exchanges events"| node_socket
node_socket -->|"handles tables"| node_tabledata
node_tabledata -->|"uses"| node_round
node_tabledata -->|"persists"| node_mongodata
node_rest -->|"reads and writes"| node_playerdata
node_rest -.->|"persists records"| node_mongodata
node_authui -->|"uses API"| node_rest
node_socialui -->|"uses API"| node_rest
node_historyui -->|"loads history"| node_rest
node_solo -->|"uses rules"| node_rules
node_round -->|"uses rules"| node_rules
node_adminui -->|"shows"| node_adrevenue
node_adrevenue -->|"uses definitions"| node_adpolicy
node_adflow -->|"requests ads"| node_realtimeclient
node_adflow -->|"finds ads"| node_adpolicy
node_socket -->|"handles ad events"| node_adstore
node_adstore -->|"uses limits"| node_adpolicy
node_app -.->|"provides sound"| node_sound

click node_app "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/App.jsx"
click node_authui "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/screens/AuthScreen.jsx"
click node_apiurl "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/apiUrl.js"
click node_lobby "https://github.com/mushtariy0809/cs-482-black-jack/tree/main/src/lobby"
click node_tableinfo "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/lobby/tableInfo.jsx"
click node_invite "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/invite/inviteLink.js"
click node_realtimeclient "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/realtime/useTables.js"
click node_solo "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/blackjack.js"
click node_multiplayerui "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/table/MultiplayerGame.jsx"
click node_rules "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/shared/rules.js"
click node_historyui "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/screens/HistoryScreen.jsx"
click node_socialui "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/screens/FriendsScreen.jsx"
click node_rest "https://github.com/mushtariy0809/cs-482-black-jack/tree/main/backend/controllers"
click node_playerdata "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/models/Player.js"
click node_tabledata "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/tableStore.js"
click node_round "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/round.js"
click node_socket "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/socket.js"
click node_adminui "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/admin/AdminDashboard.jsx"
click node_adrevenue "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/admin/AdRevenue.jsx"
click node_adflow "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/ads/useVideoAds.js"
click node_adpolicy "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/shared/ads.js"
click node_adstore "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/adStore.js"
click node_sound "https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/sound/SoundManager.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_app,node_authui,node_apiurl,node_lobby,node_tableinfo,node_invite,node_realtimeclient,node_sound toneBlue
class node_solo,node_multiplayerui,node_rules toneAmber
class node_historyui,node_socialui toneMint
class node_rest,node_playerdata,node_tabledata,node_round,node_socket,node_mongodata toneRose
class node_adminui,node_adrevenue,node_adflow,node_adpolicy,node_adstore,node_player,node_admin toneIndigo
```

## Components

### Web client

- [App orchestration](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/App.jsx): `src/App.jsx`
- [Account screens](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/screens/AuthScreen.jsx): `src/screens/AuthScreen.jsx`
- [Backend URL](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/apiUrl.js): `src/apiUrl.js`
- [Lobby and tables](https://github.com/mushtariy0809/cs-482-black-jack/tree/main/src/lobby): `src/lobby`
- [Table details](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/lobby/tableInfo.jsx): `src/lobby/tableInfo.jsx`
- [Invitations](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/invite/inviteLink.js): `src/invite/inviteLink.js`
- [Realtime client](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/realtime/useTables.js): `src/realtime/useTables.js`
- [Sound manager](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/sound/SoundManager.js): `src/sound/SoundManager.js`

### Gameplay

- [Practice game](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/blackjack.js): `src/blackjack.js`
- [Multiplayer table UI](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/table/MultiplayerGame.jsx): `src/table/MultiplayerGame.jsx`
- [Shared game rules](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/shared/rules.js): `shared/rules.js`

### Player services

- [Game history screen](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/screens/HistoryScreen.jsx): `src/screens/HistoryScreen.jsx`
- [Friends and messages](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/screens/FriendsScreen.jsx): `src/screens/FriendsScreen.jsx`

### Backend services

- [REST controllers](https://github.com/mushtariy0809/cs-482-black-jack/tree/main/backend/controllers): `backend/controllers`
- [Player records](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/models/Player.js): `backend/models/Player.js`
- [Live table store](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/tableStore.js): `backend/realtime/tableStore.js`
- [Round engine](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/round.js): `backend/realtime/round.js`
- [Socket handlers](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/socket.js): `backend/realtime/socket.js`
- **MongoDB**

### Ads and administration

- [Admin dashboard](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/admin/AdminDashboard.jsx): `src/admin/AdminDashboard.jsx`
- [Ad revenue tools](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/admin/AdRevenue.jsx): `src/admin/AdRevenue.jsx`
- [Video ad flow](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/src/ads/useVideoAds.js): `src/ads/useVideoAds.js`
- [Shared ad policy](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/shared/ads.js): `shared/ads.js`
- [Ad runtime](https://github.com/mushtariy0809/cs-482-black-jack/blob/main/backend/realtime/adStore.js): `backend/realtime/adStore.js`

### Other components

- **Player**
- **Administrator**

## Connections

- Player → App orchestration: uses (evidence: `README.md`)
- Administrator → Admin dashboard: manages (evidence: `README.md`)
- App orchestration → Account screens: shows (evidence: `src/App.jsx`)
- App orchestration → Lobby and tables: shows (evidence: `src/App.jsx`)
- App orchestration → Practice game: starts (evidence: `src/App.jsx`)
- App orchestration → Multiplayer table UI: shows (evidence: `src/App.jsx`)
- App orchestration → Admin dashboard: shows (evidence: `src/App.jsx`)
- Lobby and tables → Table details: uses (evidence: `src/lobby/CreateTable.jsx`)
- App orchestration → Invitations: reads (evidence: `src/App.jsx`)
- Multiplayer table UI → Realtime client: uses (evidence: `src/table/MultiplayerGame.jsx`)
- Realtime client → Backend URL: configures (evidence: `src/realtime/useTables.js`)
- Realtime client → Socket handlers: exchanges events (evidence: `README.md`)
- Socket handlers → Live table store: handles tables (evidence: `backend/realtime/index.js`)
- Live table store → Round engine: uses (evidence: `backend/realtime/tableStore.js`)
- Live table store → MongoDB: persists
- REST controllers → Player records: reads and writes (evidence: `backend/controllers/adminController.js`)
- REST controllers → MongoDB: persists records
- Account screens → REST controllers: uses API (evidence: `src/screens/AuthScreen.jsx`)
- Friends and messages → REST controllers: uses API
- Game history screen → REST controllers: loads history (evidence: `src/screens/HistoryScreen.jsx`)
- Practice game → Shared game rules: uses rules (evidence: `README.md`)
- Round engine → Shared game rules: uses rules (evidence: `README.md`)
- Admin dashboard → Ad revenue tools: shows (evidence: `src/admin/AdminDashboard.jsx`)
- Ad revenue tools → Shared ad policy: uses definitions (evidence: `src/admin/AdRevenue.jsx`)
- Video ad flow → Realtime client: requests ads (evidence: `src/ads/useVideoAds.js`)
- Video ad flow → Shared ad policy: finds ads (evidence: `src/ads/useVideoAds.js`)
- Socket handlers → Ad runtime: handles ad events (evidence: `backend/realtime/index.js`)
- Ad runtime → Shared ad policy: uses limits (evidence: `shared/ads.js`)
- App orchestration → Sound manager: provides sound (evidence: `src/App.jsx`)
