# j-c7/tinyconverter architecture

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

- Interactive diagram: https://gitdiagram.com/j-c7/tinyconverter
- Repository: https://github.com/j-c7/tinyconverter

## Overview

##### Project type and purpose
- From the file tree and README, this is a single, Godot-based desktop tool (“Tiny Converter”) whose sole purpose is converting images between JPG, PNG, and WebP.
- It uses Godot scenes for UI, a C# .NET project for logic, and a small plugin-style core for format support.

##### File structure
Top-level:
- scenes/        ← Godot scene files (main.tscn)
- prototype/     ← throwaway/test scripts (MoveUI.cs)
- src/           ← C# source code
– core/        ← domain & utility classes (FormatterNode, AttributesManager, Globals, Result, etc.)
– formats/     ← per-format implementations (JpgFormat, PngFormat, WebpFormat)
– main/        ← application bootstrap (App.cs, IApp.cs)
– ui/          ← UI managers & controllers (UIManager.cs, Roll.cs)
- Tiny Converter.sln/.csproj ← .NET solution & project files
- project.godot  ← Godot project descriptor

##### README for additional insights
- Confirms the converter is in beta, uses Godot 4.4, and supports exactly three formats.

##### Main components & interactions
a. Components
1. Godot Engine Host
2. UI Layer (scenes/main.tscn, UIManager, Roll, MoveUI prototype)
3. Application Layer (IApp, App)
4. Core Domain Layer
- FormatterNode / IFormatterNode / AttributesManager / NodeExtends / Result
5. Format Modules (JpgFormat, PngFormat, WebpFormat)
7. External Libraries (Godot C# API, .NET Base Class Libraries)

b. Relationships & data flow
- User clicks UI button → UIManager (or Roll) captures event → calls IApp.Convert(image, targetFormat)
- App (application layer) delegates to Core’s FormatterNode → uses AttributesManager to validate → picks correct IFormatterNode implementation (JpgFormat/PngFormat/WebpFormat)
- Formatter writes output via Godot Image APIs or .NET I/O → saved to disk / content folder
- UI listens for completion events → updates scene (e.g. shows success notification)

c. Architectural patterns / principles
- Layered architecture: Presentation (UI), Application (App), Domain (core), Plugins (formats), Infrastructure (FS, Godot API)
- Dependency inversion via IApp and IFormatterNode interfaces
- Attribute-based validation / assertion (AssertNode in core/attributes)
- Mass-extendable: add new formats by implementing IFormatterNode

d. Key technologies & frameworks
- Godot 4.4 (scene graph, GDScript optional, here using C# binding)
- C# / .NET 7+ (csproj, sln)
- Godot C# API (loading scenes, responding to signals, file I/O)
- Custom domain library under src/core

##### Be detailed but not overwhelmed
- Every layer: UI, App, Core, Formats, Infrastructure.
- Do not fragment further into single classes; instead group classes by folder/layer.

[Godot Engine Host: project.godot]
|
v
[UI Layer – Scenes/main.tscn]  →  UIManager & Roll (src/ui)
|
v
[App Layer – IApp, App (src/main)]
|
v
[Core Domain – FormatterNode, AttributesManager, Globals, Result (src/core)]
|
v
[Format Plugins – JpgFormat, PngFormat, WebpFormat (src/formats)]
|
v

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Godot Engine Host"
        direction TB
        Engine["project.godot"]:::external
    end

    subgraph "UI Layer"
        direction TB
        Scenes["main.tscn"]:::ui
        UIManager["UIManager.cs"]:::ui
        Roll["Roll.cs"]:::ui
        MoveUI["MoveUI.cs (prototype)"]:::ui
    end

    subgraph "App Layer"
        direction TB
        IApp["IApp.cs"]:::app
        App["App.cs"]:::app
    end

    subgraph "Core Domain"
        direction TB
        FormatterNode["FormatterNode.cs"]:::core
        IFormatterNode["IFormatterNode.cs"]:::core
        AttributesManager["AttributesManager.cs"]:::core
        Globals["Globals.cs"]:::core
        Result["Result.cs"]:::core
        ArrayExtends["ArrayExtends.cs"]:::core
        NodeExtends["NodeExtends.cs"]:::core
        AssertNode["AssertNode.cs"]:::core
    end

    subgraph "Format Plugins"
        direction TB
        JPG["JpgFormat.cs"]:::plugin
        PNG["PngFormat.cs"]:::plugin
        WEBP["WebpFormat.cs"]:::plugin
    end

    subgraph "File System & Assets"
        direction TB
        Icons["content/icons/"]:::infra
        Textures["content/textures/"]:::infra
    end

    subgraph "Solution & Project Files"
        direction TB
        Sln["Tiny Converter.sln"]:::external
        Csproj["Tiny Converter.csproj"]:::external
    end

    Engine --> Scenes
    Scenes --> UIManager
    UIManager --> Roll
    UIManager --> MoveUI
    Roll --> IApp
    IApp --> App
    App --> FormatterNode
    FormatterNode --> IFormatterNode
    FormatterNode --> AttributesManager
    AttributesManager --> AssertNode
    FormatterNode --> Globals
    FormatterNode --> Result
    FormatterNode --> ArrayExtends
    FormatterNode --> NodeExtends
    Result --> JPG
    Result --> PNG
    Result --> WEBP
    JPG --> Icons
    PNG --> Icons
    WEBP --> Icons
    JPG --> Textures
    PNG --> Textures
    WEBP --> Textures
    Icons --> Sln
    Csproj --> Textures

    click Engine "https://github.com/j-c7/tinyconverter/blob/main/project.godot"
    click Scenes "https://github.com/j-c7/tinyconverter/blob/main/scenes/main.tscn"
    click UIManager "https://github.com/j-c7/tinyconverter/blob/main/src/ui/UIManager.cs"
    click Roll "https://github.com/j-c7/tinyconverter/blob/main/src/ui/Roll.cs"
    click MoveUI "https://github.com/j-c7/tinyconverter/blob/main/prototype/MoveUI.cs"
    click IApp "https://github.com/j-c7/tinyconverter/blob/main/src/main/IApp.cs"
    click App "https://github.com/j-c7/tinyconverter/blob/main/src/main/App.cs"
    click FormatterNode "https://github.com/j-c7/tinyconverter/blob/main/src/core/FormatterNode.cs"
    click IFormatterNode "https://github.com/j-c7/tinyconverter/blob/main/src/core/IFormatterNode.cs"
    click AttributesManager "https://github.com/j-c7/tinyconverter/blob/main/src/core/AttributesManager.cs"
    click Globals "https://github.com/j-c7/tinyconverter/blob/main/src/core/Globals.cs"
    click Result "https://github.com/j-c7/tinyconverter/blob/main/src/core/Result.cs"
    click ArrayExtends "https://github.com/j-c7/tinyconverter/blob/main/src/core/ArrayExtends.cs"
    click NodeExtends "https://github.com/j-c7/tinyconverter/blob/main/src/core/NodeExtends.cs"
    click AssertNode "https://github.com/j-c7/tinyconverter/blob/main/src/core/attributes/AssertNode.cs"
    click JPG "https://github.com/j-c7/tinyconverter/blob/main/src/formats/JpgFormat.cs"
    click PNG "https://github.com/j-c7/tinyconverter/blob/main/src/formats/PngFormat.cs"
    click WEBP "https://github.com/j-c7/tinyconverter/blob/main/src/formats/WebpFormat.cs"
    click Icons "https://github.com/j-c7/tinyconverter/tree/main/content/icons/"
    click Textures "https://github.com/j-c7/tinyconverter/tree/main/content/textures/"
    click Sln "https://github.com/j-c7/tinyconverter/blob/main/Tiny Converter.sln"
    click Csproj "https://github.com/j-c7/tinyconverter/blob/main/Tiny Converter.csproj"

    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef app fill:#90EE90,stroke:#000,stroke-width:1px
    classDef core fill:#98FB98,stroke:#000,stroke-width:1px
    classDef plugin fill:#FFA500,stroke:#000,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef external fill:#F5F5F5,stroke:#000,stroke-width:1px
```
