# bloznelis/typioca architecture

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

- Interactive diagram: https://gitdiagram.com/bloznelis/typioca
- Repository: https://github.com/bloznelis/typioca

## Overview

##### Project Type Analysis
This is a command-line application written in Go, focusing on providing typing speed tests with various features like word lists, SSH server capabilities, and custom configurations.

##### Main Components

Core Components:
a) Command Interface Layer
- Entry point (main.go)
- Command handlers (cmd/*.go)
- View rendering (cmd/view.go)

b) Word Management System
- Word loaders (cmd/words/loader.go)
- Word processors (cmd/words/words.go)

c) Storage System
- Embedded word lists
- External word lists
- Configuration management

d) Layout System
- Keyboard layout configurations
- Layout processors

**┌─ User Interface Layer ─────────────────────┐**
- Terminal UI (Bubble Tea Framework)         │
- ┬─────────────────────┬─┘

**┌─ Command Layer ───▼─────┐    ┌─ Config ┼─────────┐**
- Test Runner           │    │ Platform-specific │
- Results Processor     │    │ Configuration    │
- SSH Server           │    │ (.config/typioca) │
- ┬─────────────┘    └─────────────────┬─┘

**┌─ Core Services ──────────────────────────────▼─┐**
- ┌─ Word Management ─┐  ┌─ Layout Management ─┐ │
- Word Loaders    │  │ - Layout Configs    │ │
- Word Processors │  │ - Layout Handlers   │ │
- ┘  └───────────────────┬─┘ │
- ┼───┘

**┌─ Storage Layer ───────────────────────┬──▼──┐**
- ┌─ Embedded Storage ─┐ ┌─ External Storage ┐│
- Word Lists       │ │ - Custom Lists    ││
- Sentences       │ │ - User Config     ││
- ┘ └──────────────────┘│
- ┘

##### Important Elements to Highlight
- Platform-specific implementations (init_darwin.go, init_linux.go, init_windows.go)
- SSH server capability
- Multiple word list sources (embedded vs. external)
- Configuration system with TOML support
- Bubble Tea framework integration

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        Terminal["Terminal UI (Bubble Tea)"]
    end

    subgraph CMD["Command Layer"]
        EntryPoint["Entry Point"]
        CmdHandlers["Command Handlers"]
        ViewRender["View Rendering"]
        ResultsProc["Results Processor"]
        ModelMgmt["Model Management"]
    end

    subgraph CORE["Core Services"]
        subgraph WM["Word Management"]
            WordLoader["Word Loader"]
            WordProc["Word Processor"]
        end
        
        subgraph LAYOUT["Layout Management"]
            LayoutConfig["Layout Configurations"]
        end
        
        subgraph PLATFORM["Platform-Specific"]
            Darwin["Darwin Init"]
            Linux["Linux Init"]
            Windows["Windows Init"]
        end
        
        Utils["Core Utilities"]
        Init["Initialization"]
    end

    subgraph STORAGE["Storage Layer"]
        subgraph EMB["Embedded Storage"]
            EmbedLists["Embedded Word Lists"]
        end
        
        subgraph EXT["External Storage"]
            ExtLists["External Word Lists"]
            Config["Configuration"]
        end
    end

    Terminal --> EntryPoint
    Terminal --> ViewRender
    EntryPoint --> CmdHandlers
    CmdHandlers --> ResultsProc
    CmdHandlers --> ModelMgmt
    ModelMgmt --> WordLoader
    WordLoader --> WordProc
    WordProc --> EmbedLists
    WordProc --> ExtLists
    Init --> Config
    Init --> Darwin
    Init --> Linux
    Init --> Windows
    Utils --> ResultsProc

    %% Click Events
    click EntryPoint "https://github.com/bloznelis/typioca/blob/master/main.go"
    click CmdHandlers "https://github.com/bloznelis/typioca/blob/master/cmd/cmd.go"
    click ViewRender "https://github.com/bloznelis/typioca/blob/master/cmd/view.go"
    click ResultsProc "https://github.com/bloznelis/typioca/blob/master/cmd/results.go"
    click ModelMgmt "https://github.com/bloznelis/typioca/blob/master/cmd/model.go"
    click WordLoader "https://github.com/bloznelis/typioca/blob/master/cmd/words/loader.go"
    click WordProc "https://github.com/bloznelis/typioca/blob/master/cmd/words/words.go"
    click EmbedLists "https://github.com/bloznelis/typioca/tree/master/cmd/words/embedables"
    click ExtLists "https://github.com/bloznelis/typioca/tree/master/words/storage"
    click Config "https://github.com/bloznelis/typioca/blob/master/cmd/config.go"
    click LayoutConfig "https://github.com/bloznelis/typioca/tree/master/layouts"
    click Darwin "https://github.com/bloznelis/typioca/blob/master/cmd/init_darwin.go"
    click Linux "https://github.com/bloznelis/typioca/blob/master/cmd/init_linux.go"
    click Windows "https://github.com/bloznelis/typioca/blob/master/cmd/init_windows.go"
    click Utils "https://github.com/bloznelis/typioca/blob/master/cmd/util.go"
    click Init "https://github.com/bloznelis/typioca/blob/master/cmd/init.go"

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef cmd fill:#2ecc71,stroke:#27ae60,color:white
    classDef core fill:#e74c3c,stroke:#c0392b,color:white
    classDef storage fill:#f1c40f,stroke:#f39c12,color:black
    classDef platform fill:#9b59b6,stroke:#8e44ad,color:white

    class Terminal ui
    class EntryPoint,CmdHandlers,ViewRender,ResultsProc,ModelMgmt cmd
    class WordLoader,WordProc,Utils,Init,LayoutConfig core
    class EmbedLists,ExtLists,Config storage
    class Darwin,Linux,Windows platform
```
