# thevidhipandey/what-the-word architecture

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

- Interactive diagram: https://gitdiagram.com/thevidhipandey/what-the-word
- Repository: https://github.com/thevidhipandey/what-the-word

## Overview

WhatTheWord is a client-side word-guessing game: players choose word length and difficulty, make guesses, receive per-letter feedback, and either win or see the answer before replaying. Game state, keyboard input, evaluation, and presentation live together in the home route; word lists and reveal meanings are supplied by a separate data module. The app also has a TanStack routing shell and server-side error handling. The game excerpt is partial, so internal transitions not shown there are represented as game responsibilities rather than inferred module calls.

Main entry points: [`src/routes/index.tsx`](https://github.com/thevidhipandey/what-the-word/blob/main/src/routes/index.tsx) (Game screen), [`src/routeTree.gen.ts`](https://github.com/thevidhipandey/what-the-word/blob/main/src/routeTree.gen.ts) (Route tree), [`src/server.ts`](https://github.com/thevidhipandey/what-the-word/blob/main/src/server.ts) (Server entry), [`src/routes/__root.tsx`](https://github.com/thevidhipandey/what-the-word/blob/main/src/routes/__root.tsx) (Root shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Word game"]
  node_game_route["Game screen<br/>[index.tsx]"]
  node_word_data["Word data<br/>[word-data.ts]"]
  node_game_ui["Game interface<br/>[index.tsx]"]
end

subgraph group_app["App routing"]
  node_router["Router setup<br/>[router.tsx]"]
  node_route_tree["Route tree<br/>[routeTree.gen.ts]"]
  node_root_route["Root shell<br/>[__root.tsx]"]
  node_ui_components["UI components"]
  node_mobile_hook["Mobile detection<br/>[use-mobile.tsx]"]
  node_sidebar["Sidebar<br/>[sidebar.tsx]"]
end

subgraph group_runtime["Error handling"]
  node_server["Server entry<br/>[server.ts]"]
  node_error_capture["Error capture<br/>[error-capture.ts]"]
  node_error_page["Error page<br/>[error-page.ts]"]
  node_error_reporting["Error reporting"]
end

node_player(("Player"))

node_player -->|"plays"| node_game_route
node_game_route -->|"reads lists and meanings"| node_word_data
node_game_route -->|"renders"| node_game_ui
node_router -->|"configures"| node_route_tree
node_route_tree -->|"registers"| node_root_route
node_route_tree -->|"registers"| node_game_route
node_root_route -->|"reports errors"| node_error_reporting
node_sidebar -->|"checks viewport"| node_mobile_hook
node_server -->|"consumes captured errors"| node_error_capture
node_server -->|"renders fallback"| node_error_page

click node_game_route "https://github.com/thevidhipandey/what-the-word/blob/main/src/routes/index.tsx"
click node_word_data "https://github.com/thevidhipandey/what-the-word/blob/main/src/lib/word-data.ts"
click node_game_ui "https://github.com/thevidhipandey/what-the-word/blob/main/src/routes/index.tsx"
click node_router "https://github.com/thevidhipandey/what-the-word/blob/main/src/router.tsx"
click node_route_tree "https://github.com/thevidhipandey/what-the-word/blob/main/src/routeTree.gen.ts"
click node_root_route "https://github.com/thevidhipandey/what-the-word/blob/main/src/routes/__root.tsx"
click node_ui_components "https://github.com/thevidhipandey/what-the-word/tree/main/src/components/ui"
click node_mobile_hook "https://github.com/thevidhipandey/what-the-word/blob/main/src/hooks/use-mobile.tsx"
click node_sidebar "https://github.com/thevidhipandey/what-the-word/blob/main/src/components/ui/sidebar.tsx"
click node_server "https://github.com/thevidhipandey/what-the-word/blob/main/src/server.ts"
click node_error_capture "https://github.com/thevidhipandey/what-the-word/blob/main/src/lib/error-capture.ts"
click node_error_page "https://github.com/thevidhipandey/what-the-word/blob/main/src/lib/error-page.ts"
click node_error_reporting "https://github.com/thevidhipandey/what-the-word/blob/main/src/lib/lovable-error-reporting.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_game_route,node_word_data,node_game_ui toneBlue
class node_router,node_route_tree,node_root_route,node_ui_components,node_mobile_hook,node_sidebar toneAmber
class node_server,node_error_capture,node_error_page,node_error_reporting toneMint
class node_player toneIndigo
```

## Components

### Word game

- [Game screen](https://github.com/thevidhipandey/what-the-word/blob/main/src/routes/index.tsx): `src/routes/index.tsx`
- [Word data](https://github.com/thevidhipandey/what-the-word/blob/main/src/lib/word-data.ts): `src/lib/word-data.ts`
- [Game interface](https://github.com/thevidhipandey/what-the-word/blob/main/src/routes/index.tsx): `src/routes/index.tsx`

### App routing

- [Router setup](https://github.com/thevidhipandey/what-the-word/blob/main/src/router.tsx): `src/router.tsx`
- [Route tree](https://github.com/thevidhipandey/what-the-word/blob/main/src/routeTree.gen.ts): `src/routeTree.gen.ts`
- [Root shell](https://github.com/thevidhipandey/what-the-word/blob/main/src/routes/__root.tsx): `src/routes/__root.tsx`
- [UI components](https://github.com/thevidhipandey/what-the-word/tree/main/src/components/ui): `src/components/ui`
- [Mobile detection](https://github.com/thevidhipandey/what-the-word/blob/main/src/hooks/use-mobile.tsx): `src/hooks/use-mobile.tsx`
- [Sidebar](https://github.com/thevidhipandey/what-the-word/blob/main/src/components/ui/sidebar.tsx): `src/components/ui/sidebar.tsx`

### Error handling

- [Server entry](https://github.com/thevidhipandey/what-the-word/blob/main/src/server.ts): `src/server.ts`
- [Error capture](https://github.com/thevidhipandey/what-the-word/blob/main/src/lib/error-capture.ts): `src/lib/error-capture.ts`
- [Error page](https://github.com/thevidhipandey/what-the-word/blob/main/src/lib/error-page.ts): `src/lib/error-page.ts`
- [Error reporting](https://github.com/thevidhipandey/what-the-word/blob/main/src/lib/lovable-error-reporting.ts): `src/lib/lovable-error-reporting.ts`

### Other components

- **Player**

## Connections

- Player → Game screen: plays
- Game screen → Word data: reads lists and meanings (evidence: `src/routes/index.tsx`)
- Game screen → Game interface: renders (evidence: `src/routes/index.tsx`)
- Router setup → Route tree: configures (evidence: `src/router.tsx`)
- Route tree → Root shell: registers (evidence: `src/routeTree.gen.ts`)
- Route tree → Game screen: registers (evidence: `src/routeTree.gen.ts`)
- Root shell → Error reporting: reports errors (evidence: `src/routes/__root.tsx`)
- Sidebar → Mobile detection: checks viewport (evidence: `src/components/ui/sidebar.tsx`)
- Server entry → Error capture: consumes captured errors (evidence: `src/server.ts`)
- Server entry → Error page: renders fallback (evidence: `src/server.ts`)
