# bojanognjen/quizzical architecture

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

- Interactive diagram: https://gitdiagram.com/bojanognjen/quizzical
- Repository: https://github.com/bojanognjen/quizzical

## Overview

Quizzical is a small browser-based trivia quiz. A player starts a game, the Quiz component fetches five questions from Open Trivia DB, and then displays loading, error/retry, or quiz states. Players select answers in each question, submit to see their score, and can reset to start again. Shared trivia types form an internal contract between fetching and presentation. The runtime excerpts show these main calls; the README documents static hosting, which is deployment rather than a product workflow.

Main entry points: [`components/Quiz.tsx`](https://github.com/bojanognjen/quizzical/blob/master/components/Quiz.tsx) (Quiz controller), [`components/GameScreen.tsx`](https://github.com/bojanognjen/quizzical/blob/master/components/GameScreen.tsx) (Game screen), [`api/trivia.ts`](https://github.com/bojanognjen/quizzical/blob/master/api/trivia.ts) (Trivia fetcher), [`components/StartScreen.tsx`](https://github.com/bojanognjen/quizzical/blob/master/components/StartScreen.tsx) (Start screen)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App shell"]
  node_layout["Root layout<br/>[layout.tsx]"]
  node_page["Quiz page<br/>[page.tsx]"]
  node_styles["Global styles<br/>[globals.css]"]
end

subgraph group_flow["Quiz experience"]
  node_quiz["Quiz controller<br/>[Quiz.tsx]"]
  node_start["Start screen<br/>[StartScreen.tsx]"]
  node_game["Game screen<br/>[GameScreen.tsx]"]
  node_question["Question item<br/>[Question.tsx]"]
end

subgraph group_data["Trivia data"]
  node_fetcher["Trivia fetcher<br/>[trivia.ts]"]
  node_opentdb{{"Open Trivia DB"}}
  node_types["Trivia types<br/>[types.ts]"]
end

node_player(("Player"))

node_layout -->|"imports"| node_styles
node_page -->|"renders"| node_quiz
node_player -->|"starts quiz"| node_start
node_quiz -->|"renders"| node_start
node_start -->|"calls start"| node_quiz
node_quiz -->|"fetches questions"| node_fetcher
node_fetcher -->|"requests questions"| node_opentdb
node_quiz -->|"renders"| node_game
node_game -->|"renders questions"| node_question
node_game -->|"calls reset"| node_quiz
node_fetcher -->|"uses response type"| node_types
node_game -->|"uses response type"| node_types
node_question -->|"uses question type"| node_types

click node_layout "https://github.com/bojanognjen/quizzical/blob/master/app/layout.tsx"
click node_page "https://github.com/bojanognjen/quizzical/blob/master/app/page.tsx"
click node_quiz "https://github.com/bojanognjen/quizzical/blob/master/components/Quiz.tsx"
click node_start "https://github.com/bojanognjen/quizzical/blob/master/components/StartScreen.tsx"
click node_game "https://github.com/bojanognjen/quizzical/blob/master/components/GameScreen.tsx"
click node_question "https://github.com/bojanognjen/quizzical/blob/master/components/Question.tsx"
click node_fetcher "https://github.com/bojanognjen/quizzical/blob/master/api/trivia.ts"
click node_types "https://github.com/bojanognjen/quizzical/blob/master/types.ts"
click node_styles "https://github.com/bojanognjen/quizzical/blob/master/app/globals.css"

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_layout,node_page,node_styles toneBlue
class node_quiz,node_start,node_game,node_question toneAmber
class node_fetcher,node_opentdb,node_types toneMint
class node_player toneIndigo
```

## Components

### App shell

- [Root layout](https://github.com/bojanognjen/quizzical/blob/master/app/layout.tsx): `app/layout.tsx`
- [Quiz page](https://github.com/bojanognjen/quizzical/blob/master/app/page.tsx): `app/page.tsx`
- [Global styles](https://github.com/bojanognjen/quizzical/blob/master/app/globals.css): `app/globals.css`

### Quiz experience

- [Quiz controller](https://github.com/bojanognjen/quizzical/blob/master/components/Quiz.tsx): `components/Quiz.tsx`
- [Start screen](https://github.com/bojanognjen/quizzical/blob/master/components/StartScreen.tsx): `components/StartScreen.tsx`
- [Game screen](https://github.com/bojanognjen/quizzical/blob/master/components/GameScreen.tsx): `components/GameScreen.tsx`
- [Question item](https://github.com/bojanognjen/quizzical/blob/master/components/Question.tsx): `components/Question.tsx`

### Trivia data

- [Trivia fetcher](https://github.com/bojanognjen/quizzical/blob/master/api/trivia.ts): `api/trivia.ts`
- **Open Trivia DB**
- [Trivia types](https://github.com/bojanognjen/quizzical/blob/master/types.ts): `types.ts`

### Other components

- **Player**

## Connections

- Root layout → Global styles: imports (evidence: `app/layout.tsx`)
- Quiz page → Quiz controller: renders (evidence: `app/page.tsx`)
- Player → Start screen: starts quiz (evidence: `components/StartScreen.tsx`)
- Quiz controller → Start screen: renders (evidence: `components/Quiz.tsx`)
- Start screen → Quiz controller: calls start (evidence: `components/StartScreen.tsx`)
- Quiz controller → Trivia fetcher: fetches questions (evidence: `components/Quiz.tsx`)
- Trivia fetcher → Open Trivia DB: requests questions (evidence: `api/trivia.ts`)
- Quiz controller → Game screen: renders (evidence: `components/Quiz.tsx`)
- Game screen → Question item: renders questions (evidence: `components/GameScreen.tsx`)
- Game screen → Quiz controller: calls reset (evidence: `components/GameScreen.tsx`)
- Trivia fetcher → Trivia types: uses response type (evidence: `api/trivia.ts`)
- Game screen → Trivia types: uses response type (evidence: `components/GameScreen.tsx`)
- Question item → Trivia types: uses question type (evidence: `components/Question.tsx`)
