# complyance-io/complyance-go-sdk architecture

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

- Interactive diagram: https://gitdiagram.com/complyance-io/complyance-go-sdk
- Repository: https://github.com/complyance-io/complyance-go-sdk

## Overview

Complyance Go SDK submits documents to the Unified ingestion API and exposes configured submission and status-retrieval operations. The primary workflow is caller → SDK submission → HTTP transport → Complyance API, with request validation and response parsing; raw methods also submit XML/JSON envelopes directly. Separate capabilities include persistent queuing, policy and document-type support, server middleware, retries, and ERP job operations. Edges reflect shown calls or README statements; several larger SDK modules were not excerpted, so uncertain internal wiring is omitted.

Main entry points: [`pkg/http/service.go`](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/service.go) (API service), [`pkg/http/client.go`](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/client.go) (HTTP client), [`pkg/sdk.go`](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/sdk.go) (Configured SDK), [`pkg/retry/retry.go`](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/retry/retry.go) (Retry strategy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_submission["Submission"]
  node_configured["Configured SDK<br/>[sdk.go]"]
  node_unify_ops["Unify operations<br/>[unify.go]"]
  node_raw_submit["Raw submissions<br/>[raw_unify.go]"]
  node_request_models["Request models<br/>[unify_request.go]"]
  node_response_models["Response models<br/>[unify_response.go]"]
  node_policy_registry["Country policies"]
  node_document_types["Document types"]
end

subgraph group_transport["HTTP transport"]
  node_http_service["API service<br/>[service.go]"]
  node_http_client["HTTP client<br/>[client.go]"]
  node_http_middleware["Request middleware<br/>[middleware.go]"]
  node_server_middleware["Server middleware"]
  node_http_response["HTTP response<br/>[response.go]"]
  node_config["SDK configuration<br/>[config.go]"]
end

subgraph group_resilience["Reliability"]
  node_retry_middleware["Retry middleware"]
  node_retry_strategy["Retry strategy<br/>[retry.go]"]
  node_circuit_breaker["Circuit breaker<br/>[circuit_breaker.go]"]
  node_persistent_queue[("Persistent queue")]
end

subgraph group_integrations["Domain integrations"]
  node_erp_client["ERP jobs client<br/>[client.go]"]
  node_webhooks["Purchase webhooks"]
end

node_caller(("SDK caller"))
node_complyance_api{{"Complyance API"}}
node_erp_service{{"ERP API"}}

node_caller -->|"submits raw"| node_raw_submit
node_caller -->|"uses SDK"| node_configured
node_configured -.->|"submits documents"| node_unify_ops
node_configured -.->|"uses service"| node_http_service
node_http_service -->|"creates client"| node_http_client
node_http_service -->|"validates request"| node_request_models
node_http_service -->|"parses response"| node_response_models
node_http_client -->|"applies middleware"| node_http_middleware
node_http_client -.->|"returns response"| node_http_response
node_http_service -->|"uses settings"| node_config
node_http_client -.->|"sends requests"| node_complyance_api
node_retry_middleware -->|"executes retries"| node_retry_strategy
node_retry_strategy -->|"checks breaker"| node_circuit_breaker
node_persistent_queue -->|"sends queued request"| node_configured
node_caller -.->|"uses policies"| node_policy_registry
node_caller -.->|"uses document types"| node_document_types
node_caller -.->|"wraps handlers"| node_server_middleware
node_caller -.->|"manages ERP jobs"| node_erp_client
node_erp_client -.->|"requests jobs"| node_erp_service
node_caller -.->|"uses webhooks"| node_webhooks

click node_configured "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/sdk.go"
click node_unify_ops "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/unify.go"
click node_raw_submit "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/raw_unify.go"
click node_request_models "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/models/unify_request.go"
click node_response_models "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/models/unify_response.go"
click node_policy_registry "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/country_policy_registry.go"
click node_document_types "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/document_type_v2.go"
click node_http_service "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/service.go"
click node_http_client "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/client.go"
click node_http_middleware "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/middleware.go"
click node_server_middleware "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/server_middleware.go"
click node_http_response "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/response.go"
click node_config "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/config/config.go"
click node_retry_middleware "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/retry_middleware.go"
click node_retry_strategy "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/retry/retry.go"
click node_circuit_breaker "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/retry/circuit_breaker.go"
click node_persistent_queue "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/persistent_queue_manager.go"
click node_erp_client "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/erp/client.go"
click node_webhooks "https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/purchase_webhooks.go"

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_configured,node_unify_ops,node_raw_submit,node_request_models,node_response_models,node_policy_registry,node_document_types toneBlue
class node_http_service,node_http_client,node_http_middleware,node_server_middleware,node_http_response,node_config toneAmber
class node_retry_middleware,node_retry_strategy,node_circuit_breaker,node_persistent_queue,node_complyance_api,node_erp_service toneMint
class node_erp_client,node_webhooks toneRose
class node_caller toneIndigo
```

## Components

### Submission

- [Configured SDK](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/sdk.go): `pkg/sdk.go`
- [Unify operations](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/unify.go): `pkg/unify.go`
- [Raw submissions](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/raw_unify.go): `pkg/raw_unify.go`
- [Request models](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/models/unify_request.go): `pkg/models/unify_request.go`
- [Response models](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/models/unify_response.go): `pkg/models/unify_response.go`
- [Country policies](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/country_policy_registry.go): `pkg/country_policy_registry.go`
- [Document types](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/document_type_v2.go): `pkg/document_type_v2.go`

### HTTP transport

- [API service](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/service.go): `pkg/http/service.go`
- [HTTP client](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/client.go): `pkg/http/client.go`
- [Request middleware](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/middleware.go): `pkg/http/middleware.go`
- [Server middleware](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/server_middleware.go): `pkg/http/server_middleware.go`
- [HTTP response](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/response.go): `pkg/http/response.go`
- [SDK configuration](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/config/config.go): `pkg/config/config.go`

### Reliability

- [Retry middleware](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/http/retry_middleware.go): `pkg/http/retry_middleware.go`
- [Retry strategy](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/retry/retry.go): `pkg/retry/retry.go`
- [Circuit breaker](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/retry/circuit_breaker.go): `pkg/retry/circuit_breaker.go`
- [Persistent queue](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/persistent_queue_manager.go): `pkg/persistent_queue_manager.go`

### Domain integrations

- [ERP jobs client](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/erp/client.go): `pkg/erp/client.go`
- [Purchase webhooks](https://github.com/complyance-io/complyance-go-sdk/blob/main/pkg/purchase_webhooks.go): `pkg/purchase_webhooks.go`

### Other components

- **SDK caller**
- **Complyance API**
- **ERP API**

## Connections

- SDK caller → Raw submissions: submits raw
- SDK caller → Configured SDK: uses SDK
- Configured SDK → Unify operations: submits documents
- Configured SDK → API service: uses service
- API service → HTTP client: creates client (evidence: `pkg/http/service.go`)
- API service → Request models: validates request (evidence: `pkg/http/service.go`)
- API service → Response models: parses response (evidence: `pkg/http/service.go`)
- HTTP client → Request middleware: applies middleware (evidence: `pkg/http/client.go`)
- HTTP client → HTTP response: returns response
- API service → SDK configuration: uses settings (evidence: `pkg/http/service.go`)
- HTTP client → Complyance API: sends requests
- Retry middleware → Retry strategy: executes retries (evidence: `pkg/http/retry_middleware.go`)
- Retry strategy → Circuit breaker: checks breaker (evidence: `pkg/retry/retry.go`)
- Persistent queue → Configured SDK: sends queued request (evidence: `pkg/persistent_queue_manager.go`)
- SDK caller → Country policies: uses policies
- SDK caller → Document types: uses document types
- SDK caller → Server middleware: wraps handlers
- SDK caller → ERP jobs client: manages ERP jobs
- ERP jobs client → ERP API: requests jobs
- SDK caller → Purchase webhooks: uses webhooks
