# nerdies24/lernkarten architecture

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

- Interactive diagram: https://gitdiagram.com/nerdies24/lernkarten
- Repository: https://github.com/nerdies24/lernkarten

## Overview

##### Project type and purpose
- This is a single-page, client-side flashcard (Lernkarten) web application built with static assets: HTML, CSS (Bootstrap + custom), JavaScript (Bootstrap bundle + custom), and a JSON file of questions/answers.
- Purpose: Load flashcards from a JSON file, present interactive Q&A sessions in the browser, support responsive design, and allow easy content updates.

##### File structure
- Top-level:
- index.html — entry-point UI
- css/ — bootstrap.css + styles.css
- js/ — bootstrap.bundle.js + script.js
- text/ — fragen_und_antworten.json
- No backend code beyond static file serving; JSON is loaded client-side via fetch/AJAX.
- Lerngkarten_Prompt.txt is a ChatGPT prompt for generating new JSON content (out-of-band).

##### README insights
- Confirms static‐server requirement to serve JSON via HTTP.
- Describes MVC-style separation: JSON (Model), script.js (Controller), HTML/CSS (View).
- Emphasizes Bootstrap for responsive UI.

##### Main components & interactions
a. Components:
1. User’s Browser (Client)
2. Static File Server (any HTTP server)
3. Static Assets:
– index.html (HTML view template)
– css/bootstrap.css + css/styles.css (styling)
– js/bootstrap.bundle.js + js/script.js (UI logic)
– text/fragen_und_antworten.json (flashcard data model)
b. Data flows / relationships:
1. Browser → HTTP GET index.html
2. index.html → references CSS and JS → Browser GETs those assets
3. script.js on load → HTTP GET text/fragen_und_antworten.json
4. script.js parses JSON → updates DOM in index.html
5. User interactions (click “show answer”, “next card”) → script.js controls view updates
c. Architectural patterns / principles:
– Client-side MVC: Model = JSON, View = HTML/CSS, Controller = script.js
– Responsive UI via Bootstrap
– Separation of concerns: data, styling, logic in separate folders
– Static asset hosting → minimal runtime complexity
d. Key technologies:
– HTML5
– CSS3 + Bootstrap 5
– Vanilla JavaScript + Bootstrap JS bundle
– JSON for content
– Any static HTTP server (e.g. Python SimpleHTTPServer, Nginx)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Static File Server
    subgraph "Static File Server"
        Server["Static File Server"] 
    end

    %% Browser/Client
    subgraph "Browser / Client"
        subgraph "View (HTML/CSS)"
            HTML["index.html"] 
            CSS["CSS (bootstrap.css, styles.css)"]
        end
        subgraph "Controller (JS)"
            JS["script.js"]
        end
        subgraph "Model (JSON Data)"
            JSON["fragen_und_antworten.json"]
        end
    end

    %% Out-of-band Content Generation Prompt
    Prompt["Content-Generation Prompt\n(lernkarten_Prompt.txt)"]

    %% Data Flows
    Server -->|"GET index.html"| HTML
    Server -->|"GET CSS/JS assets"| CSS
    Server -->|"GET CSS/JS assets"| JS
    JS -->|"fetch JSON"| JSON
    JSON -->|"JSON data"| JS
    JS -->|"update DOM"| HTML

    %% Optional prompt (out-of-band)
    Prompt:::prompt

    %% Click Events
    click HTML "https://github.com/nerdies24/lernkarten/blob/main/index.html"
    click CSS "https://github.com/nerdies24/lernkarten/blob/main/css/styles.css"
    click JS "https://github.com/nerdies24/lernkarten/blob/main/js/script.js"
    click JSON "https://github.com/nerdies24/lernkarten/blob/main/text/fragen_und_antworten.json"
    click Prompt "https://github.com/nerdies24/lernkarten/blob/main/lernkarten_Prompt.txt"

    %% Styles
    classDef server fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef view fill:#98FB98,stroke:#333,stroke-width:1px
    classDef controller fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFFACD,stroke:#333,stroke-width:1px
    classDef prompt fill:#FFDAB9,stroke:#333,stroke-width:1px

    class Server server
    class HTML,CSS view
    class JS controller
    class JSON data
```
