# fathym-deno/eac architecture

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

- Interactive diagram: https://gitdiagram.com/fathym-deno/eac
- Repository: https://github.com/fathym-deno/eac

## Overview

##### Project type and purpose
- Everything as Code is a Deno/TypeScript library and runtime for defining, managing, and executing enterprise DevOps configurations (“Everything-as-Code”).
- It exposes a core API (src/eac), a pluggable distributed file system (src/dfs), a runtime engine with gateways and pipelines (src/runtime), and a “steward” orchestrator/CLI (src/steward).

##### File structure
- Top-level “src” contains these domains:
- dfs – handler/resolver/worker pattern for abstracting file storage (Azure Blob, Deno KV, local FS, NPM, remote fetch, ESM, JSR).
- eac – core “Everything as Code” data models (Details, States, API JWT payloads, actuators, metadata).
- runtime – runtime engine (config, execution context, handler pipelines, protocol gateways & transports (HTTP, MQTT, OPC UA), plugins, server startup).
- steward – orchestrator clients, informants, status checkers, commit/delete handlers for pushing EAC definitions to actuators.
- fluent & esbuild – convenience builders and build pipeline exports.
- types – shared TypeScript types and utilities.
- Configuration files (.gitattributes, deno.jsonc) and tests for each domain confirm modular boundaries.

##### README
- Describes the API’s goals: cloud- and code-agnostic DevOps as config, customizable modules, future-proof.

