# redward42/word-chain architecture

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

- Interactive diagram: https://gitdiagram.com/redward42/word-chain
- Repository: https://github.com/redward42/word-chain

## Overview

Word Chain is a walk-up, single-device word game: a player guesses the hidden links in a compound-word chain until it is completed, with wrong guesses revealing letters rather than ending play. App owns round selection, scoring, reveal progression, and feedback; dedicated components present the chain, input, controls, and dialogs. The README documents in-memory shuffled-bag rounds, theme persistence, and synthesized audio. Edges reflect the sampled App and component code or explicit README behavior; unsampled implementation details are not asserted.

Main entry points: [`src/App.tsx`](https://github.com/RedWARd42/word-chain/blob/main/src/App.tsx) (Round controller), [`src/components/GuessForm.tsx`](https://github.com/RedWARd42/word-chain/blob/main/src/components/GuessForm.tsx) (Guess form), [`src/components/Header.tsx`](https://github.com/RedWARd42/word-chain/blob/main/src/components/Header.tsx) (Score and controls), [`src/components/EndModal.tsx`](https://github.com/RedWARd42/word-chain/blob/main/src/components/EndModal.tsx) (Completion modal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game runtime"]
  node_app["Round controller<br/>[App.tsx]"]
  node_state["Game state types<br/>[types.ts]"]
end

subgraph group_content["Chain content"]
  node_chains["Word chains<br/>[wordChains.ts]"]
end

subgraph group_interface["Game interface"]
  node_overview["Chain overview<br/>[ChainOverview.tsx]"]
  node_guess["Guess form<br/>[GuessForm.tsx]"]
  node_header["Score and controls<br/>[Header.tsx]"]
  node_toast["Status toast<br/>[Toast.tsx]"]
  node_endmodal["Completion modal<br/>[EndModal.tsx]"]
  node_howto["How-to modal<br/>[HowToModal.tsx]"]
  node_overlay["Modal overlay<br/>[ModalOverlay.tsx]"]
end

subgraph group_feedback["Feedback and audio"]
  node_sound["Synthesized sound<br/>[sounds.ts]"]
end

node_player(("Player"))
node_browseraudio["Web Audio API"]
node_browserstorage[("Browser local storage")]

node_player -->|"enters guesses"| node_guess
node_player -->|"starts rounds"| node_header
node_app -->|"selects from"| node_chains
node_app -->|"renders"| node_overview
node_app -->|"renders"| node_guess
node_app -->|"renders"| node_header
node_app -->|"renders"| node_toast
node_app -->|"renders"| node_endmodal
node_app -->|"renders"| node_howto
node_app -->|"uses"| node_state
node_header -->|"dispatches actions"| node_app
node_guess -->|"submits guess"| node_app
node_endmodal -->|"uses"| node_overlay
node_howto -->|"uses"| node_overlay
node_app -->|"plays feedback"| node_sound
node_sound -->|"synthesizes audio"| node_browseraudio
node_app -.->|"persists theme"| node_browserstorage

click node_app "https://github.com/RedWARd42/word-chain/blob/main/src/App.tsx"
click node_state "https://github.com/RedWARd42/word-chain/blob/main/src/components/types.ts"
click node_chains "https://github.com/RedWARd42/word-chain/blob/main/src/data/wordChains.ts"
click node_overview "https://github.com/RedWARd42/word-chain/blob/main/src/components/ChainOverview.tsx"
click node_guess "https://github.com/RedWARd42/word-chain/blob/main/src/components/GuessForm.tsx"
click node_header "https://github.com/RedWARd42/word-chain/blob/main/src/components/Header.tsx"
click node_toast "https://github.com/RedWARd42/word-chain/blob/main/src/components/Toast.tsx"
click node_endmodal "https://github.com/RedWARd42/word-chain/blob/main/src/components/EndModal.tsx"
click node_howto "https://github.com/RedWARd42/word-chain/blob/main/src/components/HowToModal.tsx"
click node_overlay "https://github.com/RedWARd42/word-chain/blob/main/src/components/ModalOverlay.tsx"
click node_sound "https://github.com/RedWARd42/word-chain/blob/main/src/sounds.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_app,node_state toneBlue
class node_chains,node_browserstorage toneAmber
class node_overview,node_guess,node_header,node_toast,node_endmodal,node_howto,node_overlay,node_browseraudio toneMint
class node_sound toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Round controller](https://github.com/RedWARd42/word-chain/blob/main/src/App.tsx): `src/App.tsx`
- [Game state types](https://github.com/RedWARd42/word-chain/blob/main/src/components/types.ts): `src/components/types.ts`

### Chain content

- [Word chains](https://github.com/RedWARd42/word-chain/blob/main/src/data/wordChains.ts): `src/data/wordChains.ts`

### Game interface

- [Chain overview](https://github.com/RedWARd42/word-chain/blob/main/src/components/ChainOverview.tsx): `src/components/ChainOverview.tsx`
- [Guess form](https://github.com/RedWARd42/word-chain/blob/main/src/components/GuessForm.tsx): `src/components/GuessForm.tsx`
- [Score and controls](https://github.com/RedWARd42/word-chain/blob/main/src/components/Header.tsx): `src/components/Header.tsx`
- [Status toast](https://github.com/RedWARd42/word-chain/blob/main/src/components/Toast.tsx): `src/components/Toast.tsx`
- [Completion modal](https://github.com/RedWARd42/word-chain/blob/main/src/components/EndModal.tsx): `src/components/EndModal.tsx`
- [How-to modal](https://github.com/RedWARd42/word-chain/blob/main/src/components/HowToModal.tsx): `src/components/HowToModal.tsx`
- [Modal overlay](https://github.com/RedWARd42/word-chain/blob/main/src/components/ModalOverlay.tsx): `src/components/ModalOverlay.tsx`

### Feedback and audio

- [Synthesized sound](https://github.com/RedWARd42/word-chain/blob/main/src/sounds.ts): `src/sounds.ts`

### Other components

- **Player**
- **Web Audio API**
- **Browser local storage**

## Connections

- Player → Guess form: enters guesses (evidence: `README.md`)
- Player → Score and controls: starts rounds (evidence: `README.md`)
- Round controller → Word chains: selects from (evidence: `src/App.tsx`)
- Round controller → Chain overview: renders (evidence: `src/App.tsx`)
- Round controller → Guess form: renders (evidence: `src/App.tsx`)
- Round controller → Score and controls: renders (evidence: `src/App.tsx`)
- Round controller → Status toast: renders (evidence: `src/App.tsx`)
- Round controller → Completion modal: renders (evidence: `src/App.tsx`)
- Round controller → How-to modal: renders (evidence: `src/App.tsx`)
- Round controller → Game state types: uses (evidence: `src/App.tsx`)
- Score and controls → Round controller: dispatches actions (evidence: `src/components/Header.tsx`)
- Guess form → Round controller: submits guess (evidence: `src/App.tsx`)
- Completion modal → Modal overlay: uses (evidence: `src/components/EndModal.tsx`)
- How-to modal → Modal overlay: uses (evidence: `src/components/HowToModal.tsx`)
- Round controller → Synthesized sound: plays feedback (evidence: `src/App.tsx`)
- Synthesized sound → Web Audio API: synthesizes audio (evidence: `src/sounds.ts`)
- Round controller → Browser local storage: persists theme (evidence: `README.md`)
