# jhon287/who-is-first architecture

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

- Interactive diagram: https://gitdiagram.com/jhon287/who-is-first
- Repository: https://github.com/jhon287/who-is-first

## Overview

Who’s First is a small browser app for entering children’s names, shuffling their order, and resetting the list. The main workflow is page use → generated name inputs → shuffle request → randomized, ranked results; Enter is also documented as a shuffle trigger. The JavaScript excerpt supports the internal calls and DOM updates shown here. The HTML and CSS were not sampled, so page wiring and click-handler details are not verified; dashed edges mark that uncertainty.

Main entry points: [`scripts/main.js`](https://github.com/jhon287/who-is-first/blob/main/scripts/main.js) (Ranked results), [`index.html`](https://github.com/jhon287/who-is-first/blob/main/index.html) (App page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["List interface"]
  node_page["App page<br/>[index.html]"]
  node_startup["App startup<br/>[main.js]"]
  node_inputs["Name inputs<br/>[main.js]"]
  node_reset["Reset list<br/>[main.js]"]
end

subgraph group_ordering["Random ordering"]
  node_trigger["Shuffle trigger<br/>[main.js]"]
  node_collect["Collect names<br/>[main.js]"]
  node_shuffle["Shuffle order<br/>[main.js]"]
  node_results["Ranked results<br/>[main.js]"]
end

node_user(("User"))

node_user -->|"opens and uses"| node_page
node_page -.->|"loads runtime"| node_startup
node_user -->|"enters names"| node_inputs
node_startup -->|"generates inputs"| node_inputs
node_user -->|"requests shuffle"| node_trigger
node_startup -->|"registers Enter"| node_trigger
node_trigger -->|"sets result"| node_results
node_results -->|"gets names"| node_collect
node_results -->|"shuffles names"| node_shuffle
node_results -->|"renders results"| node_inputs
node_user -->|"requests reset"| node_reset
node_reset -->|"regenerates list"| node_inputs

click node_page "https://github.com/jhon287/who-is-first/blob/main/index.html"
click node_startup "https://github.com/jhon287/who-is-first/blob/main/scripts/main.js"
click node_inputs "https://github.com/jhon287/who-is-first/blob/main/scripts/main.js"
click node_reset "https://github.com/jhon287/who-is-first/blob/main/scripts/main.js"
click node_trigger "https://github.com/jhon287/who-is-first/blob/main/scripts/main.js"
click node_collect "https://github.com/jhon287/who-is-first/blob/main/scripts/main.js"
click node_shuffle "https://github.com/jhon287/who-is-first/blob/main/scripts/main.js"
click node_results "https://github.com/jhon287/who-is-first/blob/main/scripts/main.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_page,node_startup,node_inputs,node_reset,node_user toneBlue
class node_trigger,node_collect,node_shuffle,node_results toneAmber
```

## Components

### List interface

- [App page](https://github.com/jhon287/who-is-first/blob/main/index.html): `index.html`
- [App startup](https://github.com/jhon287/who-is-first/blob/main/scripts/main.js): `scripts/main.js`
- [Name inputs](https://github.com/jhon287/who-is-first/blob/main/scripts/main.js): `scripts/main.js`
- [Reset list](https://github.com/jhon287/who-is-first/blob/main/scripts/main.js): `scripts/main.js`

### Random ordering

- [Shuffle trigger](https://github.com/jhon287/who-is-first/blob/main/scripts/main.js): `scripts/main.js`
- [Collect names](https://github.com/jhon287/who-is-first/blob/main/scripts/main.js): `scripts/main.js`
- [Shuffle order](https://github.com/jhon287/who-is-first/blob/main/scripts/main.js): `scripts/main.js`
- [Ranked results](https://github.com/jhon287/who-is-first/blob/main/scripts/main.js): `scripts/main.js`

### Other components

- **User**

## Connections

- User → App page: opens and uses (evidence: `README.md`)
- App page → App startup: loads runtime
- User → Name inputs: enters names (evidence: `README.md`)
- App startup → Name inputs: generates inputs (evidence: `scripts/main.js`)
- User → Shuffle trigger: requests shuffle (evidence: `README.md`)
- App startup → Shuffle trigger: registers Enter (evidence: `scripts/main.js`)
- Shuffle trigger → Ranked results: sets result (evidence: `scripts/main.js`)
- Ranked results → Collect names: gets names (evidence: `scripts/main.js`)
- Ranked results → Shuffle order: shuffles names (evidence: `scripts/main.js`)
- Ranked results → Name inputs: renders results (evidence: `scripts/main.js`)
- User → Reset list: requests reset (evidence: `README.md`)
- Reset list → Name inputs: regenerates list (evidence: `scripts/main.js`)
