How ozbaya/battle_of_the_books works
Battle of the Books Trainer lets an admin configure a team-versus-robots game, while players join from phones, buzz in, and submit spoken answers; a shared screen follows the round and a scores page reports results. Separate solo practice and title/author quiz modes use the same answer-evaluation capabilities, and practice scores feed the leaderboard. The team-game runtime advances state on requests and persists it through a selectable store. Relationships for unsampled pages and routes are included only where the README or source index documents them; not all route implementations were inspected.
Main entry points: api/games Team Game API · index.ts Game Store Facade · route.ts Quiz Answer API · admin/games Admin Game API
Components 33
Team Game
- Game Admin
src/app/admin/page.tsx - Player Device
src/app/play/[code]/page.tsx - Game Screen
src/app/screen/[code]/page.tsx - Game Scores
src/app/scores/[code]/page.tsx - Team Game API
src/app/api/games - Admin Game API
src/app/api/admin/games - Game State Poller
src/lib/hooks/useGameState.ts - Answer Recording UI
src/components/RealRecordingPanel.tsx - Audio Recorder
src/lib/audio/recorder.ts - Game Engine
src/lib/game/engine.ts - Game Rules
src/lib/game/config.ts - Admin Authentication
src/lib/admin-auth.ts
Solo Learning
- Practice Page
src/app/practice/page.tsx - Practice Answer API
src/app/api/practice/answer/route.ts - Practice Question API
src/app/api/practice/questions/route.ts - Title And Author Quiz
src/app/quiz/page.tsx - Quiz Answer API
src/app/api/quiz/answer/route.ts - Quiz Bank
src/lib/quiz.ts
Questions And Judging
- Question Sets
src/lib/questions.ts - Speech Transcription
src/lib/ai/transcribe.ts - Answer Judge
src/lib/ai/judge.ts - Answer Scoring
src/lib/game/scoring.ts
State And Results
- Game Store Facade
src/lib/store/index.ts - Memory Store
src/lib/store/memory.ts - Redis Store
src/lib/store/redis.ts - Leaderboard
src/lib/leaderboard.ts - Leaderboard API
src/app/api/leaderboard/route.ts - Usage Records
src/lib/usage.ts - Usage API
src/app/api/usage/log/route.ts
Other components
- Game Administrator
- Players
- OpenAI Services
- Upstash Redis
Connections 44
- Game Administrator → Game Admin: configures
README.md - Game Admin → Admin Game API: creates games
README.md - Admin Game API → Admin Authentication: checks access
src/app/api/admin/games/route.ts - Admin Game API → Question Sets: selects set
src/app/api/admin/games/route.ts - Admin Game API → Game Engine: creates state
src/app/api/admin/games/route.ts - Admin Game API → Game Store Facade: saves game
src/app/api/admin/games/route.ts - Players → Player Device: joins game
README.md - Player Device → Team Game API: submits actions
README.md - Player Device → Game State Poller: polls state
src/lib/hooks/useGameState.ts - Game State Poller → Team Game API: requests state
src/lib/hooks/useGameState.ts - Player Device → Answer Recording UI: records answer
README.md - Answer Recording UI → Audio Recorder: captures audio
src/components/RealRecordingPanel.tsx - Team Game API → Game Store Facade: updates game
src/app/api/games/[code]/answer/route.ts - Game Store Facade → Game Engine: advances state
src/lib/store/index.ts - Game Store Facade → Memory Store: uses fallback
src/lib/store/index.ts - Game Store Facade → Redis Store: selects store
src/lib/store/index.ts - Redis Store → Upstash Redis: persists state
README.md - Team Game API → Speech Transcription: transcribes audio
src/app/api/games/[code]/answer/route.ts - Team Game API → Answer Judge: judges transcript
src/app/api/games/[code]/answer/route.ts - Team Game API → Question Sets: loads questions
src/app/api/games/[code]/answer/route.ts - Team Game API → Game Engine: applies judgment
src/app/api/games/[code]/answer/route.ts - Speech Transcription → OpenAI Services: requests transcript
README.md - Answer Judge → OpenAI Services: requests grading
README.md - Game Screen → Game State Poller: polls state
README.md - Game Scores → Game State Poller: polls state
README.md - Game Engine → Game Rules: uses timings
src/lib/game/engine.ts - Game Engine → Answer Scoring: scores answers
src/lib/game/engine.ts - Practice Page → Practice Question API: loads questions
README.md - Practice Page → Practice Answer API: submits answers
README.md - Practice Answer API → Question Sets: resolves question
src/app/api/practice/answer/route.ts - Practice Answer API → Speech Transcription: transcribes audio
src/app/api/practice/answer/route.ts - Practice Answer API → Answer Judge: judges answer
src/app/api/practice/answer/route.ts - Practice Answer API → Answer Scoring: scores answer
src/app/api/practice/answer/route.ts - Title And Author Quiz → Quiz Answer API: submits answers
README.md - Quiz Answer API → Quiz Bank: loads entry
src/app/api/quiz/answer/route.ts - Quiz Answer API → Question Sets: builds hint
src/app/api/quiz/answer/route.ts - Quiz Answer API → Speech Transcription: transcribes audio
src/app/api/quiz/answer/route.ts - Quiz Answer API → Answer Judge: judges answer
src/app/api/quiz/answer/route.ts - Quiz Answer API → Answer Scoring: scores answer
src/app/api/quiz/answer/route.ts - Leaderboard API → Leaderboard: loads standings
src/app/api/leaderboard/route.ts - Leaderboard → Usage Records: weights sessions
src/lib/leaderboard.ts - Leaderboard API → Game Store Facade: reads sessions
src/app/api/leaderboard/route.ts - Usage API → Usage Records: validates logs
src/app/api/usage/log/route.ts - Usage API → Game Store Facade: records sessions
src/app/api/usage/log/route.ts