# beemol/llcore architecture

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

- Interactive diagram: https://gitdiagram.com/beemol/llcore
- Repository: https://github.com/beemol/llcore

## Overview

LLCore is a Swift library for exchange API integration. Its principal workflow is to configure an exchange and endpoint, build a signed request, and parse wallet or API-key information returned by the exchange; error detectors translate HTTP and exchange-payload failures into domain errors. The library also exposes polling and shared data models. The excerpts show the components and some dependencies, but not a complete request-execution path, so connections between request construction and response parsing are left unverified.

Main entry points: [`Sources/LLCore/Models/ExchangeRegistry.swift`](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/ExchangeRegistry.swift) (Exchange registry), [`Sources/LLCore/ErrorModel/APIDomainError.swift`](https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorModel/APIDomainError.swift) (Domain errors), [`Sources/LLCore/RequestBuilders/APIRequestBuilder.swift`](https://github.com/beemol/llcore/blob/main/Sources/LLCore/RequestBuilders/APIRequestBuilder.swift) (Signed request builders), [`Sources/LLCore/Parsers/ByBitApiKeyInfoParser.swift`](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Parsers/ByBitApiKeyInfoParser.swift) (ByBit key parser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_exchange_config["Exchange configuration"]
  node_registry["Exchange registry"]
  node_exchange_types["Exchange types<br/>[ExchangeType.swift]"]
end

subgraph group_api_access["Requests and parsing"]
  node_request_builders["Signed request builders"]
  node_wallet_parsers["Wallet parsers<br/>[Parsers.swift]"]
  node_key_info_parser["ByBit key parser"]
end

subgraph group_error_handling["Error handling"]
  node_app_error_detectors["Exchange error detectors"]
  node_http_error_detector["HTTP error detector"]
  node_error_mapper["HTTP error mapper"]
  node_error_codes["Exchange error codes"]
  node_domain_errors["Domain errors"]
end

subgraph group_runtime_models["Runtime support"]
  node_key_info_data["API key data"]
  node_data_models["Shared data models<br/>[DataModel.swift]"]
  node_polling["Polling strategy"]
  node_helpers["Core helpers<br/>[Helpers.swift]"]
end

node_client(("Library client"))
node_exchange_api(("Exchange API"))

node_client -.->|"configures"| node_registry
node_registry -->|"uses capabilities"| node_exchange_types
node_registry -->|"registers factories"| node_request_builders
node_registry -->|"registers factories"| node_wallet_parsers
node_registry -->|"registers factory"| node_key_info_parser
node_request_builders -->|"reads endpoints"| node_exchange_types
node_request_builders -.->|"sends signed request"| node_exchange_api
node_exchange_api -.->|"returns wallet data"| node_wallet_parsers
node_exchange_api -.->|"returns key data"| node_key_info_parser
node_key_info_parser -->|"creates model"| node_key_info_data
node_http_error_detector -->|"maps HTTP errors"| node_error_mapper
node_http_error_detector -->|"checks payload errors"| node_app_error_detectors
node_app_error_detectors -->|"throws domain errors"| node_domain_errors
node_error_mapper -->|"returns mapped errors"| node_domain_errors
node_error_codes -->|"defines error codes"| node_domain_errors
node_polling -->|"reports retry limit"| node_domain_errors

click node_registry "https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/ExchangeRegistry.swift"
click node_exchange_types "https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/ExchangeType.swift"
click node_request_builders "https://github.com/beemol/llcore/blob/main/Sources/LLCore/RequestBuilders/APIRequestBuilder.swift"
click node_wallet_parsers "https://github.com/beemol/llcore/blob/main/Sources/LLCore/Parsers/Parsers.swift"
click node_key_info_parser "https://github.com/beemol/llcore/blob/main/Sources/LLCore/Parsers/ByBitApiKeyInfoParser.swift"
click node_key_info_data "https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/ApiKeyInfoData.swift"
click node_data_models "https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/DataModel.swift"
click node_app_error_detectors "https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorHandlers/ErrorDetector.swift"
click node_http_error_detector "https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorHandlers/HTTPStatusErrorDetector.swift"
click node_error_mapper "https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorModel/APIErrorMapper.swift"
click node_error_codes "https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorModel/ExchangeAPIErrorCode.swift"
click node_domain_errors "https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorModel/APIDomainError.swift"
click node_polling "https://github.com/beemol/llcore/blob/main/Sources/LLCore/Service/PollingStrategy.swift"
click node_helpers "https://github.com/beemol/llcore/blob/main/Sources/LLCore/Helpers.swift"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_registry,node_exchange_types,node_client toneBlue
class node_request_builders,node_wallet_parsers,node_key_info_parser toneAmber
class node_app_error_detectors,node_http_error_detector,node_error_mapper,node_error_codes,node_domain_errors,node_exchange_api toneMint
class node_key_info_data,node_data_models,node_polling,node_helpers toneRose
```

## Components

### Exchange configuration

- [Exchange registry](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/ExchangeRegistry.swift): `Sources/LLCore/Models/ExchangeRegistry.swift`
- [Exchange types](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/ExchangeType.swift): `Sources/LLCore/Models/ExchangeType.swift`

### Requests and parsing

- [Signed request builders](https://github.com/beemol/llcore/blob/main/Sources/LLCore/RequestBuilders/APIRequestBuilder.swift): `Sources/LLCore/RequestBuilders/APIRequestBuilder.swift`
- [Wallet parsers](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Parsers/Parsers.swift): `Sources/LLCore/Parsers/Parsers.swift`
- [ByBit key parser](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Parsers/ByBitApiKeyInfoParser.swift): `Sources/LLCore/Parsers/ByBitApiKeyInfoParser.swift`

### Error handling

- [Exchange error detectors](https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorHandlers/ErrorDetector.swift): `Sources/LLCore/ErrorHandlers/ErrorDetector.swift`
- [HTTP error detector](https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorHandlers/HTTPStatusErrorDetector.swift): `Sources/LLCore/ErrorHandlers/HTTPStatusErrorDetector.swift`
- [HTTP error mapper](https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorModel/APIErrorMapper.swift): `Sources/LLCore/ErrorModel/APIErrorMapper.swift`
- [Exchange error codes](https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorModel/ExchangeAPIErrorCode.swift): `Sources/LLCore/ErrorModel/ExchangeAPIErrorCode.swift`
- [Domain errors](https://github.com/beemol/llcore/blob/main/Sources/LLCore/ErrorModel/APIDomainError.swift): `Sources/LLCore/ErrorModel/APIDomainError.swift`

### Runtime support

- [API key data](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/ApiKeyInfoData.swift): `Sources/LLCore/Models/ApiKeyInfoData.swift`
- [Shared data models](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Models/DataModel.swift): `Sources/LLCore/Models/DataModel.swift`
- [Polling strategy](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Service/PollingStrategy.swift): `Sources/LLCore/Service/PollingStrategy.swift`
- [Core helpers](https://github.com/beemol/llcore/blob/main/Sources/LLCore/Helpers.swift): `Sources/LLCore/Helpers.swift`

### Other components

- **Library client**
- **Exchange API**

## Connections

- Library client → Exchange registry: configures
- Exchange registry → Exchange types: uses capabilities (evidence: `Sources/LLCore/Models/ExchangeRegistry.swift`)
- Exchange registry → Signed request builders: registers factories (evidence: `Sources/LLCore/Models/ExchangeRegistry.swift`)
- Exchange registry → Wallet parsers: registers factories (evidence: `Sources/LLCore/Models/ExchangeRegistry.swift`)
- Exchange registry → ByBit key parser: registers factory (evidence: `Sources/LLCore/Models/ExchangeRegistry.swift`)
- Signed request builders → Exchange types: reads endpoints (evidence: `Sources/LLCore/RequestBuilders/APIRequestBuilder.swift`)
- Signed request builders → Exchange API: sends signed request
- Exchange API → Wallet parsers: returns wallet data
- Exchange API → ByBit key parser: returns key data
- ByBit key parser → API key data: creates model (evidence: `Sources/LLCore/Parsers/ByBitApiKeyInfoParser.swift`)
- HTTP error detector → HTTP error mapper: maps HTTP errors (evidence: `Sources/LLCore/ErrorHandlers/HTTPStatusErrorDetector.swift`)
- HTTP error detector → Exchange error detectors: checks payload errors (evidence: `Sources/LLCore/ErrorHandlers/HTTPStatusErrorDetector.swift`)
- Exchange error detectors → Domain errors: throws domain errors (evidence: `Sources/LLCore/ErrorHandlers/ErrorDetector.swift`)
- HTTP error mapper → Domain errors: returns mapped errors (evidence: `Sources/LLCore/ErrorModel/APIErrorMapper.swift`)
- Exchange error codes → Domain errors: defines error codes (evidence: `Sources/LLCore/ErrorModel/ExchangeAPIErrorCode.swift`)
- Polling strategy → Domain errors: reports retry limit (evidence: `Sources/LLCore/Service/PollingStrategy.swift`)
