# baltoratora/ebrightv2 architecture

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

- Interactive diagram: https://gitdiagram.com/baltoratora/ebrightv2
- Repository: https://github.com/baltoratora/ebrightv2

## Overview

baltoratora combines a daily STEM dashboard with a broad browser-game library. The main workflows are choosing a topic to view a paper and using the Thinking Mode library to open a game, play it within shared game chrome, and optionally use multiplayer rooms. The README documents fact and paper API integrations; sampled sources show several game-to-rules-module relationships and the room relay. Many game routes and integrations were not sampled, so those links are omitted rather than inferred.

Main entry points: [`app/page.tsx`](https://github.com/baltoratora/ebrightv2/blob/main/app/page.tsx) (Daily dashboard), [`components/PaperOfDay.tsx`](https://github.com/baltoratora/ebrightv2/blob/main/components/PaperOfDay.tsx) (Paper feed), [`components/GameShell.tsx`](https://github.com/baltoratora/ebrightv2/blob/main/components/GameShell.tsx) (Game chrome), [`components/TopicSelector.tsx`](https://github.com/baltoratora/ebrightv2/blob/main/components/TopicSelector.tsx) (Topic selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_daily["Daily STEM"]
  node_home["Daily dashboard<br/>[page.tsx]"]
  node_topic["Topic selection<br/>[TopicSelector.tsx]"]
  node_fact["Daily fact<br/>[FunFact.tsx]"]
  node_factapi["Fact API<br/>[fact.ts]"]
  node_paper["Paper feed<br/>[PaperOfDay.tsx]"]
  node_arxiv["arXiv client<br/>[arxiv.ts]"]
  node_topics["STEM topics<br/>[topics.ts]"]
  node_paperapi["Paper API<br/>[paper.ts]"]
end

subgraph group_library["Game discovery"]
  node_gamespage["Thinking Mode<br/>[page.tsx]"]
  node_gamelibrary["Game catalog<br/>[GameLibrary.tsx]"]
  node_gamesdata["Game catalog data<br/>[games.ts]"]
end

subgraph group_games["Game experiences"]
  node_shell["Game chrome<br/>[GameShell.tsx]"]
  node_clientgame["Client hydration<br/>[ClientGame.tsx]"]
  node_wordgame["Word games<br/>[WordGame.tsx]"]
  node_wordrules["Word rules<br/>[wordle.ts]"]
  node_battleship["Battleship<br/>[Battleship.tsx]"]
  node_battlerules["Battleship rules<br/>[battleship.ts]"]
  node_breakout["Breakout<br/>[Breakout.tsx]"]
  node_breakoutrules["Breakout rules<br/>[breakout.ts]"]
  node_frogger["Frogger<br/>[Frogger.tsx]"]
  node_froggerrules["Frogger rules<br/>[frogger.ts]"]
  node_merge["Merge Lab<br/>[MergeLab.tsx]"]
  node_mergerules["Merge rules<br/>[merge-lab.ts]"]
  node_rail["Rail Patrol<br/>[RailPatrol.tsx]"]
  node_railrules["Rail rules<br/>[rail-patrol.ts]"]
  node_rune["Rune Bastion<br/>[RuneBastion.tsx]"]
  node_runerules["Bastion rules<br/>[rune-bastion.ts]"]
  node_evolve["Evolution game<br/>[EvolveGame.tsx]"]
  node_evolvestorage["Evolution saves<br/>[storage.ts]"]
  node_saveformat["Save validation<br/>[save.ts]"]
end

subgraph group_realtime["Multiplayer"]
  node_roomhook["Room client<br/>[useRoom.ts]"]
  node_protocol["Room protocol<br/>[roomProtocol.ts]"]
  node_roomworker["Room relay<br/>[index.ts]"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens"| node_home
node_home -->|"renders"| node_topic
node_home -->|"renders"| node_fact
node_home -->|"renders"| node_paper
node_home -->|"loads default"| node_topics
node_fact -.->|"fetches"| node_factapi
node_paper -->|"uses"| node_arxiv
node_paper -.->|"fetches"| node_paperapi
node_topic -.->|"uses"| node_topics
node_visitor -->|"opens"| node_gamespage
node_gamespage -->|"renders"| node_gamelibrary
node_gamelibrary -->|"loads catalog"| node_gamesdata
node_visitor -.->|"plays within"| node_shell
node_shell -->|"wraps"| node_clientgame
node_shell -->|"hosts"| node_wordgame
node_wordgame -->|"uses"| node_wordrules
node_battleship -->|"uses"| node_battlerules
node_breakout -->|"uses"| node_breakoutrules
node_frogger -->|"uses"| node_froggerrules
node_merge -->|"uses"| node_mergerules
node_rail -->|"uses"| node_railrules
node_rune -->|"uses"| node_runerules
node_evolvestorage -->|"validates saves"| node_saveformat
node_roomhook -->|"types messages"| node_protocol
node_roomworker -->|"validates messages"| node_protocol

click node_home "https://github.com/baltoratora/ebrightv2/blob/main/app/page.tsx"
click node_topic "https://github.com/baltoratora/ebrightv2/blob/main/components/TopicSelector.tsx"
click node_fact "https://github.com/baltoratora/ebrightv2/blob/main/components/FunFact.tsx"
click node_factapi "https://github.com/baltoratora/ebrightv2/blob/main/functions/api/fact.ts"
click node_paper "https://github.com/baltoratora/ebrightv2/blob/main/components/PaperOfDay.tsx"
click node_arxiv "https://github.com/baltoratora/ebrightv2/blob/main/lib/arxiv.ts"
click node_topics "https://github.com/baltoratora/ebrightv2/blob/main/lib/topics.ts"
click node_paperapi "https://github.com/baltoratora/ebrightv2/blob/main/functions/api/paper.ts"
click node_gamespage "https://github.com/baltoratora/ebrightv2/blob/main/app/thinking/page.tsx"
click node_gamelibrary "https://github.com/baltoratora/ebrightv2/blob/main/components/GameLibrary.tsx"
click node_gamesdata "https://github.com/baltoratora/ebrightv2/blob/main/lib/games.ts"
click node_shell "https://github.com/baltoratora/ebrightv2/blob/main/components/GameShell.tsx"
click node_clientgame "https://github.com/baltoratora/ebrightv2/blob/main/components/ClientGame.tsx"
click node_wordgame "https://github.com/baltoratora/ebrightv2/blob/main/components/WordGame.tsx"
click node_wordrules "https://github.com/baltoratora/ebrightv2/blob/main/lib/wordle.ts"
click node_battleship "https://github.com/baltoratora/ebrightv2/blob/main/components/Battleship.tsx"
click node_battlerules "https://github.com/baltoratora/ebrightv2/blob/main/lib/battleship.ts"
click node_breakout "https://github.com/baltoratora/ebrightv2/blob/main/components/Breakout.tsx"
click node_breakoutrules "https://github.com/baltoratora/ebrightv2/blob/main/lib/breakout.ts"
click node_frogger "https://github.com/baltoratora/ebrightv2/blob/main/components/Frogger.tsx"
click node_froggerrules "https://github.com/baltoratora/ebrightv2/blob/main/lib/frogger.ts"
click node_merge "https://github.com/baltoratora/ebrightv2/blob/main/components/merge-lab/MergeLab.tsx"
click node_mergerules "https://github.com/baltoratora/ebrightv2/blob/main/lib/merge-lab.ts"
click node_rail "https://github.com/baltoratora/ebrightv2/blob/main/components/rail-patrol/RailPatrol.tsx"
click node_railrules "https://github.com/baltoratora/ebrightv2/blob/main/lib/rail-patrol.ts"
click node_rune "https://github.com/baltoratora/ebrightv2/blob/main/components/rune-bastion/RuneBastion.tsx"
click node_runerules "https://github.com/baltoratora/ebrightv2/blob/main/lib/rune-bastion.ts"
click node_evolve "https://github.com/baltoratora/ebrightv2/blob/main/components/evolution/EvolveGame.tsx"
click node_evolvestorage "https://github.com/baltoratora/ebrightv2/blob/main/components/evolution/storage.ts"
click node_saveformat "https://github.com/baltoratora/ebrightv2/blob/main/lib/evolution/save/save.ts"
click node_roomhook "https://github.com/baltoratora/ebrightv2/blob/main/lib/useRoom.ts"
click node_protocol "https://github.com/baltoratora/ebrightv2/blob/main/lib/roomProtocol.ts"
click node_roomworker "https://github.com/baltoratora/ebrightv2/blob/main/worker/src/index.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_home,node_topic,node_fact,node_factapi,node_paper,node_arxiv,node_topics,node_paperapi toneBlue
class node_gamespage,node_gamelibrary,node_gamesdata toneAmber
class node_shell,node_clientgame,node_wordgame,node_wordrules,node_battleship,node_battlerules,node_breakout,node_breakoutrules,node_frogger,node_froggerrules,node_merge,node_mergerules,node_rail,node_railrules,node_rune,node_runerules,node_evolve,node_evolvestorage,node_saveformat toneMint
class node_roomhook,node_protocol,node_roomworker toneRose
class node_visitor toneIndigo
```

## Components

### Daily STEM

- [Daily dashboard](https://github.com/baltoratora/ebrightv2/blob/main/app/page.tsx): `app/page.tsx`
- [Topic selection](https://github.com/baltoratora/ebrightv2/blob/main/components/TopicSelector.tsx): `components/TopicSelector.tsx`
- [Daily fact](https://github.com/baltoratora/ebrightv2/blob/main/components/FunFact.tsx): `components/FunFact.tsx`
- [Fact API](https://github.com/baltoratora/ebrightv2/blob/main/functions/api/fact.ts): `functions/api/fact.ts`
- [Paper feed](https://github.com/baltoratora/ebrightv2/blob/main/components/PaperOfDay.tsx): `components/PaperOfDay.tsx`
- [arXiv client](https://github.com/baltoratora/ebrightv2/blob/main/lib/arxiv.ts): `lib/arxiv.ts`
- [STEM topics](https://github.com/baltoratora/ebrightv2/blob/main/lib/topics.ts): `lib/topics.ts`
- [Paper API](https://github.com/baltoratora/ebrightv2/blob/main/functions/api/paper.ts): `functions/api/paper.ts`

### Game discovery

- [Thinking Mode](https://github.com/baltoratora/ebrightv2/blob/main/app/thinking/page.tsx): `app/thinking/page.tsx`
- [Game catalog](https://github.com/baltoratora/ebrightv2/blob/main/components/GameLibrary.tsx): `components/GameLibrary.tsx`
- [Game catalog data](https://github.com/baltoratora/ebrightv2/blob/main/lib/games.ts): `lib/games.ts`

### Game experiences

- [Game chrome](https://github.com/baltoratora/ebrightv2/blob/main/components/GameShell.tsx): `components/GameShell.tsx`
- [Client hydration](https://github.com/baltoratora/ebrightv2/blob/main/components/ClientGame.tsx): `components/ClientGame.tsx`
- [Word games](https://github.com/baltoratora/ebrightv2/blob/main/components/WordGame.tsx): `components/WordGame.tsx`
- [Word rules](https://github.com/baltoratora/ebrightv2/blob/main/lib/wordle.ts): `lib/wordle.ts`
- [Battleship](https://github.com/baltoratora/ebrightv2/blob/main/components/Battleship.tsx): `components/Battleship.tsx`
- [Battleship rules](https://github.com/baltoratora/ebrightv2/blob/main/lib/battleship.ts): `lib/battleship.ts`
- [Breakout](https://github.com/baltoratora/ebrightv2/blob/main/components/Breakout.tsx): `components/Breakout.tsx`
- [Breakout rules](https://github.com/baltoratora/ebrightv2/blob/main/lib/breakout.ts): `lib/breakout.ts`
- [Frogger](https://github.com/baltoratora/ebrightv2/blob/main/components/Frogger.tsx): `components/Frogger.tsx`
- [Frogger rules](https://github.com/baltoratora/ebrightv2/blob/main/lib/frogger.ts): `lib/frogger.ts`
- [Merge Lab](https://github.com/baltoratora/ebrightv2/blob/main/components/merge-lab/MergeLab.tsx): `components/merge-lab/MergeLab.tsx`
- [Merge rules](https://github.com/baltoratora/ebrightv2/blob/main/lib/merge-lab.ts): `lib/merge-lab.ts`
- [Rail Patrol](https://github.com/baltoratora/ebrightv2/blob/main/components/rail-patrol/RailPatrol.tsx): `components/rail-patrol/RailPatrol.tsx`
- [Rail rules](https://github.com/baltoratora/ebrightv2/blob/main/lib/rail-patrol.ts): `lib/rail-patrol.ts`
- [Rune Bastion](https://github.com/baltoratora/ebrightv2/blob/main/components/rune-bastion/RuneBastion.tsx): `components/rune-bastion/RuneBastion.tsx`
- [Bastion rules](https://github.com/baltoratora/ebrightv2/blob/main/lib/rune-bastion.ts): `lib/rune-bastion.ts`
- [Evolution game](https://github.com/baltoratora/ebrightv2/blob/main/components/evolution/EvolveGame.tsx): `components/evolution/EvolveGame.tsx`
- [Evolution saves](https://github.com/baltoratora/ebrightv2/blob/main/components/evolution/storage.ts): `components/evolution/storage.ts`
- [Save validation](https://github.com/baltoratora/ebrightv2/blob/main/lib/evolution/save/save.ts): `lib/evolution/save/save.ts`

### Multiplayer

- [Room client](https://github.com/baltoratora/ebrightv2/blob/main/lib/useRoom.ts): `lib/useRoom.ts`
- [Room protocol](https://github.com/baltoratora/ebrightv2/blob/main/lib/roomProtocol.ts): `lib/roomProtocol.ts`
- [Room relay](https://github.com/baltoratora/ebrightv2/blob/main/worker/src/index.ts): `worker/src/index.ts`

### Other components

- **Visitor**

## Connections

- Visitor → Daily dashboard: opens (evidence: `app/page.tsx`)
- Daily dashboard → Topic selection: renders (evidence: `app/page.tsx`)
- Daily dashboard → Daily fact: renders (evidence: `app/page.tsx`)
- Daily dashboard → Paper feed: renders (evidence: `app/page.tsx`)
- Daily dashboard → STEM topics: loads default (evidence: `app/page.tsx`)
- Daily fact → Fact API: fetches
- Paper feed → arXiv client: uses (evidence: `components/PaperOfDay.tsx`)
- Paper feed → Paper API: fetches
- Topic selection → STEM topics: uses
- Visitor → Thinking Mode: opens (evidence: `app/thinking/page.tsx`)
- Thinking Mode → Game catalog: renders (evidence: `app/thinking/page.tsx`)
- Game catalog → Game catalog data: loads catalog (evidence: `components/GameLibrary.tsx`)
- Visitor → Game chrome: plays within
- Game chrome → Client hydration: wraps (evidence: `app/solitaire/page.tsx`)
- Game chrome → Word games: hosts (evidence: `app/wordle/page.tsx`)
- Word games → Word rules: uses (evidence: `components/WordGame.tsx`)
- Battleship → Battleship rules: uses (evidence: `components/Battleship.tsx`)
- Breakout → Breakout rules: uses (evidence: `components/Breakout.tsx`)
- Frogger → Frogger rules: uses (evidence: `components/Frogger.tsx`)
- Merge Lab → Merge rules: uses (evidence: `components/merge-lab/MergeLab.tsx`)
- Rail Patrol → Rail rules: uses (evidence: `components/rail-patrol/RailPatrol.tsx`)
- Rune Bastion → Bastion rules: uses (evidence: `components/rune-bastion/RuneBastion.tsx`)
- Evolution saves → Save validation: validates saves (evidence: `components/evolution/storage.ts`)
- Room client → Room protocol: types messages (evidence: `lib/useRoom.ts`)
- Room relay → Room protocol: validates messages (evidence: `worker/src/index.ts`)
