# adedoyin-emmanuel/tsfluent architecture

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

- Interactive diagram: https://gitdiagram.com/adedoyin-emmanuel/tsfluent
- Repository: https://github.com/adedoyin-emmanuel/tsfluent

## Overview

##### Project type and purpose
- This is an open-source TypeScript library (“tsfluent”) providing a fluent, type-safe Result/ResultAsync API for handling success/failure, metadata, and async operations.
- It’s not a client/server app but a reusable package that compiles to JS, ships on npm, and integrates with CI/CD.

##### File structure
- Top-level config & tooling:
- .github/workflows/ci.yml & publish.yml – CI for testing, linting, and npm publish
- .husky/pre-push – git hooks
- commitlint.config.* – commit message enforcement
- tsconfig.json, package.json, bun.lock, .npmignore – build & packaging config
- src/ holds the actual library modules:
- src/index.ts – public API exports
- src/result.ts – core Result<T, TContext> implementation
- src/result-async.ts – async counterpart, builds on core
- src/@types/result.ts – shared types/interfaces (IError, IResultMetadata, etc.)
- src/utils/async-utils.ts – retry, timeout, combine helpers
- src/utils/result-extensions.ts – extra methods that augment Result/ResultAsync
- tests/ – unit tests exercising each module.

##### README for additional insights
- API Reference outlines the public interface and module responsibilities.
- Usage examples demonstrate how core & async modules interoperate and how metadata/context flows through.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Actors and CI/CD
    Dev["Developers"]:::actor
    PrePush["Git Hooks<br/>(Husky)"]:::workflow
    Commitlint["Commitlint"]:::workflow
    CI["CI Workflow<br/>(ci.yml)"]:::workflow
    BuildTest["Build & Test"]:::process
    Publish["Publish Workflow<br/>(publish.yml)"]:::workflow
    PublishStep["Publish to npm"]:::process
    Package["npm Registry"]:::database

    Dev --> PrePush --> Commitlint --> CI --> BuildTest --> Publish --> PublishStep --> Package
    CI --> BuildTest
    BuildTest --> Publish

    %% Library Modules
    subgraph "Library Modules"
        Core["Core Module<br/>Result<T,TContext>"]:::code
        Async["Async Module<br/>ResultAsync<T,TContext>"]:::code
        Types["Type Definitions"]:::code
        UtilsA["Async Utilities"]:::code
        UtilsR["Result Extensions"]:::code
        PublicAPI["Public API Entry Point<br/>(index.ts)"]:::public
    end

    %% Dependencies between modules
    PublicAPI --> Core
    PublicAPI --> Async
    PublicAPI --> Types
    PublicAPI --> UtilsA
    PublicAPI --> UtilsR

    Async --> Core
    UtilsA --> Core
    UtilsA --> Async
    UtilsR --> Core

    %% Tests
    subgraph "Unit Tests"
        TCore["Core Module Tests"]:::test
        TAsync["Async Module Tests"]:::test
        TTypes["Types Tests"]:::test
        TUtils["Utilities Tests"]:::test
    end

    TCore -.-> Core
    TAsync -.-> Async
    TTypes -.-> Types
    TUtils -.-> UtilsA
    TUtils -.-> UtilsR

    BuildTest --> TCore
    BuildTest --> TAsync
    BuildTest --> TTypes
    BuildTest --> TUtils

    %% Click Events
    click Core "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/src/result.ts"
    click Async "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/src/result-async.ts"
    click Types "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/src/@types/result.ts"
    click UtilsA "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/src/utils/async-utils.ts"
    click UtilsR "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/src/utils/result-extensions.ts"
    click PublicAPI "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/src/index.ts"
    click CI "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/.github/workflows/ci.yml"
    click Publish "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/.github/workflows/publish.yml"
    click PrePush "https://github.com/adedoyin-emmanuel/tsfluent/tree/main/.husky/pre-push"
    click Commitlint "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/commitlint.config.js"
    click Package "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/package.json"
    click Package "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/.npmignore"
    click Package "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/bun.lock"
    click Package "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/tsconfig.json"
    click TCore "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/tests/result.test.ts"
    click TAsync "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/tests/result-async.test.ts"
    click TTypes "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/tests/types.test.ts"
    click TUtils "https://github.com/adedoyin-emmanuel/tsfluent/blob/main/tests/utils.test.ts"

    %% Styles
    classDef actor fill:#E3F2FD,stroke:#90CAF9;
    classDef workflow fill:#F3E5F5,stroke:#BA68C8;
    classDef process fill:#E8F5E9,stroke:#66BB6A;
    classDef database fill:#FFF3E0,stroke:#FFA726;
    classDef code fill:#BBE2FF,stroke:#42A5F5;
    classDef public fill:#FFD580,stroke:#FFB300;
    classDef test fill:#EEEEEE,stroke:#BDBDBD;
```
