# pkallos/winston-firehose architecture

> Architecture diagram of the GitHub repository pkallos/winston-firehose, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/pkallos/winston-firehose
- Repository: https://github.com/pkallos/winston-firehose

## Overview

##### Main Components

a. Client Application Layer
- Application using Winston logger
- Winston Logger core as a separate component
- Winston-Firehose transport module (this project)

b. AWS Integration Layer
- AWS Kinesis Firehose
- Optional: Show potential downstream services (S3, Elasticsearch, etc.)

##### Component Relationships

**[Client Application] → [Winston Logger] → [Winston-Firehose Transport] → [AWS Kinesis Firehose]**

##### Detailed Component Breakdown

For the Winston-Firehose Transport (core project), show these internal components based on the file structure:

- FirehoseTransport (src/firehose-transport.ts)
- FirehoseSender (src/firehose-sender.ts)
- Interface/Types Layer (src/interfaces.ts, src/types.ts)

##### Key Elements to Highlight

a. Data Flow:
- Log message creation
- Message transformation (JSON stringify)
- Firehose delivery
- Error handling paths (unacknowledged messages)

b. Configuration Options:
- Stream name
- Firehose options
- Logger level settings
- Format options

##### Specific Details

- Message format example:
- {
- timestamp: ISO string,
- level: string,
- message: string,
- metadata: object
- }

- Configuration options panel
- Error handling paths
- Asynchronous nature of the transport

##### Important Notes

- Unacknowledged nature of log messages
- Error event emission path
- AWS region configuration
- Optional logger level and format inheritance

- Configuration options

This will create a comprehensive yet clear visualization of how the Winston-Firehose transport functions within the larger logging ecosystem.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client ["Client Application Layer"]
        App[Client Application]
        Winston[Winston Logger]
        App --> Winston
    end

    subgraph Transport ["Winston-Firehose Transport Layer"]
        FT[FirehoseTransport]:::core
        FS[FirehoseTransporter]:::core
        IT[Interfaces & Types]:::core
        Entry[Entry Point]:::core
        
        FT --> FS
        FT --> IT
        Entry --> FT
    end

    subgraph AWS ["AWS Layer"]
        Firehose[(AWS Kinesis Firehose)]:::aws
        S3[(S3)]:::aws
        ES[(Elasticsearch)]:::aws
        
        Firehose --> S3
        Firehose --> ES
    end

    subgraph Testing ["Testing Components"]
        LT[Logger Tests]:::test
        TT[Transport Tests]:::test
        LLT[Level Tests]:::test
        FET[Firehose Emitter Tests]:::test
        EOT[EOL Options Tests]:::test
        TSU[Test Support Utils]:::test
    end

    subgraph Config ["Configuration"]
        TS[TypeScript Config]:::config
        PKG[Package Config]:::config
        CI[CI Pipeline]:::config
    end

    Winston --> FT
    FS --> Firehose

    %% Click Events
    click FT "https://github.com/pkallos/winston-firehose/blob/master/src/firehose-transport.ts"
    click FS "https://github.com/pkallos/winston-firehose/blob/master/src/firehose-sender.ts"
    click IT "https://github.com/pkallos/winston-firehose/blob/master/src/interfaces.ts"
    click Entry "https://github.com/pkallos/winston-firehose/blob/master/src/index.ts"
    click LT "https://github.com/pkallos/winston-firehose/blob/master/spec/logger.spec.ts"
    click TT "https://github.com/pkallos/winston-firehose/blob/master/spec/transport.spec.ts"
    click LLT "https://github.com/pkallos/winston-firehose/blob/master/spec/logger-level.spec.ts"
    click FET "https://github.com/pkallos/winston-firehose/blob/master/spec/firehose-emitter.spec.ts"
    click EOT "https://github.com/pkallos/winston-firehose/blob/master/spec/options.eol.spec.ts"
    click TSU "https://github.com/pkallos/winston-firehose/blob/master/spec/support/test-sender.ts"
    click CI "https://github.com/pkallos/winston-firehose/blob/master/.github/workflows/build.yml"
    click TS "https://github.com/pkallos/winston-firehose/blob/master/tsconfig.json"
    click PKG "https://github.com/pkallos/winston-firehose/blob/master/package.json"

    %% Styling
    classDef core fill:#2374ab,stroke:#2374ab,color:#fff
    classDef aws fill:#ff9900,stroke:#ff9900,color:#000
    classDef test fill:#95b8d1,stroke:#95b8d1,color:#000
    classDef config fill:#8b8c89,stroke:#8b8c89,color:#fff

    %% Legend
    subgraph Legend
        C1[Core Components]:::core
        C2[AWS Services]:::aws
        C3[Test Components]:::test
        C4[Configuration]:::config
    end
```
