# rodrigoaguspian/millonario-game architecture

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

- Interactive diagram: https://gitdiagram.com/rodrigoaguspian/millonario-game
- Repository: https://github.com/rodrigoaguspian/millonario-game

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with Vue.js that implements a “Who Wants to Be a Millionaire”-style quiz game.
- It has no backend service: all game logic, question data, and audio assets are bundled into the client.

##### File structure
- Top level:
- package.json, babel.config.js, vue.config.js – configuration for building a Vue SPA
- wrangler.toml – suggests optional deployment to Cloudflare Workers as a static site
- public/
- index.html – SPA entry point
- sounds/ – all audio assets for lifelines and feedback
- questions_template.csv – (unused at runtime; for authoring)
- src/
- main.js, App.vue – app bootstrap and root component
- components/ – individual UI pieces (GameScreen, QuestionDisplay, TimerDisplay, LifelineBar, etc.)
- services/audio-service.js – encapsulates playback logic for the various .mp3 files
- data/questions.js – the question bank loaded at runtime

##### README
- Standard Vue CLI instructions for serve, build, lint. No external APIs or backends mentioned.
- Confirms purely client-side; uses webpack under the hood to bundle everything.

a. Main components
- End user (player)
- Browser as runtime environment
- Vue SPA
– App.vue (root)
– GameScreen.vue (orchestrates sub-views)
– QuestionDisplay.vue, TimerDisplay.vue, PrizeScale.vue, LifelineBar.vue, OptionButton.vue
- Data layer (questions.js)
- Audio service (audio-service.js)
- Static assets (public/index.html, CSS, sounds)
- Build & deploy pipeline (npm scripts → webpack → dist → hosting or Cloudflare Worker)

b. Relationships and interactions
- Player interacts via browser UI
- App.vue loads question data into GameScreen
- GameScreen passes current question to QuestionDisplay & OptionButtons
- TimerDisplay receives tick events from GameScreen logic
- LifelineBar triggers audio cues & game-state changes via audio-service
- audio-service reads .mp3 assets and exposes play/stop methods
- npm build bundles all src/ and public/ files into a /dist folder for deployment

c. Architectural patterns & design principles
- Component-based UI (Vue) – each UI piece is a reusable component
- Service abstraction for side effects (audio playback)
- Data-driven UI – questions are loaded from a JS module
- Single responsibility per component

d. Key technologies
- Vue.js (SPA framework)
- Webpack (bundling, via Vue CLI)
- JavaScript modules (ESM)
- Cloudflare Workers (optional static-site hosting, wrangler.toml)
- npm scripts for build, serve, lint

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build & Deploy Pipeline
    subgraph "Build & Deploy Pipeline"
        direction TB
        Package["package.json"]:::pipeline
        Babel["babel.config.js"]:::pipeline
        VueCLI["vue.config.js"]:::pipeline
        NPM["npm scripts"]:::pipeline
        Webpack["webpack (bundler)"]:::pipeline
        Dist["/dist output"]:::pipeline
        Wrangler["wrangler.toml"]:::pipeline
    end

    Package -->|defines deps & scripts| NPM
    Babel -->|babel config| Webpack
    VueCLI -->|vue config| Webpack
    NPM -->|runs build| Webpack
    Webpack -->|bundles| Dist
    Dist -->|deploy via| Wrangler
    Wrangler -->|deploys to| Cloudflare

    %% Hosting Layer
    Cloudflare("Cloudflare Workers"):::host
    Cloudflare -->|HTTP GET| Browser

    %% Browser Runtime
    Browser["Browser"]:::external
    Browser -->|loads| HTML

    HTML["public/index.html"]:::asset

    %% Vue App in Browser
    subgraph "Vue SPA (Client-side)"
        direction TB
        Main["main.js"]:::service
        AppRoot["App.vue"]:::ui
        Questions["questions.js"]:::data
        AudioService["audio-service.js"]:::service

        subgraph "GameScreen & UI Components"
            direction TB
            GameScreen["GameScreen.vue"]:::ui
            QuestionDisplay["QuestionDisplay.vue"]:::ui
            OptionButton["OptionButton.vue"]:::ui
            TimerDisplay["TimerDisplay.vue"]:::ui
            PrizeScale["PrizeScale.vue"]:::ui
            LifelineBar["LifelineBar.vue"]:::ui
        end

        Sounds["/public/sounds"]:::asset
    end

    Browser -->|executes| Main
    Main -->|mounts| AppRoot
    AppRoot -->|renders| GameScreen
    AppRoot -->|imports| Questions
    AppRoot -->|injects data| GameScreen

    GameScreen -->|passes question| QuestionDisplay
    GameScreen -->|renders options| OptionButton
    GameScreen -->|tick events| TimerDisplay
    GameScreen -->|shows prize| PrizeScale
    GameScreen -->|lifeline actions| LifelineBar

    LifelineBar -->|plays audio via| AudioService
    AudioService -->|reads files from| Sounds

    Questions -->|data-driven UI| QuestionDisplay
    Questions -->|data-driven UI| OptionButton

    %% User Interaction
    Player("Player"):::external
    Player -->|interacts| Browser

    %% Click Events
    click AppRoot "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/App.vue"
    click Main "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/main.js"
    click GameScreen "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/components/GameScreen.vue"
    click QuestionDisplay "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/components/QuestionDisplay.vue"
    click OptionButton "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/components/OptionButton.vue"
    click TimerDisplay "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/components/TimerDisplay.vue"
    click PrizeScale "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/components/PrizeScale.vue"
    click LifelineBar "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/components/LifelineBar.vue"
    click AudioService "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/services/audio-service.js"
    click Questions "https://github.com/rodrigoaguspian/millonario-game/blob/main/src/data/questions.js"
    click HTML "https://github.com/rodrigoaguspian/millonario-game/blob/main/public/index.html"
    click Sounds "https://github.com/rodrigoaguspian/millonario-game/tree/main/public/sounds/"
    click Babel "https://github.com/rodrigoaguspian/millonario-game/blob/main/babel.config.js"
    click VueCLI "https://github.com/rodrigoaguspian/millonario-game/blob/main/vue.config.js"
    click Package "https://github.com/rodrigoaguspian/millonario-game/blob/main/package.json"
    click Wrangler "https://github.com/rodrigoaguspian/millonario-game/blob/main/wrangler.toml"

    %% Styles
    classDef ui fill:#a2f5a2,stroke:#333,stroke-width:1px
    classDef service fill:#a2d2f5,stroke:#333,stroke-width:1px
    classDef data fill:#f5e79e,stroke:#333,stroke-width:1px
    classDef asset fill:#f5e79e,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef pipeline fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef host fill:#cfe2f3,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#ffffff,stroke:#333,stroke-width:1px,stroke-dasharray: 2 2
```
