# mfinelli/cui architecture

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

- Interactive diagram: https://gitdiagram.com/mfinelli/cui
- Repository: https://github.com/mfinelli/cui

## Overview

##### Main Components

a. Core Application Components:
- TUI Interface Layer (Primary user interaction)
- Request Editor Module
- HTTP Client Module
- Echo Server Component (Optional development server)
- Response Handler
- History Manager

b. External Interactions:
- Target HTTP Servers
- Local File System (for saving responses)
- Echo Server (when in development mode)

##### Specific Component Relationships

- User Input → TUI Interface
- TUI Interface → Request Editor
- Request Editor → HTTP Client
- HTTP Client → External Servers
- Response → Response Handler → TUI Display
- History Manager ↔ Request Editor (bidirectional)

##### Technical Details
- Go runtime environment
- Terminal UI framework
- HTTP client library
- File I/O capabilities
- Docker container boundary (if deployed via Docker)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Presentation Layer"
        TUI["TUI Interface Layer"]:::ui
        click TUI "https://github.com/mfinelli/cui/blob/master/footer.go"
        Footer["Footer Component"]:::ui
        click Footer "https://github.com/mfinelli/cui/blob/master/footer.go"
        Init["Initialization"]:::ui
        click Init "https://github.com/mfinelli/cui/blob/master/init.go"
    end

    subgraph "Business Logic Layer"
        RequestEditor["Request Editor"]:::logic
        click RequestEditor "https://github.com/mfinelli/cui/blob/master/edit_request_editor.go"
        HeaderEditor["Header Editor"]:::logic
        click HeaderEditor "https://github.com/mfinelli/cui/blob/master/edit_headers.go"
        ParamEditor["Parameter Editor"]:::logic
        click ParamEditor "https://github.com/mfinelli/cui/blob/master/edit_parameters.go"
        History["History Manager"]:::logic
        click History "https://github.com/mfinelli/cui/blob/master/history.go"
        ResponseHandler["Response Handler"]:::logic
        click ResponseHandler "https://github.com/mfinelli/cui/blob/master/save_response.go"
    end

    subgraph "Network Layer"
        HTTPClient["HTTP Client"]:::network
        click HTTPClient "https://github.com/mfinelli/cui/blob/master/request.go"
        EchoServer["Echo Server"]:::network
        click EchoServer "https://github.com/mfinelli/cui/blob/master/server.go"
    end

    subgraph "Core Components"
        MainApp["Main Application"]:::core
        click MainApp "https://github.com/mfinelli/cui/blob/master/main.go"
        Utils["Utilities"]:::core
        click Utils "https://github.com/mfinelli/cui/blob/master/util.go"
        Words["Word Processing"]:::core
        click Words "https://github.com/mfinelli/cui/blob/master/words.go"
    end

    subgraph "External Systems"
        TargetServers["Target HTTP Servers"]:::external
        FileSystem["Local File System"]:::external
    end

    subgraph "Build & Deploy"
        Docker["Docker Container"]:::deploy
        click Docker "https://github.com/mfinelli/cui/tree/master/Dockerfile"
        CI["CI/CD Workflow"]:::deploy
        click CI "https://github.com/mfinelli/cui/blob/master/.github/workflows/docker.yml"
        Build["Build System"]:::deploy
        click Build "https://github.com/mfinelli/cui/tree/master/Makefile"
        Version["Version Control"]:::deploy
        click Version "https://github.com/mfinelli/cui/blob/master/version.bash"
    end

    %% Relationships
    TUI --> Footer
    TUI --> Init
    TUI --> RequestEditor
    RequestEditor --> HeaderEditor
    RequestEditor --> ParamEditor
    RequestEditor <--> History
    RequestEditor --> HTTPClient
    HTTPClient --> ResponseHandler
    HTTPClient --> TargetServers
    HTTPClient --> EchoServer
    ResponseHandler --> FileSystem
    MainApp --> TUI
    Utils --> MainApp
    Words --> MainApp

    %% Styling
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef logic fill:#2ecc71,stroke:#27ae60,color:white
    classDef network fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef core fill:#9b59b6,stroke:#8e44ad,color:white
    classDef deploy fill:#34495e,stroke:#2c3e50,color:white

    %% Legend
    subgraph Legend
        UI["UI Components"]:::ui
        Logic["Business Logic"]:::logic
        Network["Network Components"]:::network
        External["External Systems"]:::external
        Core["Core Components"]:::core
        Deploy["Build & Deploy"]:::deploy
    end
```
