# meltano/sdk architecture

> Architecture diagram of the GitHub repository meltano/sdk, 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/meltano/sdk
- Repository: https://github.com/meltano/sdk

## Overview

##### Main Components

a. Core SDK Components:
- Tap Base Framework
- Target Base Framework
- Mapper Framework
- Stream Processing Engine
- Authentication System
- Configuration Management

b. Stream Types:
- REST Streams
- GraphQL Streams
- SQL Streams
- Custom Stream Types

c. Supporting Systems:
- Batch Processing
- State Management
- Schema Management
- Testing Framework

**┌─ SDK Core Layer ──────────────────────────────────────┐**

- ┌─ Stream Engine ─┐ ┌─ Authentication ┐ ┌─ Config ┐  │

- ┘ └─────────────────┘ └─────────┘  │

- ┘

**┌─ Implementation Layer ─────────────────────────────────┐**

- ┌─ Tap Base ───┐ ┌─ Target Base ──┐ ┌─ Mapper ───┐  │

- ┘ └────────────────┘ └────────────┘  │

- ┘

**┌─ Stream Types Layer ─────────────────────────────────┐**

- ┌─ REST ─┐ ┌─ GraphQL ┐ ┌─ SQL ─┐ ┌─ Custom ─┐    │

- ┘ └──────────┘ └───────┘ └──────────┘    │

- ┘

**┌─ Support Systems Layer ────────────────────────────────┐**

- ┌─ Testing ─┐ ┌─ Batching ─┐ ┌─ State Management ┐  │

- ┘ └────────────┘ └───────────────────┘  │

- ┘

##### Connection Types

- API calls (bold lines)

##### Additional Elements

- External Systems Integration
- Configuration Schema Management
- Authentication Providers
- Logging and Metrics
- CLI Interface

##### Implementation Details

Implementation aspects:
- Singer message flow
- State management
- Schema handling
- Authentication flow
- Error handling

Remember to include bidirectional relationships where appropriate, especially between the core components and their implementations, and clearly show how data flows through the system from source to destination.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef core fill:#2374ab
    classDef implementation fill:#48a9a6
    classDef stream fill:#f4845f
    classDef support fill:#9b6b9d
    classDef template fill:#d7af70

    %% Core SDK Layer
    subgraph CoreLayer["Core SDK Layer"]
        StreamEngine["Stream Engine"]
        Auth["Authentication System"]
        Config["Configuration Management"]
        TypeSystem["Type System"]
        Metrics["Metrics System"]
    end

    %% Implementation Layer
    subgraph ImplLayer["Implementation Layer"]
        TapBase["Tap Base Framework"]
        TargetBase["Target Base Framework"]
        MapperBase["Mapper Framework"]
        SinkImpl["Sink Implementation"]
    end

    %% Stream Types Layer
    subgraph StreamLayer["Stream Types Layer"]
        REST["REST Streams"]
        GraphQL["GraphQL Streams"]
        SQL["SQL Streams"]
        CoreStream["Core Stream"]
    end

    %% Support Systems Layer
    subgraph SupportLayer["Support Systems Layer"]
        Testing["Testing Framework"]
        BatchProc["Batch Processing"]
        StateMan["State Management"]
        Schema["Schema Management"]
        Pagination["Pagination System"]
    end

    %% Templates Layer
    subgraph TemplateLayer["Templates Layer"]
        TapTemplate["Tap Template"]
        TargetTemplate["Target Template"]
        MapperTemplate["Mapper Template"]
    end

    %% Relationships
    StreamEngine --> TapBase
    StreamEngine --> TargetBase
    Auth --> TapBase
    Config --> TapBase
    Config --> TargetBase
    
    TapBase --> REST
    TapBase --> GraphQL
    TapBase --> SQL
    TapBase --> CoreStream
    
    TargetBase --> SinkImpl
    MapperBase --> SinkImpl
    
    BatchProc --> SinkImpl
    StateMan --> TapBase
    Schema --> StreamEngine
    Pagination --> REST
    
    TapTemplate --> TapBase
    TargetTemplate --> TargetBase
    MapperTemplate --> MapperBase

    %% Styling
    class StreamEngine,Auth,Config,TypeSystem,Metrics core
    class TapBase,TargetBase,MapperBase,SinkImpl implementation
    class REST,GraphQL,SQL,CoreStream stream
    class Testing,BatchProc,StateMan,Schema,Pagination support
    class TapTemplate,TargetTemplate,MapperTemplate template

    %% Click events
    click TapBase "https://github.com/meltano/sdk/blob/main/singer_sdk/tap_base.py"
    click TargetBase "https://github.com/meltano/sdk/blob/main/singer_sdk/target_base.py"
    click MapperBase "https://github.com/meltano/sdk/blob/main/singer_sdk/mapper_base.py"
    click Auth "https://github.com/meltano/sdk/blob/main/singer_sdk/authenticators.py"
    click Config "https://github.com/meltano/sdk/tree/main/singer_sdk/configuration/"
    click REST "https://github.com/meltano/sdk/blob/main/singer_sdk/streams/rest.py"
    click GraphQL "https://github.com/meltano/sdk/blob/main/singer_sdk/streams/graphql.py"
    click SQL "https://github.com/meltano/sdk/blob/main/singer_sdk/streams/sql.py"
    click CoreStream "https://github.com/meltano/sdk/blob/main/singer_sdk/streams/core.py"
    click BatchProc "https://github.com/meltano/sdk/blob/main/singer_sdk/batch.py"
    click StateMan "https://github.com/meltano/sdk/blob/main/singer_sdk/helpers/_state.py"
    click Schema "https://github.com/meltano/sdk/blob/main/singer_sdk/_singerlib/schema.py"
    click Testing "https://github.com/meltano/sdk/tree/main/singer_sdk/testing/"
    click SinkImpl "https://github.com/meltano/sdk/tree/main/singer_sdk/sinks/"
    click Pagination "https://github.com/meltano/sdk/blob/main/singer_sdk/pagination.py"
    click TypeSystem "https://github.com/meltano/sdk/blob/main/singer_sdk/typing.py"
    click Metrics "https://github.com/meltano/sdk/blob/main/singer_sdk/metrics.py"
    click TapTemplate "https://github.com/meltano/sdk/tree/main/cookiecutter/tap-template/"
    click TargetTemplate "https://github.com/meltano/sdk/tree/main/cookiecutter/target-template/"
    click MapperTemplate "https://github.com/meltano/sdk/tree/main/cookiecutter/mapper-template/"
```
