# hylo-so/sdk architecture

> Architecture diagram of the GitHub repository hylo-so/sdk, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-10-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hylo-so/sdk
- Repository: https://github.com/hylo-so/sdk

## Overview

##### Project type and purpose
- This is a Rust SDK monorepo for the “Hylo” protocol on Solana.
- It ships as four distinct crates:
- hylo-core: core data types, math, utilities
- hylo-idl: IDL definitions and helpers for on‐chain programs
- hylo-clients: RPC client wrappers for interacting with Hylo programs
- hylo-jupiter: integration layer with the Jupiter swap aggregator
- Build and maintenance scripts live under bin/ and the repo is managed via Cargo + Nix Flakes.

##### File structure
- Top‐level: project‐wide configs (Cargo.toml, flake.nix, CI workflows, bin scripts).
- Four sibling subdirectories, each a Cargo crate with its own Cargo.toml and src/.
- Scripts in bin/ orchestrate linting, building, version checks, publishing.
- No “frontend” or “database” directories—this is a library SDK, not an application.

##### README for additional insights
- Confirms the four crates and their responsibilities.
- No runtime services or UIs—this is a set of reusable libraries.

##### Final advice
- Be exhaustive: represent all four crates plus the build environment and external systems.
- Both compile-time dependencies (crate layering) and runtime flows (RPC & API calls).
- Keep labels concise but specific (e.g., “hylo-clients: Solana RPC client”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Monorepo & Tooling
    subgraph "Monorepo & Tooling"
        RepoRoot["Repo Root\n(Cargo.toml, flake.nix)"]:::scripts
        CI["CI Workflow\n(.github/workflows/ci.yml)"]:::scripts
        Scripts["Build & Maintenance Scripts\n(bin/)"]:::scripts
    end

    %% Core Layer
    subgraph "Core Layer"
        hylo_core["hylo-core\n(Core types & math)"]:::core
        hylo_idl["hylo-idl\n(IDL definitions)"]:::core
    end

    %% Integration Layer
    subgraph "Client & Integration Layer"
        hylo_clients["hylo-clients\n(Solana RPC client)"]:::integration
        hylo_jupiter["hylo-jupiter\n(Jupiter swap integration)"]:::integration
    end

    %% External Systems
    subgraph "External Services"
        Solana["Solana Blockchain\n(RPC)"]:::external
        JupiterAPI["Jupiter Aggregator API"]:::external
    end

    %% Dependencies (Compile-time)
    hylo_clients -->|depends on| hylo_core
    hylo_clients -->|depends on| hylo_idl
    hylo_jupiter -->|depends on| hylo_core
    hylo_jupiter -->|depends on| hylo_clients

    %% Runtime Flows
    hylo_clients -->|RPC Call| Solana
    hylo_jupiter -->|API Call| JupiterAPI
    hylo_jupiter -->|send tx via| hylo_clients

    %% Tooling Relationships
    RepoRoot -->|defines| Scripts
    RepoRoot -->|manages| CI
    CI -.->|runs| Scripts

    %% Click Events
    click RepoRoot "https://github.com/hylo-so/sdk/blob/main/Cargo.toml"
    click RepoRoot "https://github.com/hylo-so/sdk/blob/main/flake.nix"
    click CI "https://github.com/hylo-so/sdk/blob/main/.github/workflows/ci.yml"
    click Scripts "https://github.com/hylo-so/sdk/blob/main/bin/build.sh"
    click Scripts "https://github.com/hylo-so/sdk/blob/main/bin/lint.sh"
    click Scripts "https://github.com/hylo-so/sdk/blob/main/bin/polish.sh"
    click Scripts "https://github.com/hylo-so/sdk/blob/main/bin/check-sdk-version.sh"
    click Scripts "https://github.com/hylo-so/sdk/blob/main/bin/publish.sh"
    click hylo_core "https://github.com/hylo-so/sdk/blob/main/hylo-core/Cargo.toml"
    click hylo_core "https://github.com/hylo-so/sdk/blob/main/hylo-core/src/lib.rs"
    click hylo_idl "https://github.com/hylo-so/sdk/blob/main/hylo-idl/Cargo.toml"
    click hylo_idl "https://github.com/hylo-so/sdk/blob/main/hylo-idl/src/lib.rs"
    click hylo_clients "https://github.com/hylo-so/sdk/blob/main/hylo-clients/Cargo.toml"
    click hylo_clients "https://github.com/hylo-so/sdk/blob/main/hylo-clients/src/lib.rs"
    click hylo_jupiter "https://github.com/hylo-so/sdk/blob/main/hylo-jupiter/Cargo.toml"
    click hylo_jupiter "https://github.com/hylo-so/sdk/blob/main/hylo-jupiter/src/lib.rs"

    %% Styles
    classDef core fill:#cfe2ff,stroke:#084298,color:#084298
    classDef integration fill:#d1e7dd,stroke:#0f5132,color:#0f5132
    classDef scripts fill:#e2e3e5,stroke:#41464b,color:#41464b
    classDef external fill:#ffe5b4,stroke:#ff7f0f,color:#ff7f0f
```
