# torbraw/quiz architecture

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

- Interactive diagram: https://gitdiagram.com/torbraw/quiz
- Repository: https://github.com/torbraw/quiz

## Overview

##### Core Architecture Components

a. Static Site Generation (Astro)
- This as a middle layer
- How it processes content and generates static pages
- To content sources

b. Content Management
- Questions content structure (fr/en)
- JSON data flow
- To static assets

##### Specific Implementation Details

- Rectangle: Pages and Routes
- Rounded Rectangle: Components
- Hexagon: Content (questions JSON)

Show:
- Content loading from JSON to pages
- Component composition
- Asset delivery to components
- Language switching paths

**[Browser/Client]**
- ↑
**[Static Assets] ← [Astro Static Generation] ← [Content Sources]**
- ↑                       |
- [Component Layer]              |
- ┴───────────────────────┘

Important Elements to Highlight:

##### Entry Points
- Main pages (/, /options, /history, /questions/[id])
- Language variants (/en/*)

##### Component Structure
- UI components
- Common components
- Question-specific components

##### Asset Management
- Media files (audio/video/images)
- Content files (questions JSON)

##### Build/Deploy Flow
- Static site generation
- Content processing
- Asset optimization

- Special indicators for internationalization

Keep the abstraction level appropriate by:
- Focusing on the static site architecture
- Highlighting the content management flow
- Showing clear component relationships
- Emphasizing the multilingual structure

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Browser/Client"
        Client[Web Browser]
    end

    subgraph "Frontend Layer"
        subgraph "Pages"
            MainPages["Main Pages"]:::pages
            EnRoutes["English Routes"]:::pages
            QuestionRoutes["Question Routes"]:::pages
        end

        subgraph "Components"
            UIComps["UI Components"]:::component
            CommonComps["Common Components"]:::component
            QuestionComps["Question Components"]:::component
            GameOpts["Game Options"]:::component
            HistoryTable["History Table"]:::component
            QuestionContainer["Question Container"]:::component
            LangSelect["Language Selector"]:::component
        end

        subgraph "Assets"
            AudioAssets[("Audio Files")]:::asset
            VideoAssets[("Video Files")]:::asset
            ImageAssets[("Image Files")]:::asset
        end
    end

    subgraph "Core Architecture"
        AstroGen["Astro Static Generation"]:::core
        BaseLayout["Base Layout"]:::core
        Types["Types"]:::util
        Utils["Utilities"]:::util
        UIUtils["UI Utils"]:::util
    end

    subgraph "Content Management"
        EnContent["English Content"]:::content
        FrContent["French Content"]:::content
        ContentConfig["Content Config"]:::config
        AstroConfig["Astro Config"]:::config
    end

    Client --> MainPages
    MainPages --> BaseLayout
    EnRoutes --> BaseLayout
    QuestionRoutes --> BaseLayout

    BaseLayout --> UIComps
    BaseLayout --> CommonComps
    BaseLayout --> QuestionComps

    CommonComps --> LangSelect
    QuestionComps --> QuestionContainer
    CommonComps --> GameOpts
    CommonComps --> HistoryTable

    AstroGen --> BaseLayout
    AstroGen --> ContentConfig
    AstroGen --> AstroConfig

    EnContent --> AstroGen
    FrContent --> AstroGen

    AudioAssets --> QuestionComps
    VideoAssets --> QuestionComps
    ImageAssets --> UIComps

    Utils --> CommonComps
    Types --> QuestionComps
    UIUtils --> UIComps

    %% Click Events
    click MainPages "https://github.com/Torbraw/quiz/tree/main/src/pages"
    click EnRoutes "https://github.com/Torbraw/quiz/tree/main/src/pages/en"
    click QuestionRoutes "https://github.com/Torbraw/quiz/blob/main/src/pages/questions/[id].astro"
    click UIComps "https://github.com/Torbraw/quiz/tree/main/src/components/ui"
    click CommonComps "https://github.com/Torbraw/quiz/tree/main/src/components/common"
    click QuestionComps "https://github.com/Torbraw/quiz/tree/main/src/components/questions"
    click AudioAssets "https://github.com/Torbraw/quiz/tree/main/src/assets/audios"
    click VideoAssets "https://github.com/Torbraw/quiz/tree/main/src/assets/videos"
    click ImageAssets "https://github.com/Torbraw/quiz/tree/main/src/assets/images"
    click EnContent "https://github.com/Torbraw/quiz/blob/main/src/content/questions/en/questions.json"
    click FrContent "https://github.com/Torbraw/quiz/blob/main/src/content/questions/fr/questions.json"
    click BaseLayout "https://github.com/Torbraw/quiz/blob/main/src/layouts/base-layout.astro"
    click LangSelect "https://github.com/Torbraw/quiz/blob/main/src/components/common/language-select.tsx"
    click Types "https://github.com/Torbraw/quiz/blob/main/src/lib/types.ts"
    click Utils "https://github.com/Torbraw/quiz/blob/main/src/lib/utils.ts"
    click UIUtils "https://github.com/Torbraw/quiz/blob/main/src/lib/ui.ts"
    click GameOpts "https://github.com/Torbraw/quiz/blob/main/src/components/game-options.tsx"
    click HistoryTable "https://github.com/Torbraw/quiz/blob/main/src/components/history-table.tsx"
    click QuestionContainer "https://github.com/Torbraw/quiz/blob/main/src/components/questions/question-container.tsx"
    click AstroConfig "https://github.com/Torbraw/quiz/blob/main/astro.config.mjs"
    click ContentConfig "https://github.com/Torbraw/quiz/blob/main/src/content.config.ts"

    %% Styling
    classDef pages fill:#2563eb,color:white
    classDef component fill:#3b82f6,color:white
    classDef asset fill:#60a5fa,color:white
    classDef core fill:#059669,color:white
    classDef util fill:#0d9488,color:white
    classDef content fill:#ca8a04,color:white
    classDef config fill:#b45309,color:white

    %% Legend
    subgraph Legend
        Pages["Pages"]:::pages
        Component["Components"]:::component
        Asset["Assets"]:::asset
        Core["Core Architecture"]:::core
        Util["Utilities"]:::util
        Content["Content"]:::content
        Config["Configuration"]:::config
    end
```
