# shikhar13012001/monk-minal architecture

> Architecture diagram of the GitHub repository shikhar13012001/monk-minal, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shikhar13012001/monk-minal
- Repository: https://github.com/shikhar13012001/monk-minal

## Overview

##### Main Components

a) Core Application Layer:
- Entry Point (index.js)
- Game Engine (modules/game.js)
- Configuration Handler (modules/options.js)
- Data Loader (modules/loader.js)

b) Data Layer:
- Word Database (data/allWords.json)
- Quotes Database (data/quotes.json)

c) Utility Layer:
- CLI Interface (utils/cli.js)
- Helper Functions (utils/helpers.js)
- Initialization Module (utils/init.js)
- Logging System (utils/log.js)

##### Component Relationships and Flow

- User Input → CLI Interface → Game Engine
- Game Engine ↔ Data Layer
- Game Engine → Logging System
- Configuration Handler ↔ Game Engine
- Initialization Module → All Components

**┌─────────────────────────────────────────────────────┐**
- User Interface                      │
- (Terminal/Command Line)                 │
- ┘
- ↕
**┌─────────────────────────────────────────────────────┐**
- CLI Interface                       │
- (utils/cli.js)                      │
- ┘
- ↕
**┌─────────────────────────────────────────────────────┐**
- Core Engine                        │
- ┬─────────────────┬────────────────┤
- Game Engine   │  Options Handler│   Data Loader   │
- (game.js)      │  (options.js)   │   (loader.js)   │
- ┴─────────────────┴────────────────┘
- ↕
**┌─────────────────────────────────────────────────────┐**
- Data Layer                         │
- ┬───────────────────────────┤
- Word Database       │      Quotes Database      │
- (allWords.json)      │      (quotes.json)        │
- ┴───────────────────────────┘

##### Additional Elements

- Chalk
- Enquirer
- CLI-Spinners
- Random-Words
- Readline
- Strip-ANSI
- Ruxe
- Ora

##### Performance Monitoring

A separate section showing how performance metrics are calculated and displayed:
- WPM Calculator
- Accuracy Tracker
- Error Counter

## Diagram (Mermaid)

```mermaid
%%{init: {'theme': 'base', 'themeVariables': { 'fontSize': '16px'}}}%%
flowchart TB
    subgraph UI["User Interface Layer"]
        CLI["CLI Interface"]
        IOH["Input/Output Handler"]
        TR["Terminal Renderer"]
        PMD["Performance Metrics Display"]
    end

    subgraph Core["Core Game Logic Layer"]
        AI["Application Initializer"]
        GE["Game Engine"]
        OH["Options Handler"]
        DL["Data Loader"]
        
        subgraph GameComponents["Game Components"]
            TM["Timer Manager"]
            WG["Word Generator"]
            SC["Score Calculator"]
            PA["Performance Analyzer"]
        end
    end

    subgraph Data["Data Layer"]
        WDB[(Word Database)]
        QDB[(Quotes Database)]
    end

    subgraph Deps["External Dependencies"]
        CH["Chalk"]
        EN["Enquirer"]
        CS["CLI-Spinners"]
        RW["Random-Words"]
        OR["Ora"]
    end

    %% Connections
    CLI --> GE
    IOH --> CLI
    TR --> CLI
    GE --> PMD
    AI --> GE
    OH --> GE
    DL --> GE
    GE --> GameComponents
    DL --> WDB
    DL --> QDB
    Deps --> UI

    %% Component Interactions
    GameComponents --> PMD
    WG --> SC
    TM --> SC
    SC --> PA

    %% Click Events
    click CLI "https://github.com/shikhar13012001/monk-minal/blob/main/utils/cli.js"
    click IOH "https://github.com/shikhar13012001/monk-minal/blob/main/utils/helpers.js"
    click TR "https://github.com/shikhar13012001/monk-minal/blob/main/utils/log.js"
    click AI "https://github.com/shikhar13012001/monk-minal/blob/main/utils/init.js"
    click GE "https://github.com/shikhar13012001/monk-minal/blob/main/modules/game.js"
    click OH "https://github.com/shikhar13012001/monk-minal/blob/main/modules/options.js"
    click DL "https://github.com/shikhar13012001/monk-minal/blob/main/modules/loader.js"
    click WDB "https://github.com/shikhar13012001/monk-minal/blob/main/data/allWords.json"
    click QDB "https://github.com/shikhar13012001/monk-minal/blob/main/data/quotes.json"

    %% Styling
    classDef default fill:#f9f9f9,stroke:#333,stroke-width:2px
    classDef ui fill:#daf1f9,stroke:#333
    classDef core fill:#d0f4de,stroke:#333
    classDef data fill:#fff3cd,stroke:#333
    classDef deps fill:#e9ecef,stroke:#333
    classDef game fill:#d4e5d2,stroke:#333

    class CLI,IOH,TR,PMD ui
    class AI,GE,OH,DL core
    class WDB,QDB data
    class CH,EN,CS,RW,OR deps
    class TM,WG,SC,PA game

    %% Legend
    subgraph Legend
        UI_L["UI Component"]:::ui
        CORE_L["Core Component"]:::core
        DATA_L["Data Store"]:::data
        DEPS_L["External Dependency"]:::deps
        GAME_L["Game Component"]:::game
    end
```
