# sunny-chung/hello-http architecture

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

- Interactive diagram: https://gitdiagram.com/sunny-chung/hello-http
- Repository: https://github.com/sunny-chung/hello-http

## Overview

##### Main Components Identification

The system can be broken down into these major components:

a. User Interface Layer (src/jvmMain/kotlin/.../ux/)
- Compose-based UI components
- View models and state management
- Custom text editor implementation (BigText)

b. Core Application Layer (src/jvmMain/kotlin/.../hellohttp/)
- Document management
- Network clients
- Protocol handlers
- Data persistence

c. Transport Layer (src/jvmMain/kotlin/.../network/)
- HTTP/HTTPS handlers
- WebSocket support
- GraphQL client
- gRPC client

d. Data Management Layer
- File-based persistence
- Collection repositories
- Data import/export

**┌─────────────────────────────────────────────────────────┐**
- UI Layer (Compose)                    │
- ┤
- Request Editor                                        │
- Response Viewer                                       │
- Project Management                                    │
- Environment Controls                                  │
- ┬───────────────────────────┬───────────────┘

**┌─────────────▼───────────┐   ┌──────────▼───────────┐**
- Core Application      │   │    Data Management    │
- ┤   ├────────────────────────┤
- Request Processing    │   │ - Project Repository   │
- Response Handling     │◄──┤ - Request Repository   │
- Protocol Management   │   │ - Response Repository  │
- ┬───────────┘   └────────────┬───────────┘

**┌─────────────▼────────────────────────────▼───────────┐**
- Transport Layer                     │
- ┤
- ┌─────────┐  ┌─────────┐  ┌────────┐  ┌────────┐  │
- HTTP/  │  │ WebSocket│  │GraphQL │  │ gRPC   │  │
- HTTPS  │  │         │  │        │  │        │  │
- ┘  └─────────┘  └────────┘  └────────┘  │
- ┘

##### Important Implementation Details to Highlight

- Portable application nature
- File-based persistence system
- Multiple protocol support
- Custom text editor component
- Environment management system

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph UI["User Interface Layer"]
        UI_Components["Main UI Components"]
        TextEditor["Custom Text Editor"]
        ViewModels["View Models"]
        UI_Components --> TextEditor
        UI_Components --> ViewModels
    end

    subgraph Core["Core Application Layer"]
        DocMgmt["Document Management"]
        AppCtx["Application Context"]
        CoreMgrs["Core Managers"]
        DocMgmt --> AppCtx
        CoreMgrs --> AppCtx
    end

    subgraph Data["Data Management Layer"]
        Repos["Repositories"]
        Import["Data Import"]
        Export["Data Export"]
        PersistMgr["Persistence Manager"]
        Repos --> PersistMgr
        Import --> Repos
        Export --> Repos
    end

    subgraph Transport["Transport Layer"]
        HTTP["HTTP/HTTPS Client"]
        WS["WebSocket Client"]
        GraphQL["GraphQL Client"]
        GRPC["gRPC Client"]
    end

    UI --> Core
    Core --> Data
    Core --> Transport

    %% Click events for component mapping
    click UI_Components "https://github.com/sunny-chung/hello-http/tree/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/"
    click TextEditor "https://github.com/sunny-chung/hello-http/tree/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/bigtext/"
    click ViewModels "https://github.com/sunny-chung/hello-http/tree/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/ux/viewmodel/"
    click DocMgmt "https://github.com/sunny-chung/hello-http/tree/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/document/"
    click AppCtx "https://github.com/sunny-chung/hello-http/blob/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/AppContext.kt"
    click CoreMgrs "https://github.com/sunny-chung/hello-http/tree/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/manager/"
    click HTTP "https://github.com/sunny-chung/hello-http/blob/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/network/ApacheHttpTransportClient.kt"
    click WS "https://github.com/sunny-chung/hello-http/blob/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/network/WebSocketTransportClient.kt"
    click GraphQL "https://github.com/sunny-chung/hello-http/blob/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/network/GraphqlSubscriptionTransportClient.kt"
    click GRPC "https://github.com/sunny-chung/hello-http/blob/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/network/GrpcTransportClient.kt"
    click Repos "https://github.com/sunny-chung/hello-http/tree/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/repository/"
    click Import "https://github.com/sunny-chung/hello-http/tree/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/importer/"
    click Export "https://github.com/sunny-chung/hello-http/tree/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/exporter/"
    click PersistMgr "https://github.com/sunny-chung/hello-http/blob/main/src/jvmMain/kotlin/com/sunnychung/application/multiplatform/hellohttp/manager/PersistenceManager.kt"

    %% Styling
    classDef ui fill:#e1f5fe,stroke:#01579b
    classDef core fill:#e8f5e9,stroke:#1b5e20
    classDef data fill:#fff3e0,stroke:#e65100
    classDef transport fill:#fbe9e7,stroke:#bf360c

    class UI_Components,TextEditor,ViewModels ui
    class DocMgmt,AppCtx,CoreMgrs core
    class Repos,Import,Export,PersistMgr data
    class HTTP,WS,GraphQL,GRPC transport
```
