# gnieh/fs2-data architecture

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

- Interactive diagram: https://gitdiagram.com/gnieh/fs2-data
- Repository: https://github.com/gnieh/fs2-data

## Overview

##### Main Components Identification

a. Core Data Processing Components:
- CSV Parser/Encoder
- JSON Parser/Encoder
- XML Parser/Encoder
- CBOR Parser/Encoder
- MessagePack Parser
- Text Processing

b. Integration Components:
- Circe Integration (JSON)
- Play JSON Integration
- Scala XML Integration

##### Architecture Layers

**┌─────────────────────────────────────────────────────────┐**
- Client Applications                   │
- ┘
- ▲

**┌─────────────────────────────────────────────────────────┐**
- Integration Layer                      │
- ┌──────────┐  ┌──────────┐  ┌──────────────────────┐  │
- Circe   │  │   Play   │  │     Scala XML        │  │
- ┘  └──────────┘  └──────────────────────┘  │
- ┘
- ▲

**┌─────────────────────────────────────────────────────────┐**
- Core Parsers                         │
- ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌────────┐  │
- CSV    │  │   JSON   │  │   XML    │  │  CBOR  │  │
- ┘  └──────────┘  └──────────┘  └────────┘  │
- ┌──────────┐  ┌──────────────────────────────────────┐ │
- MsgPack  │  │            Text Processing           │ │
- ┘  └──────────────────────────────────────┘ │
- ┘
- ▲

**┌─────────────────────────────────────────────────────────┐**
- fs2                             │
- ┘

##### Component Details

Each parser module should show:
- Input/Output streams
- Parser/Encoder components
- Format-specific features (e.g., XPath for XML, JQ for JSON)

- → Streaming data flow
- ⇢ Control flow
- ⇄ Bidirectional communication

##### Additional Elements

Include:
- Version information
- Key dependencies (fs2, cats-effect)
- Cross-platform support indicators (JVM/JS)

##### Implementation Notes

- Streaming nature of the parsers
- Pure functional implementation
- Cross-platform compatibility
- Integration possibilities

##### Technical Details

Important technical aspects:
- Generic type parameters
- Error handling flow
- Resource management
- Performance considerations

- How data flows through the system
- Available parsing options
- Integration possibilities
- System boundaries and dependencies

Remember to maintain a balance between detail and clarity, focusing on the streaming nature of the library while showing its extensibility through various format support and integrations.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client["Client Applications"]
        App[Client Code]
    end

    subgraph Integration["Integration Layer"]
        Circe["Circe JSON"]:::integration
        Play["Play JSON"]:::integration
        ScalaXml["Scala XML"]:::integration
    end

    subgraph Core["Core Parsers"]
        CSV["CSV Parser/Encoder"]:::core
        JSON["JSON Parser/Encoder"]:::core
        XML["XML Parser/Encoder"]:::core
        CBOR["CBOR Parser/Encoder"]:::core
        MsgPack["MessagePack Parser"]:::core
        Text["Text Processing"]:::core
    end

    subgraph Base["Base Layer"]
        FS2["fs2 Streams"]:::base
    end

    %% Connections
    App --> Integration
    Circe --> JSON
    Play --> JSON
    ScalaXml --> XML
    
    CSV --> FS2
    JSON --> FS2
    XML --> FS2
    CBOR --> FS2
    MsgPack --> FS2
    Text --> FS2

    %% Click events
    click CSV "https://github.com/gnieh/fs2-data/tree/main/csv/shared/src/main/scala/fs2/data/csv/"
    click JSON "https://github.com/gnieh/fs2-data/tree/main/json/src/main/scala/fs2/data/json/"
    click XML "https://github.com/gnieh/fs2-data/tree/main/xml/src/main/scala/fs2/data/xml/"
    click CBOR "https://github.com/gnieh/fs2-data/tree/main/cbor/shared/src/main/scala/fs2/data/cbor/"
    click MsgPack "https://github.com/gnieh/fs2-data/tree/main/msgpack/src/main/scala/fs2/data/msgpack/"
    click Text "https://github.com/gnieh/fs2-data/tree/main/text/shared/src/main/scala/fs2/data/text/"
    click Circe "https://github.com/gnieh/fs2-data/blob/main/json/circe/src/main/scala/fs2/data/json/circe/package.scala"
    click Play "https://github.com/gnieh/fs2-data/blob/main/json/play/src/main/scala/fs2/data/json/playJson/package.scala"
    click ScalaXml "https://github.com/gnieh/fs2-data/blob/main/xml/scala-xml/src/main/scala/fs2/data/xml/scalaXml/package.scala"

    %% Styling
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef integration fill:#4CAF50,stroke:#2E7D32,color:white
    classDef base fill:#9E9E9E,stroke:#616161,color:white

    %% Legend
    subgraph Legend
        CoreL["Core Components"]:::core
        IntegrationL["Integration Modules"]:::integration
        BaseL["Base Layer"]:::base
    end
```
