# aliyan008/wordwise architecture

> Architecture diagram of the GitHub repository aliyan008/wordwise, 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/aliyan008/wordwise
- Repository: https://github.com/aliyan008/wordwise

## Overview

WordWise is a React word-guessing game with Supabase-backed accounts and results. The main user flow enters through the app’s page router, starts a game, and—when signed in—records completed games for leaderboard and profile statistics. Separate branches cover authentication and account recovery, profile/avatar management, local gameplay preferences, and FAQ content. The graph follows the sampled calls and imports; some page internals and Supabase schema details were not sampled, so those connections are omitted or documented only where the README supports them.

Main entry points: [`src/App.jsx`](https://github.com/aliyan008/wordwise/blob/main/src/App.jsx) (Page router), [`src/pages/ProfilePage.jsx`](https://github.com/aliyan008/wordwise/blob/main/src/pages/ProfilePage.jsx) (Player profile), [`src/supabaseClient.js`](https://github.com/aliyan008/wordwise/blob/main/src/supabaseClient.js) (Supabase client), [`src/pages/GamePage.jsx`](https://github.com/aliyan008/wordwise/blob/main/src/pages/GamePage.jsx) (Word guessing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App and navigation"]
  node_app["Page router<br/>[App.jsx]"]
  node_landing["Landing page<br/>[LandingPage.jsx]"]
  node_faq["FAQ page<br/>[FAQPage.jsx]"]
end

subgraph group_game["Gameplay and preferences"]
  node_settings["Game settings<br/>[SettingsPage.jsx]"]
  node_gameplay["Word guessing<br/>[GamePage.jsx]"]
  node_lives["Lives display<br/>[LivesDisplay.jsx]"]
  node_preferences["Preference controls"]
end

subgraph group_accounts["Accounts and profiles"]
  node_authpage["Authentication UI<br/>[AuthPage.jsx]"]
  node_recovery["Password recovery<br/>[RecoveryPage.jsx]"]
  node_authcontext["Auth state<br/>[AuthContext.jsx]"]
  node_authservice["Auth and profile service<br/>[authService.js]"]
  node_profile["Player profile<br/>[ProfilePage.jsx]"]
  node_avatar["Avatar cropper"]
  node_username["Username setup"]
end

subgraph group_rankings["Results and rankings"]
  node_leaderboard["Leaderboard"]
  node_supabaseclient["Supabase client<br/>[supabaseClient.js]"]
  node_backend[("Supabase backend")]
end

node_player(("Player"))

node_player -->|"uses"| node_app
node_app -->|"reads auth"| node_authcontext
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_authpage
node_app -->|"routes to"| node_settings
node_app -->|"routes to"| node_gameplay
node_app -->|"routes to"| node_leaderboard
node_app -->|"routes to"| node_faq
node_app -->|"routes to"| node_profile
node_app -->|"routes to"| node_recovery
node_app -->|"renders"| node_username
node_player -->|"browses"| node_landing
node_player -->|"plays"| node_gameplay
node_gameplay -->|"renders"| node_lives
node_player -->|"changes preferences"| node_settings
node_settings -->|"renders"| node_preferences
node_authpage -->|"calls auth"| node_authcontext
node_recovery -->|"uses auth"| node_authcontext
node_authcontext -->|"delegates auth"| node_authservice
node_authservice -->|"uses client"| node_supabaseclient
node_supabaseclient -->|"connects"| node_backend
node_gameplay -->|"records results"| node_supabaseclient
node_leaderboard -->|"loads games"| node_supabaseclient
node_leaderboard -->|"loads profiles"| node_authservice
node_profile -->|"loads statistics"| node_supabaseclient
node_profile -->|"updates account"| node_authservice
node_profile -->|"opens cropper"| node_avatar
node_player -->|"views rankings"| node_leaderboard
node_player -->|"manages account"| node_profile
node_player -->|"authenticates"| node_authpage
node_player -->|"reads help"| node_faq

click node_app "https://github.com/aliyan008/wordwise/blob/main/src/App.jsx"
click node_landing "https://github.com/aliyan008/wordwise/blob/main/src/pages/LandingPage.jsx"
click node_faq "https://github.com/aliyan008/wordwise/blob/main/src/pages/FAQPage.jsx"
click node_settings "https://github.com/aliyan008/wordwise/blob/main/src/pages/SettingsPage.jsx"
click node_gameplay "https://github.com/aliyan008/wordwise/blob/main/src/pages/GamePage.jsx"
click node_lives "https://github.com/aliyan008/wordwise/blob/main/src/components/LivesDisplay.jsx"
click node_preferences "https://github.com/aliyan008/wordwise/blob/main/src/components/DifficultySelector.jsx"
click node_authpage "https://github.com/aliyan008/wordwise/blob/main/src/pages/AuthPage.jsx"
click node_recovery "https://github.com/aliyan008/wordwise/blob/main/src/pages/RecoveryPage.jsx"
click node_authcontext "https://github.com/aliyan008/wordwise/blob/main/src/context/AuthContext.jsx"
click node_authservice "https://github.com/aliyan008/wordwise/blob/main/src/services/authService.js"
click node_profile "https://github.com/aliyan008/wordwise/blob/main/src/pages/ProfilePage.jsx"
click node_avatar "https://github.com/aliyan008/wordwise/blob/main/src/components/AvatarCropperModal.jsx"
click node_username "https://github.com/aliyan008/wordwise/blob/main/src/components/UsernameSetupDialog.jsx"
click node_leaderboard "https://github.com/aliyan008/wordwise/blob/main/src/pages/LeaderboardPage.jsx"
click node_supabaseclient "https://github.com/aliyan008/wordwise/blob/main/src/supabaseClient.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_app,node_landing,node_faq toneBlue
class node_settings,node_gameplay,node_lives,node_preferences toneAmber
class node_authpage,node_recovery,node_authcontext,node_authservice,node_profile,node_avatar,node_username toneMint
class node_leaderboard,node_supabaseclient,node_backend toneRose
class node_player toneIndigo
```

## Components

### App and navigation

- [Page router](https://github.com/aliyan008/wordwise/blob/main/src/App.jsx): `src/App.jsx`
- [Landing page](https://github.com/aliyan008/wordwise/blob/main/src/pages/LandingPage.jsx): `src/pages/LandingPage.jsx`
- [FAQ page](https://github.com/aliyan008/wordwise/blob/main/src/pages/FAQPage.jsx): `src/pages/FAQPage.jsx`

### Gameplay and preferences

- [Game settings](https://github.com/aliyan008/wordwise/blob/main/src/pages/SettingsPage.jsx): `src/pages/SettingsPage.jsx`
- [Word guessing](https://github.com/aliyan008/wordwise/blob/main/src/pages/GamePage.jsx): `src/pages/GamePage.jsx`
- [Lives display](https://github.com/aliyan008/wordwise/blob/main/src/components/LivesDisplay.jsx): `src/components/LivesDisplay.jsx`
- [Preference controls](https://github.com/aliyan008/wordwise/blob/main/src/components/DifficultySelector.jsx): `src/components/DifficultySelector.jsx`

### Accounts and profiles

- [Authentication UI](https://github.com/aliyan008/wordwise/blob/main/src/pages/AuthPage.jsx): `src/pages/AuthPage.jsx`
- [Password recovery](https://github.com/aliyan008/wordwise/blob/main/src/pages/RecoveryPage.jsx): `src/pages/RecoveryPage.jsx`
- [Auth state](https://github.com/aliyan008/wordwise/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Auth and profile service](https://github.com/aliyan008/wordwise/blob/main/src/services/authService.js): `src/services/authService.js`
- [Player profile](https://github.com/aliyan008/wordwise/blob/main/src/pages/ProfilePage.jsx): `src/pages/ProfilePage.jsx`
- [Avatar cropper](https://github.com/aliyan008/wordwise/blob/main/src/components/AvatarCropperModal.jsx): `src/components/AvatarCropperModal.jsx`
- [Username setup](https://github.com/aliyan008/wordwise/blob/main/src/components/UsernameSetupDialog.jsx): `src/components/UsernameSetupDialog.jsx`

### Results and rankings

- [Leaderboard](https://github.com/aliyan008/wordwise/blob/main/src/pages/LeaderboardPage.jsx): `src/pages/LeaderboardPage.jsx`
- [Supabase client](https://github.com/aliyan008/wordwise/blob/main/src/supabaseClient.js): `src/supabaseClient.js`
- **Supabase backend**

### Other components

- **Player**

## Connections

- Player → Page router: uses (evidence: `src/App.jsx`)
- Page router → Auth state: reads auth (evidence: `src/App.jsx`)
- Page router → Landing page: routes to (evidence: `src/App.jsx`)
- Page router → Authentication UI: routes to (evidence: `src/App.jsx`)
- Page router → Game settings: routes to (evidence: `src/App.jsx`)
- Page router → Word guessing: routes to (evidence: `src/App.jsx`)
- Page router → Leaderboard: routes to (evidence: `src/App.jsx`)
- Page router → FAQ page: routes to (evidence: `src/App.jsx`)
- Page router → Player profile: routes to (evidence: `src/App.jsx`)
- Page router → Password recovery: routes to (evidence: `src/App.jsx`)
- Page router → Username setup: renders (evidence: `src/App.jsx`)
- Player → Landing page: browses (evidence: `src/pages/LandingPage.jsx`)
- Player → Word guessing: plays (evidence: `src/pages/GamePage.jsx`)
- Word guessing → Lives display: renders (evidence: `src/pages/GamePage.jsx`)
- Player → Game settings: changes preferences (evidence: `src/pages/SettingsPage.jsx`)
- Game settings → Preference controls: renders (evidence: `src/pages/SettingsPage.jsx`)
- Authentication UI → Auth state: calls auth (evidence: `src/pages/AuthPage.jsx`)
- Password recovery → Auth state: uses auth (evidence: `src/pages/RecoveryPage.jsx`)
- Auth state → Auth and profile service: delegates auth (evidence: `src/context/AuthContext.jsx`)
- Auth and profile service → Supabase client: uses client (evidence: `src/services/authService.js`)
- Supabase client → Supabase backend: connects (evidence: `src/supabaseClient.js`)
- Word guessing → Supabase client: records results (evidence: `src/pages/GamePage.jsx`)
- Leaderboard → Supabase client: loads games (evidence: `src/pages/LeaderboardPage.jsx`)
- Leaderboard → Auth and profile service: loads profiles (evidence: `src/pages/LeaderboardPage.jsx`)
- Player profile → Supabase client: loads statistics (evidence: `src/pages/ProfilePage.jsx`)
- Player profile → Auth and profile service: updates account (evidence: `src/pages/ProfilePage.jsx`)
- Player profile → Avatar cropper: opens cropper (evidence: `src/pages/ProfilePage.jsx`)
- Player → Leaderboard: views rankings (evidence: `src/pages/LeaderboardPage.jsx`)
- Player → Player profile: manages account (evidence: `src/pages/ProfilePage.jsx`)
- Player → Authentication UI: authenticates (evidence: `src/pages/AuthPage.jsx`)
- Player → FAQ page: reads help (evidence: `src/pages/FAQPage.jsx`)
