# vrosier800/kaamelott architecture

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

- Interactive diagram: https://gitdiagram.com/vrosier800/kaamelott
- Repository: https://github.com/vrosier800/kaamelott

## Overview

##### Project Type and Purpose
- This is a 100% frontend, client-side web application (“Jeu de citations Kaamelott”), written in TypeScript and SCSS.
- There is no backend or external service— all data (quotes and character list) is stored locally in a TypeScript object.
- The build output is static assets (HTML, JS, CSS) served to any static host or CDN.

##### Key Architectural Components
a. Developer Toolchain & Build Pipeline
– Node.js & npm scripts (package.json, package-lock.json)
– TypeScript compiler (tsconfig.json) → src/script.ts → dist/script.js
– SCSS compiler or bundler → src/styles.scss → dist/styles.css (+ .map)
b. Deployment Artifact
– index.html referencing dist/script.js & dist/styles.css
c. Runtime in the Browser
– Presentation (HTML structure in index.html)
– Styling (CSS from dist/styles.css)
– Application logic (JavaScript from dist/script.js)
– Local in-memory data store (TypeScript object holding quotes & characters)

##### Relationships & Data Flow
1. Developer writes TS & SCSS → runs build scripts → generates static assets in /dist
2. index.html is deployed to static web server or CDN
3. Browser requests index.html → pulls in script.js & styles.css
4. On load, script.js:
- Randomly selects a quote from the in-memory data object
- Renders quote text + answer choices into the DOM
- Listens to user clicks, updates score state, re-renders UI
5. CSS provides styling & responsive layout

##### Architectural Patterns & Principles
– SPA-style: all logic and data run in the client
– Separation of Concerns:
- src/script.ts handles data & UI logic
- src/styles.scss handles presentation
– Build-time transpilation rather than runtime preprocessing
– Static hosting: no server-side code, minimizing ops burden

##### Detail
– Capture every logical component: data storage, UI renderer, score manager
– Don’t omit the local data object – it’s the core “backend” of this quiz

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Developer Environment"
        NPM["npm scripts\n(package.json & package-lock.json)"]:::tool
        click NPM "https://github.com/vrosier800/kaamelott/blob/master/package.json"
        click NPM "https://github.com/vrosier800/kaamelott/blob/master/package-lock.json"
        TSConfig["TypeScript Config\n(tsconfig.json)"]:::tool
        click TSConfig "https://github.com/vrosier800/kaamelott/blob/master/tsconfig.json"
    end

    subgraph "Build Pipeline"
        TSCompiler["TypeScript Compiler"]:::tool
        SCSSCompiler["SCSS Compiler (npm)"]:::tool
        NPM -->|"runs"| TSCompiler
        NPM -->|"runs"| SCSSCompiler
        TSCompiler -->|"transpile"| TranspiledJS["script.js"]:::artifact
        click TranspiledJS "https://github.com/vrosier800/kaamelott/blob/master/dist/script.js"
        SCSSCompiler -->|"compile"| CSS["styles.css"]:::artifact
        click CSS "https://github.com/vrosier800/kaamelott/blob/master/dist/styles.css"
        SCSSCompiler -->|"generate map"| CSSMap["styles.css.map"]:::artifact
        click CSSMap "https://github.com/vrosier800/kaamelott/blob/master/dist/styles.css.map"
    end

    DistFolder["/dist"]:::artifact
    TranspiledJS --> DistFolder
    CSS --> DistFolder
    CSSMap --> DistFolder

    subgraph "Deployment"
        Index["index.html"]:::artifact
        click Index "https://github.com/vrosier800/kaamelott/blob/master/index.html"
        DistFolder -->|"includes"| Index
        Index -->|"deployed to"| CDN["Static CDN/Web Server"]:::host
    end

    subgraph "Browser Runtime"
        Presentation["Presentation Layer\n(DOM from index.html)"]:::runtime
        Styling["Styling\n(CSS)"]:::runtime
        Logic["App Logic\n(script.js)"]:::runtime
        DataStore["Local Data Store\n(quotes TS object)"]:::runtime
        User["User Interaction\n(clicks)"]:::runtime

        CDN -->|"serve index.html"| Presentation
        CDN -->|"serve CSS & JS"| Logic
        CDN -->|"serve CSS & JS"| Styling
        User -->|"click"| Logic
        Logic -->|"reads/writes"| DataStore
        Logic -->|"updates DOM"| Presentation
        Styling -->|"applies styles"| Presentation
    end

    classDef tool fill:#f9f,stroke:#333,stroke-width:1px
    classDef artifact fill:#ccf,stroke:#333,stroke-width:1px
    classDef runtime fill:#cfc,stroke:#333,stroke-width:1px
    classDef host fill:#fcf,stroke:#333,stroke-width:1px
```
