# tompston/gut architecture

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

- Interactive diagram: https://gitdiagram.com/tompston/gut
- Repository: https://github.com/tompston/gut

## Overview

##### Main Components

a) Core Components:
- Converter Engine (main processing unit)
- Type System Handler
- File Generator
- Configuration Manager

b) Input/Output Components:
- Go Struct Input Interface
- TypeScript Interface Output
- File System Interface

**[Go Structs] → [Converter Engine] → [TypeScript Interfaces]**

##### Detailed Component Breakdown

a) Input Layer:
- Struct Parser
- Tag Parser (for handling JSON tags)
- Type Detection System

b) Processing Layer (Converter Engine):
- Type Mapper
- Special Type Handler (UUID, Time, BigInt)
- Generic Type Processor
- Array Type Handler
- Type Converter

c) Output Layer:
- Interface Generator
- File Writer
- Formatting Manager

##### Flow Directions

- Struct input flow
- Type conversion flow
- Configuration application
- Output generation

##### Integration Points

Interaction with:
- File system (for reading/writing)
- Configuration system
- Type system

##### Type system flexibility

Key Relationships to Highlight:

**[Configuration] ↔ [Converter Engine]**
**[Type System] ↔ [Converter Engine]**
**[Parser] → [Type Mapper] → [Interface Generator]**

- Different component types
- Special symbols used for configuration points
- Type system integration points

Keep the abstraction level focused on the architectural components while showing the key features that make this package unique, such as:
- JSON tag handling
- Custom type conversion
- Generic support
- Array type generation
- Custom interface naming

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        GS[Go Structs]:::input
        SP[Struct Parser]:::input
        TP[Tag Parser]:::input
        TD[Type Detection]:::input
    end

    subgraph "Converter Engine"
        CE[Converter Engine]:::processing
        TM[Type Mapper]:::processing
        STH[Special Type Handler]:::processing
        GTP[Generic Type Processor]:::processing
        ATH[Array Type Handler]:::processing
        MTC[Map Type Converter]:::processing
    end

    subgraph "Type System"
        TSH[Type System Handler]:::utility
        CTM[Custom Type Mapping]:::utility
    end

    subgraph Output
        IG[Interface Generator]:::output
        FW[File Writer]:::output
        FM[Formatting Manager]:::output
    end

    subgraph Configuration
        CM[Configuration Manager]:::config
    end

    %% Input Flow
    GS --> SP
    SP --> TP
    TP --> TD
    TD --> CE

    %% Converter Engine Internal Flow
    CE --> TM
    CE --> STH
    CE --> GTP
    CE --> ATH
    CE --> MTC

    %% Type System Integration
    TSH --> TM
    TSH --> STH
    CTM --> TM

    %% Configuration Integration
    CM --> CE
    CM --> TSH

    %% Output Flow
    TM --> IG
    STH --> IG
    GTP --> IG
    ATH --> IG
    MTC --> IG
    IG --> FW
    FW --> FM

    %% Click Events
    click CE "https://github.com/tompston/gut/blob/main/main.go"
    click TSH "https://github.com/tompston/gut/blob/main/types/types.go"
    click GTP "https://github.com/tompston/gut/blob/main/examples/05-generic-struct/main.go"
    click SP "https://github.com/tompston/gut/blob/main/examples/01-basic/main.go"
    click STH "https://github.com/tompston/gut/blob/main/examples/03-custom-types/main.go"
    click IG "https://github.com/tompston/gut/blob/main/examples/02-custom-interfaces/main.go"
    click ATH "https://github.com/tompston/gut/blob/main/examples/04-struct-with-inline/main.go"

    %% Styling
    classDef input fill:#a8d1f0,stroke:#333,stroke-width:2px
    classDef processing fill:#90EE90,stroke:#333,stroke-width:2px
    classDef output fill:#FFB347,stroke:#333,stroke-width:2px
    classDef utility fill:#D3D3D3,stroke:#333,stroke-width:2px
    classDef config fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Input Components]:::input
        L2[Processing Components]:::processing
        L3[Output Components]:::output
        L4[Utility Components]:::utility
        L5[Configuration Components]:::config
    end
```
