# presentkim-pm/nbt-serializer architecture

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

- Interactive diagram: https://gitdiagram.com/presentkim-pm/nbt-serializer
- Repository: https://github.com/presentkim-pm/nbt-serializer

## Overview

**┌─ Public API Layer ─────────────────────┐**
- NbtSerializer Interface         │
- ┬────────────────────────┘

**┌─ Core Logic Layer ──────────────────────────────────────┐**
- ┌─────────────────┐  ┌─────────────────┐  ┌──────────┐ │
- SNBT Parser    │  │ Binary Handler  │  │  Base64  │ │
- ┘  └─────────────────┘  └──────────┘ │
- ┬─┘

**┌─ Exception Layer ──────────────────────────────────────┐**
- ┌─────────────┐ ┌──────────────┐ ┌──────────────────┐ │
- SnbtDataExc. │ │SnbtSyntaxExc.│ │SnbtUnexpectedEnd │ │
- ┘ └──────────────┘ └──────────────────┘ │
- ┘

##### Component Details

- Rectangle with rounded corners for the public API interface (blue)
- Regular rectangles for core processing components (green)
- Hexagons for data transformation utilities (orange)
- Red rectangles for exception handling components

**Input → NbtSerializer → Specific Handler → Output**
- ↓                                        ↑
- Exception Handling ──────────┘

##### Supported Formats

- StringifiedNBT (SNBT)
- Binary
- Base64
- Hexadecimal

##### Implementation Notes

A notes section indicating:
- Namespace: kim\present\serializer\nbt
- Performance characteristics
- Format compatibility
- Error handling strategies

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Public_API
        API[NbtSerializer Interface]:::api
    end

    subgraph Core_Logic
        SNBT[StringifiedNbtParser]:::core
        Binary[Binary Handler]:::core
        Base64[Base64 Encoder/Decoder]:::core
        Hex[Hexadecimal Handler]:::core
    end

    subgraph Exception_Handling
        DataExc[SnbtDataException]:::error
        SyntaxExc[SnbtSyntaxException]:::error
        EndExc[SnbtUnexpectedEndException]:::error
    end

    subgraph Input_Output
        Input[Tag Objects]:::data
        Output[Serialized Data]:::data
    end

    %% Connections
    Input --> API
    API --> SNBT
    API --> Binary
    API --> Base64
    API --> Hex
    
    SNBT --> Output
    Binary --> Output
    Base64 --> Output
    Hex --> Output

    %% Error Handling Paths
    SNBT -.-> DataExc
    SNBT -.-> SyntaxExc
    SNBT -.-> EndExc
    Binary -.-> DataExc
    
    %% Legend
    subgraph Legend
        L1[API Interface]:::api
        L2[Core Components]:::core
        L3[Error Handlers]:::error
        L4[Data Objects]:::data
    end

    %% Styles
    classDef api fill:#a8d5ff,stroke:#2980b9,stroke-width:2px
    classDef core fill:#a8e6cf,stroke:#1b4332,stroke-width:2px
    classDef error fill:#ffb3b3,stroke:#c0392b,stroke-width:2px
    classDef data fill:#ffd3b6,stroke:#e67e22,stroke-width:2px

    %% Click Events
    click API "https://github.com/presentkim-pm/nbt-serializer/blob/main/src/kim/present/serializer/nbt/NbtSerializer.php"
    click SNBT "https://github.com/presentkim-pm/nbt-serializer/blob/main/src/kim/present/serializer/nbt/StringifiedNbtParser.php"
    click DataExc "https://github.com/presentkim-pm/nbt-serializer/blob/main/src/kim/present/serializer/nbt/exception/SnbtDataException.php"
    click SyntaxExc "https://github.com/presentkim-pm/nbt-serializer/blob/main/src/kim/present/serializer/nbt/exception/SnbtSyntaxException.php"
    click EndExc "https://github.com/presentkim-pm/nbt-serializer/blob/main/src/kim/present/serializer/nbt/exception/SnbtUnexpectedEndException.php"
```
