# lishaduck/effect-utils architecture

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

- Interactive diagram: https://gitdiagram.com/lishaduck/effect-utils
- Repository: https://github.com/lishaduck/effect-utils

## Overview

##### Main Components

a) Core Platform Adapters:
- FileSystem Interface
- KeyValue Store
- Path Management
- Runtime Environment
- Worker System

b) Integration Layer:
- Effect.TS Core Integration
- Deno API Integration

**┌─────────────────────────────────────────┐**
- Client Application           │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- Effect.TS Core Library          │
- ┘
- ↓
**┌─────────────────────────────────────────┐**
- Platform Adapter Layer           │
- ┬─────────┬─────────┬──────────┤
- FileSystem│   KV   │  Path   │ Runtime  │
- ┴─────────┴─────────┴──────────┘
- ↓
**┌─────────────────────────────────────────┐**
- Deno Runtime                 │
- ┘

##### Component Details

a) Platform Adapters (DenoContext):
- DenoFileSystem: File operations implementation
- DenoKeyValueStore: KV storage implementation
- DenoPath: Path manipulation utilities
- DenoRuntime: Runtime environment handler
- DenoWorker: Worker thread implementation

b) Internal Utilities:
- Effect Promise Integration
- Error Handling
- KV Store Utilities

##### Key Relationships to Highlight

- How each Deno implementation relates to its Effect.TS interface
- Worker system's communication flow
- Demonstrate how the KeyValue store interacts with Deno's KV system
- Test fixtures and their relationship to implementations

##### Implementation Notes

- The adapter pattern being used
- How Effect.TS abstractions are mapped to Deno implementations
- The role of workers in the architecture
- How the platform-specific features are exposed

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        App[Client Application]
    end

    subgraph EffectCore
        Core[Effect.TS Core Library]
    end

    subgraph PlatformAdapter
        Context["Platform Context Integration"]:::adapter
        
        subgraph Implementations
            FS["FileSystem Interface"]:::impl
            KV["KeyValue Store"]:::impl
            Path["Path Management"]:::impl
            Runtime["Runtime Environment"]:::impl
            Worker["Worker System"]:::impl
            WorkerRunner["Worker Runner"]:::impl
        end
        
        subgraph Internal
            Promise["Effect Promise Integration"]:::internal
            Error["Error Handling"]:::internal
            KVUtil["KV Store Utilities"]:::internal
        end
    end

    subgraph Testing
        Tests["Test Suite"]:::test
        Fixtures["Test Fixtures"]:::test
    end

    subgraph DenoRuntime
        Deno["Deno Platform"]:::deno
    end

    %% Relationships
    App --> Core
    Core --> Context
    Context --> Implementations
    Implementations --> Internal
    Internal --> Deno
    Tests --> Implementations
    Tests --> Fixtures

    %% Click Events
    click Context "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/DenoContext.ts"
    click FS "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/DenoFileSystem.ts"
    click KV "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/DenoKeyValueStore.ts"
    click Path "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/DenoPath.ts"
    click Runtime "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/DenoRuntime.ts"
    click Worker "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/DenoWorker.ts"
    click WorkerRunner "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/DenoWorkerRunner.ts"
    click Promise "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/internal/effectify-promise.ts"
    click Error "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/internal/error.ts"
    click KVUtil "https://github.com/lishaduck/effect-utils/blob/main/packages/platform-deno/src/internal/kv.ts"
    click Tests "https://github.com/lishaduck/effect-utils/tree/main/packages/platform-deno/tests"
    click Fixtures "https://github.com/lishaduck/effect-utils/tree/main/packages/platform-deno/tests/fixtures"

    %% Styling
    classDef adapter fill:#FFA500,stroke:#333,stroke-width:2px
    classDef impl fill:#90EE90,stroke:#333,stroke-width:2px
    classDef internal fill:#ADD8E6,stroke:#333,stroke-width:2px
    classDef test fill:#FFB6C1,stroke:#333,stroke-width:2px
    classDef deno fill:#00CED1,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[Platform Adapter]:::adapter
        L2[Implementation]:::impl
        L3[Internal Utility]:::internal
        L4[Testing Component]:::test
        L5[Deno Runtime]:::deno
    end
```
