# benbezac/word-guess architecture

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

- Interactive diagram: https://gitdiagram.com/benbezac/word-guess
- Repository: https://github.com/benbezac/word-guess

## Overview

This is a small browser-based hangman game. The browser entry point mounts the game; the game selects a random word, accepts guesses from its letter buttons or keyboard, updates the game state, and displays the result. The letter list is bundled locally. The entry point explicitly unregisters the optional service worker, so offline caching is not enabled by this code. The graph is based on the shown source; the word-list contents were not sampled.

Main entry points: [`src/App.js`](https://github.com/benbezac/word-guess/blob/master/src/App.js) (Game state and display), [`src/index.js`](https://github.com/benbezac/word-guess/blob/master/src/index.js) (React entry point), [`src/data/wordList.json`](https://github.com/benbezac/word-guess/blob/master/src/data/wordList.json) (Word list), [`src/components/Letter.js`](https://github.com/benbezac/word-guess/blob/master/src/components/Letter.js) (Letter button)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Hangman game"]
  node_game["Game state and display<br/>[App.js]"]
  node_words["Word list<br/>[wordList.json]"]
  node_letter["Letter button<br/>[Letter.js]"]
end

subgraph group_runtime["Browser runtime"]
  node_entry["React entry point<br/>[index.js]"]
  node_worker["Service worker support<br/>[serviceWorker.js]"]
end

node_player(("Player"))

node_entry -->|"mounts"| node_game
node_game -->|"selects randomly"| node_words
node_game -->|"renders"| node_letter
node_player -->|"guesses letters"| node_game
node_entry -->|"unregisters"| node_worker

click node_entry "https://github.com/benbezac/word-guess/blob/master/src/index.js"
click node_game "https://github.com/benbezac/word-guess/blob/master/src/App.js"
click node_words "https://github.com/benbezac/word-guess/blob/master/src/data/wordList.json"
click node_letter "https://github.com/benbezac/word-guess/blob/master/src/components/Letter.js"
click node_worker "https://github.com/benbezac/word-guess/blob/master/src/serviceWorker.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_game,node_words,node_letter toneBlue
class node_entry,node_worker toneAmber
class node_player toneIndigo
```

## Components

### Hangman game

- [Game state and display](https://github.com/benbezac/word-guess/blob/master/src/App.js): `src/App.js`
- [Word list](https://github.com/benbezac/word-guess/blob/master/src/data/wordList.json): `src/data/wordList.json`
- [Letter button](https://github.com/benbezac/word-guess/blob/master/src/components/Letter.js): `src/components/Letter.js`

### Browser runtime

- [React entry point](https://github.com/benbezac/word-guess/blob/master/src/index.js): `src/index.js`
- [Service worker support](https://github.com/benbezac/word-guess/blob/master/src/serviceWorker.js): `src/serviceWorker.js`

### Other components

- **Player**

## Connections

- React entry point → Game state and display: mounts (evidence: `src/index.js`)
- Game state and display → Word list: selects randomly (evidence: `src/App.js`)
- Game state and display → Letter button: renders (evidence: `src/App.js`)
- Player → Game state and display: guesses letters (evidence: `src/App.js`)
- React entry point → Service worker support: unregisters (evidence: `src/index.js`)