##### Detail
- Major directories as components
- Handler→resolver→worker flow in DFS
- Pipeline→gateway→transport chain in Runtime
- Steward’s commit/check/delete client flows

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer Application
    DeveloperApp["Developer Application"]:::external

    %% Fluent & Build
    subgraph "Fluent & Build" 
        Fluent["Fluent Builder API"]:::fluent
        Esbuild["ESBuild Build Pipeline Exports"]:::fluent
    end

    %% Core API & Types
    subgraph "Core EaC API & Data Models" 
        CoreEAC["Core EaC API & Data Models"]:::core
        SharedTypes["Shared Type Definitions"]:::core
    end

    %% DFS Subsystem
    subgraph "Distributed File System Subsystem" 
        DFS["DFS Subsystem"]:::dfs
        DFSHandlers["Handlers"]:::dfs
        DFSResolvers["Resolvers"]:::dfs
        DFSWorkers["Workers"]:::dfs
    end

    %% Runtime Engine
    subgraph "Runtime Engine" 
        RuntimeCore["Runtime Engine Core"]:::runtime
        RuntimeConfig["Runtime Configuration & Setup"]:::runtime
        RuntimeExec["Execution Context & Handlers"]:::runtime
        RuntimePipelines["Pipelines & Routes"]:::runtime
        RuntimeGateways["Protocol Gateways"]:::runtime
        RuntimeTransports["Transports (HTTP, MQTT, OPCUA)"]:::runtime
        RuntimePlugins["Plugin Definitions"]:::runtime
        RuntimeServer["Server Startup"]:::runtime
        RuntimeLogging["Logging Provider"]:::runtime
    end

    %% Steward Orchestrator
    subgraph "Steward Orchestrator/CLI" 
        StewardCore["Steward Orchestrator Core"]:::steward
        StewardReqRes["Request/Response Models"]:::steward
        StewardActuators["Actuator Clients & Models"]:::steward
        StewardClients["Clients"]:::steward
        StewardInformants["Informants & Status Checkers"]:::steward
        StewardUtils["Utility Functions"]:::steward
        subgraph "Commit/Check/Delete Handlers"
            Commit["commit.handler.ts"]:::steward
            CommitCheck["commit-check.handler.ts"]:::steward
            Delete["delete.handler.ts"]:::steward
        end
    end

    %% External Systems & Services
    AzureBlob[("Azure Blob Storage")]:::external
    DenoKV[("Deno KV")]:::external
    NPMRegistry[("NPM Registry")]:::external
    RemoteESM[("Remote HTTP/ESM")]:::external
    OPCUASrv[("OPC UA Servers")]:::external
    MQTTBroker[("MQTT Brokers")]:::external

    %% Relationships
    DeveloperApp -->|imports| CoreEAC
    DeveloperApp -->|uses modules| Fluent
    Fluent -->|builds modules| DeveloperApp
    CoreEAC -->|invokes| RuntimeCore
    CoreEAC -->|invokes| DFS
    DFS -->|handler→resolver→worker| DFSHandlers
    DFSHandlers --> DFSResolvers
    DFSResolvers --> DFSWorkers
    RuntimeCore -->|loads/stores| DFS
    RuntimeCore -->|configured by| RuntimeConfig
    RuntimeCore -->|executes| RuntimeExec
    RuntimeExec --> RuntimePipelines
    RuntimePipelines --> RuntimeGateways
    RuntimeGateways --> RuntimeTransports
    RuntimeCore --> RuntimePlugins
    RuntimeCore --> RuntimeServer
    RuntimeCore --> RuntimeLogging
    RuntimeTransports --> OPCUASrv
    RuntimeTransports --> MQTTBroker
    RuntimeTransports --> DeveloperApp
    StewardCore -->|uses| CoreEAC
    StewardCore -->|calls| Commit
    StewardCore -->|calls| CommitCheck
    StewardCore -->|calls| Delete
    Commit --> StewardActuators
    CommitCheck --> StewardActuators
    Delete --> StewardActuators
    StewardActuators --> AzureBlob
    StewardActuators --> DenoKV
    StewardActuators --> NPMRegistry
    StewardActuators --> RemoteESM
    StewardInformants --> AzureBlob
    StewardInformants --> DenoKV
    StewardInformants --> NPMRegistry
    StewardInformants --> RemoteESM

    %% Click Events
    click CoreEAC "https://github.com/fathym-deno/eac/tree/integration/src/eac"
    click SharedTypes "https://github.com/fathym-deno/eac/tree/integration/src/types"
    click DFS "https://github.com/fathym-deno/eac/tree/integration/src/dfs"
    click DFSHandlers "https://github.com/fathym-deno/eac/tree/integration/src/dfs/handlers"
    click DFSResolvers "https://github.com/fathym-deno/eac/tree/integration/src/dfs/resolvers"
    click DFSWorkers "https://github.com/fathym-deno/eac/tree/integration/src/dfs/workers"
    click RuntimeCore "https://github.com/fathym-deno/eac/tree/integration/src/runtime/_"
    click RuntimeConfig "https://github.com/fathym-deno/eac/tree/integration/src/runtime/config"
    click RuntimeExec "https://github.com/fathym-deno/eac/tree/integration/src/runtime/execution"
    click RuntimeGateways "https://github.com/fathym-deno/eac/tree/integration/src/runtime/gateways"
    click RuntimeTransports "https://github.com/fathym-deno/eac/tree/integration/src/runtime/gateways/transports"
    click RuntimePipelines "https://github.com/fathym-deno/eac/tree/integration/src/runtime/pipelines"
    click RuntimePlugins "https://github.com/fathym-deno/eac/tree/integration/src/runtime/plugins"
    click RuntimeServer "https://github.com/fathym-deno/eac/tree/integration/src/runtime/server"
    click RuntimeLogging "https://github.com/fathym-deno/eac/tree/integration/src/runtime/logging"
    click StewardCore "https://github.com/fathym-deno/eac/tree/integration/src/steward/_"
    click Commit "https://github.com/fathym-deno/eac/blob/integration/src/steward/_/commit.handler.ts"
    click CommitCheck "https://github.com/fathym-deno/eac/blob/integration/src/steward/_/commit-check.handler.ts"
    click Delete "https://github.com/fathym-deno/eac/blob/integration/src/steward/_/delete.handler.ts"
    click StewardReqRes "https://github.com/fathym-deno/eac/tree/integration/src/steward/_/reqres"
    click StewardActuators "https://github.com/fathym-deno/eac/tree/integration/src/steward/actuators"
    click StewardClients "https://github.com/fathym-deno/eac/tree/integration/src/steward/clients"
    click StewardInformants "https://github.com/fathym-deno/eac/tree/integration/src/steward/informants"
    click StewardUtils "https://github.com/fathym-deno/eac/tree/integration/src/steward/utils"
    click Fluent "https://github.com/fathym-deno/eac/tree/integration/src/fluent"
    click Esbuild "https://github.com/fathym-deno/eac/tree/integration/src/esbuild"

    %% Styles
    classDef core fill:#cce5ff,stroke:#004085,color:#004085
    classDef dfs fill:#d4edda,stroke:#155724,color:#155724
    classDef runtime fill:#fff3cd,stroke:#856404,color:#856404
    classDef steward fill:#e2e3e5,stroke:#383d41,color:#383d41
    classDef fluent fill:#f8f9fa,stroke:#6c757d,color:#6c757d
    classDef external fill:#f5c6cb,stroke:#721c24,color:#721c24
```
