# abdelrahman725/wordlearabic architecture

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

- Interactive diagram: https://gitdiagram.com/abdelrahman725/wordlearabic
- Repository: https://github.com/abdelrahman725/wordlearabic

## Overview

##### Project type and purpose
- This is a single-page, front-end web application: an Arabic version of the Wordle game.
- It embeds a small in-memory dictionary (nouns/adjectives only), runs entirely in the browser, and requires no server or database.

##### File structure
- index.html – the HTML entry point and UI scaffold.
- styles.scss / styles.css / styles.css.map – styling layers: a source SCSS file compiled to CSS with a source map.
- script.js – the core game logic (input handling, guess evaluation, UI updates).
- Dictionary.js – the word list data.
- README.md – project description and rules.

##### Key insights from the README
- Game rules: Arabic nouns/adjectives only, no verbs, pronouns, or diacritics.
- Front-end only: implies no API endpoints or backend services.

##### Main components
a. Presentation Layer (UI)
- index.html: defines the game board (grid of tiles), input controls, status messages.
b. Game Logic Layer
- script.js: listens for user keystrokes, controls game state, checks guesses against the dictionary.
c. Data Layer
- Dictionary.js: exports array of allowed words.
d. Browser Environment
- JavaScript engine, DOM, local storage (if used for persistence; note whether script.js stores scores or history).

##### Relationships and interactions
- On page load: index.html + styles → rendered UI.
- script.js initializes the game, loads Dictionary.js.
- On “Enter”: script.js compares guess to Dictionary.js, updates UI with feedback.
- Optional: script.js writes to localStorage for tracking past games.

##### Architectural patterns & design principles
- Model-View-Controller (MVC) style separation:
- Model = Dictionary data + game state variables.
- View = DOM elements styled by CSS.
- Controller = script.js event handlers and game rules.
- Single Responsibility: Dictionary.js for data; script.js for logic/UI glue; styles.scss for design.

##### Technologies, frameworks, libraries
- Vanilla HTML5 / CSS3 / JavaScript.
- SCSS preprocessor.
- No external frameworks (React/Vue) or build pipelines beyond SCSS compilation.

- Dependencies: which script loads which file.
- Data flow: keystrokes → logic → DOM → feedback.
- Use annotations:
- “In-memory word list” next to Dictionary.js.
- “MVC pattern” note at the overall layout.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External actor
    U["User"]:::external

    subgraph "Browser/Client"
        direction TB

        A["index.html<br/>(View Layer)"]:::presentation
        subgraph "Styles"
            direction TB
            B1["styles.scss"]:::presentation
            B2["styles.css"]:::presentation
            B3["styles.css.map"]:::presentation
        end
        C["script.js<br/>(Controller)"]:::logic
        D["Dictionary.js<br/>(Model)<br/><i>In-memory word list</i>"]:::data
        E["localStorage"]:::data
    end

    subgraph "Documentation"
        R["README.md"]:::doc
    end

    %% Load and build sequence
    A -->|loads| B2
    B1 -->|Compiled SCSS→CSS| B2
    A -->|includes| B2
    A -->|runs| C
    C -->|imports| D
    C -->|reads/writes| E

    %% User interactions
    U -->|types letters| C
    C -->|updates DOM| A

    %% Documentation link
    A -->|refer to rules| R

    %% Click Events
    click A "https://github.com/abdelrahman725/wordlearabic/blob/main/index.html"
    click B1 "https://github.com/abdelrahman725/wordlearabic/blob/main/styles.scss"
    click B2 "https://github.com/abdelrahman725/wordlearabic/blob/main/styles.css"
    click B3 "https://github.com/abdelrahman725/wordlearabic/blob/main/styles.css.map"
    click C "https://github.com/abdelrahman725/wordlearabic/blob/main/script.js"
    click D "https://github.com/abdelrahman725/wordlearabic/blob/main/Dictionary.js"
    click R "https://github.com/abdelrahman725/wordlearabic/blob/main/README.md"

    %% Styling classes
    classDef presentation fill:#E0F7FA,stroke:#006064,color:#006064
    classDef logic fill:#E8F5E9,stroke:#1B5E20,color:#1B5E20
    classDef data fill:#FFF3E0,stroke:#E65100,color:#E65100
    classDef external fill:#F3E5F5,stroke:#4A148C,color:#4A148C
    classDef doc fill:#ECEFF1,stroke:#607D8B,color:#37474F
```
