# rdtlabs/ts-utils architecture

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

- Interactive diagram: https://gitdiagram.com/rdtlabs/ts-utils
- Repository: https://github.com/rdtlabs/ts-utils

## Overview

##### Project type and purpose
- This is an open-source TypeScript utilities library (not a full-stack app). Its goal is to provide a rich set of type-safe constructs around async operations, cancellation, buffers, crypto, encoding, error handling, and general helpers.
- README confirms it’s a collection of reusable semantics extracted from prior JS/TS projects, with comprehensive tests and CI/CD for quality gates and publishing.

##### File structure
- Top-level:
- package.json, tsconfig.json, deno.json, tsup.config.ts – build, packaging, multi-target (Node & Deno) configuration
- .github/workflows/jsr-publish.yaml – CI/CD pipeline
- sonar-project.properties – SonarCloud quality scan
- src folder:
- index.ts, mod.ts – entry points exporting all utilities
- Subdirectories by domain: async, buffer, cancellation, crypto, encoding, errors
- Core files: List.ts, Maybe.ts, Queue.ts, utils.ts, types.ts
- Tests alongside implementations (*.test.ts)

##### Putting it all together
[Source Modules (async, buffer, …)]
↓
[Entry Points (index.ts)]
↓
[Bundler (tsup) & Deno Build] → [Output Bundles]
↓
[Publish to npm / jsr.io]
- Off to the side, parallel flows:
[Source Modules] → [Test Runner] → [CI/CD] → [SonarCloud]

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Source Modules
    subgraph "Source Modules"
        direction TB
        AsyncModule["Async Module"]:::source
        BufferModule["Buffer Module"]:::source
        CancellationModule["Cancellation Module"]:::source
        CryptoModule["Crypto Module"]:::source
        EncodingModule["Encoding Module"]:::source
        ErrorsModule["Errors Module"]:::source
        CoreList["Core Utility – List"]:::source
        CoreMaybe["Core Utility – Maybe"]:::source
        CoreQueue["Core Utility – Queue"]:::source
        CoreUtils["Core Utility – Utils"]:::source
        CoreTypes["Core Utility – Types"]:::source
    end

    %% Entry Points
    EntryPoints["Entry Points (index.ts, mod.ts)"]:::source

    %% Build & Bundler
    subgraph "Build & Bundler"
        direction TB
        Tsup["tsup.config.ts"]:::build
        DenoBuild["build-deno.ts & deno.json"]:::build
        OutputBundles["Output Bundles"]:::build
    end

    %% Test Runner
    TestRunner["Test Runner\n(*.test.ts)"]:::ci

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        direction TB
        GitHubActions["jsr-publish.yaml"]:::ci
        SonarProps["sonar-project.properties"]:::ci
    end

    %% External Services
    subgraph "External Services"
        direction TB
        NPM["npm registry"]:::external
        JSRIO["jsr.io (Deno registry)"]:::external
        SonarCloud["SonarCloud"]:::external
    end

    %% Flows
    AsyncModule --> EntryPoints
    BufferModule --> EntryPoints
    CancellationModule --> EntryPoints
    CryptoModule --> EntryPoints
    EncodingModule --> EntryPoints
    ErrorsModule --> EntryPoints
    CoreList --> EntryPoints
    CoreMaybe --> EntryPoints
    CoreQueue --> EntryPoints
    CoreUtils --> EntryPoints
    CoreTypes --> EntryPoints

    EntryPoints --> Tsup
    EntryPoints --> DenoBuild
    Tsup --> OutputBundles
    DenoBuild --> OutputBundles
    OutputBundles --> NPM
    OutputBundles --> JSRIO

    EntryPoints --> TestRunner
    TestRunner --> GitHubActions
    GitHubActions --> SonarCloud
    GitHubActions --> NPM

    GitHubActions --> SonarProps
    SonarProps --> SonarCloud

    %% Click Events
    click AsyncModule "https://github.com/rdtlabs/ts-utils/blob/main/src/async/index.ts"
    click BufferModule "https://github.com/rdtlabs/ts-utils/blob/main/src/buffer/index.ts"
    click CancellationModule "https://github.com/rdtlabs/ts-utils/blob/main/src/cancellation/index.ts"
    click CryptoModule "https://github.com/rdtlabs/ts-utils/blob/main/src/crypto/index.ts"
    click EncodingModule "https://github.com/rdtlabs/ts-utils/blob/main/src/encoding/index.ts"
    click ErrorsModule "https://github.com/rdtlabs/ts-utils/blob/main/src/errors/index.ts"
    click CoreList "https://github.com/rdtlabs/ts-utils/blob/main/src/List.ts"
    click CoreMaybe "https://github.com/rdtlabs/ts-utils/blob/main/src/Maybe.ts"
    click CoreQueue "https://github.com/rdtlabs/ts-utils/blob/main/src/Queue.ts"
    click CoreUtils "https://github.com/rdtlabs/ts-utils/blob/main/src/utils.ts"
    click CoreTypes "https://github.com/rdtlabs/ts-utils/blob/main/src/types.ts"
    click EntryPoints "https://github.com/rdtlabs/ts-utils/blob/main/src/index.ts"
    click EntryPoints "https://github.com/rdtlabs/ts-utils/blob/main/src/mod.ts"
    click Tsup "https://github.com/rdtlabs/ts-utils/blob/main/tsup.config.ts"
    click DenoBuild "https://github.com/rdtlabs/ts-utils/blob/main/build-deno.ts"
    click DenoBuild "https://github.com/rdtlabs/ts-utils/blob/main/deno.json"
    click GitHubActions "https://github.com/rdtlabs/ts-utils/blob/main/.github/workflows/jsr-publish.yaml"
    click SonarProps "https://github.com/rdtlabs/ts-utils/blob/main/sonar-project.properties"

    %% Styles
    classDef source fill:#bfdeff,stroke:#3b82f6,color:#000
    classDef build fill:#d1fad7,stroke:#10b981,color:#000
    classDef ci fill:#fde68a,stroke:#f59e0b,color:#000
    classDef external fill:#e9d5ff,stroke:#8b5cf6,color:#000
```
