# thuongtruong1009/gouse architecture

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

- Interactive diagram: https://gitdiagram.com/thuongtruong1009/gouse
- Repository: https://github.com/thuongtruong1009/gouse

## Overview

This project is a Go utility library—essentially a modern, comprehensive toolkit inspired by Lodash. Its purpose is to provide a wide array of utility functions for arrays, strings, math, configuration, crypto, and many other domains, all wrapped in a modular, chainable, and easy-to-use structure for Go developers. In addition, it includes sample code, API examples (such as load balancers and network tools), and dedicated documentation and tooling.

##### Major Components
- Core Utility Library: This is the heart of Gouse. It is split into many focused modules such as:
▪ Array, Cache, Chart, Config, Connection, Console, Date, Function, Helper, I/O, Log, Math, Net, Number, Regex, Structs, Strings, Tools, and Types.
- API Module: There is an “api” directory that includes functionalities like port scanning, load balancing, and a proxy. This component demonstrates how Gouse can be integrated into network-facing applications.
- Samples: The “samples” directory holds example usages of the various modules, which serve as practical demos and integration tests for the functionalities provided by the core library.
- Documentation: With a rich “docs” directory (complete with Docusaurus configuration, blog, and markdown files), this section covers usage guides, tutorials, and the overall documentation structure for the project.
- Build & CI/CD Infrastructure: Indicated by several configuration files (Makefile, GitHub actions, CircleCI configs, sonar, etc.), these components ensure quality and consistency through automated testing, linting, and continuous integration.

##### Establish Relationships and Interactions
- Samples should be linked to the modules they demonstrate. Show the sample folder as a “Usage” layer that leverages many core modules.
- The Documentation component interacts with all parts of the project to provide cohesive user guides and developer references.
- The CI/CD and build infrastructure (GitHub workflows, CircleCI, etc.) sits external to the code modules but continuously monitors and integrates with the core repository, ensuring code quality and up-to-date builds.

##### Architectural Patterns & Design Principles
- Modularity and Separation of Concerns: Each utility (e.g., array manipulation, network util, math functions) is isolated in its own package. Indicate this with separate blocks that are well encapsulated.
- Reusability: The design encourages chainable and reusable functions, so highlight that the components expose library functions that are easily importable into other projects.
- Extensibility: The project’s structure (with helper and sample directories) underlines its design for extension and easy integration into different types of applications (CLI tools, APIs, etc.).

##### Including Relevant Technologies
- Go as the primary language with its module system (go.mod, go.sum).
- Integration with external dependencies like Google UUID, Bubbletea, and Go Cache. Although these aren’t core code modules, note them as external libraries that influence the functionality within some modules.
- CI/CD tools such as GitHub Actions, CircleCI, and DeepSource for automated testing and quality checks.

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Usage Layer
    subgraph "Usage Layer"
        apiNode["API Module"]:::usage
        samplesNode["Samples"]:::usage
    end

    %% Core Library Modules Layer
    subgraph "Core Library Modules"
        array["Array Module"]:::coreModule
        cache["Cache Module"]:::coreModule
        chart["Chart Module"]:::coreModule
        configM["Config Module"]:::coreModule
        connection["Connection Module"]:::coreModule
        consoleM["Console Module"]:::coreModule
        date["Date Module"]:::coreModule
        functionM["Function Module"]:::coreModule
        helper["Helper Module"]:::coreModule
        ioM["I/O Module"]:::coreModule
        logM["Log Module"]:::coreModule
        mathM["Math Module"]:::coreModule
        netM["Net Module"]:::coreModule
        number["Number Module"]:::coreModule
        regex["Regex Module"]:::coreModule
        structs["Structs Module"]:::coreModule
        stringsM["Strings Module"]:::coreModule
        tools["Tools Module"]:::coreModule
        types["Types Module"]:::coreModule
    end

    %% Infrastructure Layer
    subgraph "Infrastructure"
        docsNode["Documentation"]:::docs
        subgraph "CI/CD & Build"
            circleci["CircleCI Config (.circleci)"]:::infra
            githubWorkflows["GitHub Workflows (.github/workflows)"]:::infra
            makefile["Makefile"]:::infra
            deepsource["DeepSource Config (.deepsource.toml)"]:::infra
            sonar["Sonar Config (sonar-project.properties)"]:::infra
        end
    end

    %% Relationships
    apiNode -->|"calls"| array
    samplesNode -->|"demonstrates"| array

    docsNode -->|"documents"| apiNode
    docsNode -->|"documents"| samplesNode
    docsNode -->|"documents"| array

    circleci -->|"integrates"| apiNode
    circleci -->|"integrates"| samplesNode
    circleci -->|"integrates"| array
    circleci -->|"monitors"| docsNode

    %% Click Events for Core Modules
    click array "https://github.com/thuongtruong1009/gouse/tree/main/array/"
    click cache "https://github.com/thuongtruong1009/gouse/tree/main/cache/"
    click chart "https://github.com/thuongtruong1009/gouse/tree/main/chart/"
    click configM "https://github.com/thuongtruong1009/gouse/tree/main/config/"
    click connection "https://github.com/thuongtruong1009/gouse/tree/main/connection/"
    click consoleM "https://github.com/thuongtruong1009/gouse/tree/main/console/"
    click date "https://github.com/thuongtruong1009/gouse/tree/main/date/"
    click functionM "https://github.com/thuongtruong1009/gouse/tree/main/function/"
    click helper "https://github.com/thuongtruong1009/gouse/tree/main/helper/"
    click ioM "https://github.com/thuongtruong1009/gouse/tree/main/io/"
    click logM "https://github.com/thuongtruong1009/gouse/tree/main/log/"
    click mathM "https://github.com/thuongtruong1009/gouse/tree/main/math/"
    click netM "https://github.com/thuongtruong1009/gouse/tree/main/net/"
    click number "https://github.com/thuongtruong1009/gouse/tree/main/number/"
    click regex "https://github.com/thuongtruong1009/gouse/tree/main/regex/"
    click structs "https://github.com/thuongtruong1009/gouse/tree/main/structs/"
    click stringsM "https://github.com/thuongtruong1009/gouse/tree/main/strings/"
    click tools "https://github.com/thuongtruong1009/gouse/tree/main/tools/"
    click types "https://github.com/thuongtruong1009/gouse/tree/main/types/"

    %% Click Events for Usage Layer
    click apiNode "https://github.com/thuongtruong1009/gouse/tree/main/api/"
    click samplesNode "https://github.com/thuongtruong1009/gouse/tree/main/samples/"

    %% Click Event for Documentation
    click docsNode "https://github.com/thuongtruong1009/gouse/tree/main/docs/"

    %% Click Events for CI/CD Infrastructure
    click circleci "https://github.com/thuongtruong1009/gouse/tree/main/.circleci/"
    click githubWorkflows "https://github.com/thuongtruong1009/gouse/tree/main/.github/workflows/"
    click makefile "https://github.com/thuongtruong1009/gouse/tree/main/Makefile"
    click deepsource "https://github.com/thuongtruong1009/gouse/blob/main/.deepsource.toml"
    click sonar "https://github.com/thuongtruong1009/gouse/blob/main/sonar-project.properties"

    %% Style Definitions
    classDef coreModule fill:#FFEEAD,stroke:#DAA520,stroke-width:2px;
    classDef usage fill:#ADD8E6,stroke:#1E90FF,stroke-width:2px;
    classDef docs fill:#C1FFC1,stroke:#008000,stroke-width:2px;
    classDef infra fill:#D3D3D3,stroke:#696969,stroke-width:2px;
```
