# carsonmcmahan/black-jack architecture

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

- Interactive diagram: https://gitdiagram.com/carsonmcmahan/black-jack
- Repository: https://github.com/carsonmcmahan/black-jack

## Overview

Blackjack CLI is a terminal game: the player enters a name, chip balance, bets, and actions; the CLI passes those choices to Game, which manages rounds, deals cards, runs the dealer, and settles payouts. The README documents hit, stand, double down, split, fixed dealer rules, and blackjack payouts. The graph includes the game’s core domain types and shared hand logic. Relationships reflect the excerpts and README; unsampled features are not linked speculatively.

Main entry points: [`src/game/Game.ts`](https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Game.ts) (Game coordinator), [`src/index.ts`](https://github.com/carsonmcmahan/black-jack/blob/main/src/index.ts) (Terminal CLI), [`src/models/Card.model.ts`](https://github.com/carsonmcmahan/black-jack/blob/main/src/models/Card.model.ts) (Card type), [`src/game/Hand.ts`](https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Hand.ts) (Hand evaluation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_terminal["Terminal interaction"]
  node_cli["Terminal CLI<br/>[index.ts]"]
  node_colors["Terminal colors<br/>[lib.ts]"]
end

subgraph group_round["Round orchestration"]
  node_game["Game coordinator<br/>[Game.ts]"]
end

subgraph group_domain["Blackjack domain"]
  node_deck["Card deck<br/>[Deck.ts]"]
  node_player["Player hand and bets<br/>[Player.ts]"]
  node_dealer["Dealer hand<br/>[Dealer.ts]"]
  node_hand["Hand evaluation<br/>[Hand.ts]"]
  node_card["Card type<br/>[Card.model.ts]"]
  node_rank["Card ranks<br/>[Rank.model.ts]"]
  node_suit["Card suits<br/>[Suit.model.ts]"]
  node_status["Game status"]
  node_result["Round result"]
end

node_player_user(("Player"))

node_player_user -->|"provides input"| node_cli
node_cli -->|"calls game"| node_game
node_cli -->|"formats errors"| node_colors
node_game -->|"manages bets"| node_player
node_game -->|"deals cards"| node_deck
node_game -->|"runs dealer"| node_dealer
node_game -->|"tracks current hand"| node_hand
node_game -->|"formats output"| node_colors
node_game -->|"sets turn state"| node_status
node_game -->|"uses round result"| node_result
node_player -->|"extends"| node_hand
node_dealer -->|"extends"| node_hand
node_deck -->|"creates cards"| node_card
node_card -->|"uses rank"| node_rank
node_card -->|"uses suit"| node_suit

click node_cli "https://github.com/carsonmcmahan/black-jack/blob/main/src/index.ts"
click node_colors "https://github.com/carsonmcmahan/black-jack/blob/main/src/lib/lib.ts"
click node_game "https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Game.ts"
click node_deck "https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Deck.ts"
click node_player "https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Player.ts"
click node_dealer "https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Dealer.ts"
click node_hand "https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Hand.ts"
click node_card "https://github.com/carsonmcmahan/black-jack/blob/main/src/models/Card.model.ts"
click node_rank "https://github.com/carsonmcmahan/black-jack/blob/main/src/models/Rank.model.ts"
click node_suit "https://github.com/carsonmcmahan/black-jack/blob/main/src/models/Suit.model.ts"
click node_status "https://github.com/carsonmcmahan/black-jack/blob/main/src/models/GameStatus.model.ts"
click node_result "https://github.com/carsonmcmahan/black-jack/blob/main/src/models/GameResult.model.ts"

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_cli,node_colors toneBlue
class node_game toneAmber
class node_deck,node_player,node_dealer,node_hand,node_card,node_rank,node_suit,node_status,node_result toneMint
class node_player_user toneIndigo
```

## Components

### Terminal interaction

- [Terminal CLI](https://github.com/carsonmcmahan/black-jack/blob/main/src/index.ts): `src/index.ts`
- [Terminal colors](https://github.com/carsonmcmahan/black-jack/blob/main/src/lib/lib.ts): `src/lib/lib.ts`

### Round orchestration

- [Game coordinator](https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Game.ts): `src/game/Game.ts`

### Blackjack domain

- [Card deck](https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Deck.ts): `src/game/Deck.ts`
- [Player hand and bets](https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Player.ts): `src/game/Player.ts`
- [Dealer hand](https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Dealer.ts): `src/game/Dealer.ts`
- [Hand evaluation](https://github.com/carsonmcmahan/black-jack/blob/main/src/game/Hand.ts): `src/game/Hand.ts`
- [Card type](https://github.com/carsonmcmahan/black-jack/blob/main/src/models/Card.model.ts): `src/models/Card.model.ts`
- [Card ranks](https://github.com/carsonmcmahan/black-jack/blob/main/src/models/Rank.model.ts): `src/models/Rank.model.ts`
- [Card suits](https://github.com/carsonmcmahan/black-jack/blob/main/src/models/Suit.model.ts): `src/models/Suit.model.ts`
- [Game status](https://github.com/carsonmcmahan/black-jack/blob/main/src/models/GameStatus.model.ts): `src/models/GameStatus.model.ts`
- [Round result](https://github.com/carsonmcmahan/black-jack/blob/main/src/models/GameResult.model.ts): `src/models/GameResult.model.ts`

### Other components

- **Player**

## Connections

- Player → Terminal CLI: provides input (evidence: `src/index.ts`)
- Terminal CLI → Game coordinator: calls game (evidence: `src/index.ts`)
- Terminal CLI → Terminal colors: formats errors (evidence: `src/index.ts`)
- Game coordinator → Player hand and bets: manages bets (evidence: `src/game/Game.ts`)
- Game coordinator → Card deck: deals cards (evidence: `src/game/Game.ts`)
- Game coordinator → Dealer hand: runs dealer (evidence: `src/game/Game.ts`)
- Game coordinator → Hand evaluation: tracks current hand (evidence: `src/game/Game.ts`)
- Game coordinator → Terminal colors: formats output (evidence: `src/game/Game.ts`)
- Game coordinator → Game status: sets turn state (evidence: `src/game/Game.ts`)
- Game coordinator → Round result: uses round result (evidence: `src/game/Game.ts`)
- Player hand and bets → Hand evaluation: extends (evidence: `src/game/Player.ts`)
- Dealer hand → Hand evaluation: extends (evidence: `src/game/Dealer.ts`)
- Card deck → Card type: creates cards (evidence: `src/game/Deck.ts`)
- Card type → Card ranks: uses rank (evidence: `src/models/Card.model.ts`)
- Card type → Card suits: uses suit (evidence: `src/models/Card.model.ts`)
