# sjxchng/wordle-clone architecture

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

- Interactive diagram: https://gitdiagram.com/sjxchng/wordle-clone
- Repository: https://github.com/sjxchng/wordle-clone

## Overview

Wordle Clone is a browser-based daily word game with optional accounts and saved progress. Players enter guesses through the on-screen or physical keyboard; the React app sends guesses to FastAPI, which validates and scores them, then returns feedback for the board and keyboard. Logged-in players can restore saved games and view stats. The README documents PostgreSQL persistence and dictionary validation; the sampled backend excerpt shows scoring, daily-word selection, and the dictionary request. Backend internals are consolidated where the available excerpts do not establish finer module boundaries.

Main entry points: [`frontend/src/App.tsx`](https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/App.tsx) (Game controller), [`backend/main.py`](https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py) (Game API), [`frontend/src/Keyboard.tsx`](https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/Keyboard.tsx) (Input keyboard), [`frontend/src/Auth.tsx`](https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/Auth.tsx) (Login and register)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React game"]
  node_app["Game controller<br/>[App.tsx]"]
  node_board["Guess board<br/>[Board.tsx]"]
  node_keyboard["Input keyboard<br/>[Keyboard.tsx]"]
  node_authui["Login and register<br/>[Auth.tsx]"]
  node_browserstore["Browser game storage<br/>[App.tsx]"]
end

subgraph group_backend["Game service"]
  node_api["Game API<br/>[main.py]"]
  node_daily["Daily word<br/>[main.py]"]
  node_scoring["Guess validation and scoring<br/>[main.py]"]
end

subgraph group_identity["Accounts and persistence"]
  node_token["Token authentication<br/>[main.py]"]
  node_records["Game records and stats<br/>[main.py]"]
  node_postgres[("PostgreSQL")]
end

subgraph group_integrations["External services"]
  node_dictionary["Merriam-Webster API"]
end

node_player(("Player"))

node_player -->|"plays game"| node_app
node_app -->|"renders"| node_board
node_app -->|"renders"| node_keyboard
node_keyboard -->|"sends input"| node_app
node_player -->|"types physically"| node_app
node_app -->|"renders"| node_authui
node_authui -->|"registers and logs in"| node_api
node_app -->|"submits guesses"| node_api
node_api -->|"validates and scores"| node_scoring
node_scoring -->|"checks word"| node_dictionary
node_scoring -->|"gets answer"| node_daily
node_api -->|"returns feedback"| node_app
node_app -->|"saves guest progress"| node_browserstore
node_app -->|"restores game and stats"| node_api
node_api -->|"authenticates requests"| node_token
node_api -->|"reads and writes games"| node_records
node_records -->|"persists records"| node_postgres
node_token -.->|"looks up users"| node_postgres

click node_app "https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/App.tsx"
click node_board "https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/Board.tsx"
click node_keyboard "https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/Keyboard.tsx"
click node_authui "https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/Auth.tsx"
click node_api "https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py"
click node_daily "https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py"
click node_scoring "https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py"
click node_token "https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py"
click node_records "https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py"
click node_browserstore "https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/App.tsx"

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_board,node_keyboard,node_authui,node_browserstore toneBlue
class node_api,node_daily,node_scoring toneAmber
class node_token,node_records,node_postgres toneMint
class node_dictionary toneRose
class node_player toneIndigo
```

## Components

### React game

- [Game controller](https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Guess board](https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/Board.tsx): `frontend/src/Board.tsx`
- [Input keyboard](https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/Keyboard.tsx): `frontend/src/Keyboard.tsx`
- [Login and register](https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/Auth.tsx): `frontend/src/Auth.tsx`
- [Browser game storage](https://github.com/sjxchng/wordle-clone/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`

### Game service

- [Game API](https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py): `backend/main.py`
- [Daily word](https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py): `backend/main.py`
- [Guess validation and scoring](https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py): `backend/main.py`

### Accounts and persistence

- [Token authentication](https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py): `backend/main.py`
- [Game records and stats](https://github.com/sjxchng/wordle-clone/blob/main/backend/main.py): `backend/main.py`
- **PostgreSQL**

### External services

- **Merriam-Webster API**

### Other components

- **Player**

## Connections

- Player → Game controller: plays game (evidence: `README.md`)
- Game controller → Guess board: renders (evidence: `frontend/src/App.tsx`)
- Game controller → Input keyboard: renders (evidence: `frontend/src/App.tsx`)
- Input keyboard → Game controller: sends input (evidence: `frontend/src/App.tsx`)
- Player → Game controller: types physically (evidence: `README.md`)
- Game controller → Login and register: renders (evidence: `frontend/src/App.tsx`)
- Login and register → Game API: registers and logs in (evidence: `frontend/src/Auth.tsx`)
- Game controller → Game API: submits guesses (evidence: `frontend/src/App.tsx`)
- Game API → Guess validation and scoring: validates and scores (evidence: `backend/main.py`)
- Guess validation and scoring → Merriam-Webster API: checks word (evidence: `backend/main.py`)
- Guess validation and scoring → Daily word: gets answer (evidence: `backend/main.py`)
- Game API → Game controller: returns feedback (evidence: `frontend/src/App.tsx`)
- Game controller → Browser game storage: saves guest progress (evidence: `frontend/src/App.tsx`)
- Game controller → Game API: restores game and stats (evidence: `README.md`)
- Game API → Token authentication: authenticates requests (evidence: `backend/main.py`)
- Game API → Game records and stats: reads and writes games (evidence: `backend/main.py`)
- Game records and stats → PostgreSQL: persists records (evidence: `README.md`)
- Token authentication → PostgreSQL: looks up users
