# minio/minio-go architecture

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

- Interactive diagram: https://gitdiagram.com/minio/minio-go
- Repository: https://github.com/minio/minio-go

## Overview

1. **What this repository is**
   - This is a **Go SDK/library**, not a server application. Its main job is to let client programs talk to **Amazon S3-compatible object storage** and MinIO-specific extensions.
   - The repository is organized around a single exported client API in the root package, with supporting packages under `pkg/` for cross-cutting concerns.

2. **Top-level architecture**
   - The root package contains the SDK surface: client creation, request construction, and all object/bucket operations.
   - Most `api-*.go` files are grouped by S3 capability, so the codebase maps closely to S3 resources: buckets, objects, lifecycle, policies, encryption, replication, tagging, notifications, presigned URLs, and select/restore flows.

3. **Client bootstrap and request pipeline**
   - `api.go`, `core.go`, `endpoints.go`, `transport.go`, `constants.go`, and `utils.go` form the core runtime path.
   - A consumer creates a client with endpoint and options, then each API call builds an HTTP request, signs it, sends it through the configured transport, and decodes the response into SDK types or errors.

4. **Authentication and signing boundary**
   - `pkg/credentials` is the credential provider layer. It supports multiple sources such as static credentials, environment variables, files, IAM-style flows, and STS/web identity/custom identity variants.
   - `pkg/signer` contains the request-signing implementations for **Signature V2, V4, and streaming variants**. This is a hard boundary: the rest of the SDK relies on signed requests but does not embed auth logic directly.

5. **HTTP transport and retry behavior**
   - `transport.go`, `retry.go`, and `retry-continous.go` control network behavior, including request execution, retries, and error handling.
   - This layer is important for architecture diagrams because it sits between all operations and the storage service; every bucket/object API depends on it.

6. **Object and bucket operations**
   - The dominant subsystem is the S3 API surface in the root package:
     - Bucket lifecycle: create/list/exist/remove.
     - Object lifecycle: put/get/stat/copy/delete.
     - Multipart, streaming, compose, append, file-based upload/download, and remove-many operations.
   - These APIs are the primary business path of the SDK and are the main external contract consumers use.

7. **Streaming, multipart, and file transfer paths**
   - Upload/download logic is split across `api-put-object*.go`, `api-get-object*.go`, `api-compose-object.go`, and related helpers.
   - The data flow here is from `io.Reader`, files, or streams into request bodies, often with checksum/part-management logic; on download, responses are exposed as readers or written to files.
   - Multipart and streaming support are central because they determine how large objects move through the SDK.

8. **Presigned and policy-based access**
   - `api-presigned.go` and `post-policy.go` support generating signed URLs and POST policies without directly performing the transfer.
   - This creates a distinct flow: the SDK can hand off access to external clients instead of acting as the data mover itself.

9. **Bucket and object configuration subsystems**
   - Several feature-specific files represent storage metadata/configuration APIs:
     - `api-bucket-cors.go`
     - `api-bucket-encryption.go`
     - `api-bucket-lifecycle.go`
     - `api-bucket-notification.go`
     - `api-bucket-policy.go`
     - `api-bucket-qos.go`
     - `api-bucket-replication.go`
     - `api-bucket-tagging.go`
     - `api-bucket-versioning.go`
     - object lock/retention/legal hold/tagging APIs
   - These are separate control-plane paths from the main data-plane object transfer operations.

10. **Supporting domain packages under `pkg/`**
   - `pkg/policy`, `pkg/lifecycle`, `pkg/notification`, `pkg/replication`, `pkg/tags`, `pkg/cors`, and `pkg/encrypt` model and parse the configuration payloads used by the corresponding APIs.
   - `pkg/sse` handles server-side encryption metadata, and `pkg/s3utils` contains shared S3-specific helpers.
   - These packages are mostly data/format boundaries: they convert between Go structures and the XML/JSON-ish shapes expected by S3/MinIO.

11. **Caching and concurrency helpers**
   - `bucket-cache.go`, `pkg/kvcache`, and `pkg/singleflight` provide internal optimization primitives for repeated lookups and coordinated requests.
   - These are not the main API surface, but they affect runtime behavior by reducing duplicate work and smoothing concurrent access patterns.

12. **Error model and response decoding**
   - `api-error-response.go`, `s3-error.go`, `200OKwithError_test.go`, and related tests show that the SDK explicitly handles non-trivial S3 responses, including “successful HTTP status with embedded error” cases.
   - This is important architecturally because response handling is not just status-code driven; the SDK has to parse service-specific error formats.

13. **MinIO-specific extensions and advanced features**
   - `rdma.go` / `rdma_stub.go`, `api-prompt-object.go`, `api-inventory-ext.go`, and notification listeners under `examples/minio` represent extensions beyond standard S3.
   - The `cmd/rdma-test` binary and the RDMA workflow indicate optional transport/path behavior that is gated by platform or build support.

14. **Examples, tests, and CI as usage documentation**
   - `examples/s3` and `examples/minio` are effectively a secondary architecture layer showing supported flows: bucket admin, object CRUD, encryption, replication, notifications, presigned access, and streaming.
   - The many `*_test.go` files plus GitHub Actions workflows indicate the SDK is validated across standard Go builds, Windows, RDMA-specific paths, and vulnerability checks.

15. **How to draw the diagram**
   - The clearest diagram is: **application code → root MinIO client → auth/signing + transport/retry → S3/MinIO endpoint**, with side branches for **credentials providers**, **configuration/domain packages**, and **special flows** like presigned URLs, notifications, multipart streaming, and MinIO extensions.

Main entry points: [`api.go`](https://github.com/minio/minio-go/blob/master/api.go) (Client API), [`core.go`](https://github.com/minio/minio-go/blob/master/core.go) (Core Flow), [`rdma.go`](https://github.com/minio/minio-go/blob/master/rdma.go) (MinIO Extensions), [`api-bucket-policy.go`](https://github.com/minio/minio-go/blob/master/api-bucket-policy.go) (Bucket Ops)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_group_root["Root SDK"]
  node_node_api["Client API<br/>sdk surface<br/>[api.go]"]
  node_node_core["Core Flow<br/>request pipeline<br/>[core.go]"]
  node_node_ops_bucket["Bucket Ops<br/>control-plane APIs"]
  node_node_ops_object["Object Ops<br/>data-plane APIs<br/>[api-put-object.go]"]
  node_node_ops_transfer["Transfer Paths<br/>multipart and streaming"]
  node_node_ops_access["Access Flows<br/>presigned and policy<br/>[api-presigned.go]"]
  node_node_ops_objectcfg["Object Config<br/>object metadata APIs<br/>[api-object-lock.go]"]
  node_node_errors["Error Model<br/>response parsing"]
end

subgraph group_group_auth["Auth"]
  node_node_creds["Credentials<br/>provider chain<br/>[credentials.go]"]
  node_node_signer["Signers<br/>sigv2-v4"]
end

subgraph group_group_domain["Domain Models"]
  node_node_domain["S3 Models<br/>shared payloads<br/>[bucket-policy.go]"]
  node_node_utils["S3 Utils<br/>helpers<br/>[utils.go]"]
end

subgraph group_group_runtime["Runtime"]
  node_node_transport["Transport<br/>http execution<br/>[transport.go]"]
  node_node_retry["Retry<br/>network resilience<br/>[retry.go]"]
  node_node_cache["Caches<br/>lookup optimization<br/>[bucket-cache.go]"]
end

subgraph group_group_extensions["Extensions"]
  node_node_ext["MinIO Extensions<br/>advanced features<br/>[rdma.go]"]
end

subgraph group_group_usage["Usage"]
  node_node_examples_s3["S3 Examples<br/>usage samples<br/>[putobject.go]"]
  node_node_examples_minio["MinIO Examples<br/>usage samples"]
  node_node_rdma["RDMA Test<br/>optional binary<br/>[main.go]"]
end

node_node_api -->|"uses"| node_node_core
node_node_core -->|"loads"| node_node_creds
node_node_core -->|"signs"| node_node_signer
node_node_core -->|"sends"| node_node_transport
node_node_transport -->|"wraps"| node_node_retry
node_node_api -->|"exposes"| node_node_ops_bucket
node_node_api -->|"exposes"| node_node_ops_object
node_node_api -->|"exposes"| node_node_ops_transfer
node_node_api -->|"exposes"| node_node_ops_access
node_node_api -->|"exposes"| node_node_ops_objectcfg
node_node_api -->|"decodes"| node_node_errors
node_node_ops_bucket -->|"serializes"| node_node_domain
node_node_ops_objectcfg -->|"serializes"| node_node_domain
node_node_ops_transfer -->|"streams"| node_node_utils
node_node_ops_access -->|"derives"| node_node_signer
node_node_ops_bucket -->|"optimizes"| node_node_cache
node_node_ops_object -->|"uses"| node_node_utils
node_node_ext -->|"depends on"| node_node_signer
node_node_ext -->|"extends"| node_node_transport
node_node_examples_s3 -->|"demonstrates"| node_node_api
node_node_examples_minio -->|"demonstrates"| node_node_ext
node_node_rdma -->|"exercises"| node_node_ext

click node_node_api "https://github.com/minio/minio-go/blob/master/api.go"
click node_node_core "https://github.com/minio/minio-go/blob/master/core.go"
click node_node_ops_bucket "https://github.com/minio/minio-go/blob/master/api-bucket-policy.go"
click node_node_ops_object "https://github.com/minio/minio-go/blob/master/api-put-object.go"
click node_node_ops_transfer "https://github.com/minio/minio-go/blob/master/api-put-object-multipart.go"
click node_node_ops_access "https://github.com/minio/minio-go/blob/master/api-presigned.go"
click node_node_ops_objectcfg "https://github.com/minio/minio-go/blob/master/api-object-lock.go"
click node_node_errors "https://github.com/minio/minio-go/blob/master/api-error-response.go"
click node_node_creds "https://github.com/minio/minio-go/blob/master/pkg/credentials/credentials.go"
click node_node_signer "https://github.com/minio/minio-go/blob/master/pkg/signer/request-signature-v4.go"
click node_node_transport "https://github.com/minio/minio-go/blob/master/transport.go"
click node_node_retry "https://github.com/minio/minio-go/blob/master/retry.go"
click node_node_cache "https://github.com/minio/minio-go/blob/master/bucket-cache.go"
click node_node_domain "https://github.com/minio/minio-go/blob/master/pkg/policy/bucket-policy.go"
click node_node_utils "https://github.com/minio/minio-go/blob/master/pkg/s3utils/utils.go"
click node_node_ext "https://github.com/minio/minio-go/blob/master/rdma.go"
click node_node_examples_s3 "https://github.com/minio/minio-go/blob/master/examples/s3/putobject.go"
click node_node_examples_minio "https://github.com/minio/minio-go/blob/master/examples/minio/listen-notification.go"
click node_node_rdma "https://github.com/minio/minio-go/blob/master/cmd/rdma-test/main.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_node_api,node_node_core,node_node_ops_bucket,node_node_ops_object,node_node_ops_transfer,node_node_ops_access,node_node_ops_objectcfg,node_node_errors toneBlue
class node_node_creds,node_node_signer toneAmber
class node_node_domain,node_node_utils toneMint
class node_node_transport,node_node_retry,node_node_cache toneRose
class node_node_ext toneIndigo
class node_node_examples_s3,node_node_examples_minio,node_node_rdma toneTeal
```

## Components

### Root SDK

Public client API and the core request/response pipeline in the root package.

- [Client API](https://github.com/minio/minio-go/blob/master/api.go): sdk surface · Root package entrypoint for creating clients and exposing bucket/object operations. · `api.go`
- [Core Flow](https://github.com/minio/minio-go/blob/master/core.go): request pipeline · Client setup, endpoint resolution, request construction, and response decoding. · `core.go`
- [Bucket Ops](https://github.com/minio/minio-go/blob/master/api-bucket-policy.go): control-plane APIs · Bucket lifecycle and configuration operations such as create, list, policy, versioning, lifecycle, encryption, replication, tagging, CORS, and notifications. · `api-bucket-policy.go`
- [Object Ops](https://github.com/minio/minio-go/blob/master/api-put-object.go): data-plane APIs · Primary object lifecycle operations including put, get, stat, copy, delete, list, remove-many, and file-based transfer helpers. · `api-put-object.go`
- [Transfer Paths](https://github.com/minio/minio-go/blob/master/api-put-object-multipart.go): multipart and streaming · Multipart upload, streaming upload, compose, append, and download/file-transfer flows for large objects. · `api-put-object-multipart.go`
- [Access Flows](https://github.com/minio/minio-go/blob/master/api-presigned.go): presigned and policy · Presigned URLs and POST policy generation for delegated access without performing the transfer directly. · `api-presigned.go`
- [Object Config](https://github.com/minio/minio-go/blob/master/api-object-lock.go): object metadata APIs · Object lock, retention, legal hold, tagging, and encryption update operations. · `api-object-lock.go`
- [Error Model](https://github.com/minio/minio-go/blob/master/api-error-response.go): response parsing · S3 error decoding and special handling for successful HTTP responses that still contain embedded errors. · `api-error-response.go`

### Auth

Credential providers and request signing boundaries.

- [Credentials](https://github.com/minio/minio-go/blob/master/pkg/credentials/credentials.go): provider chain · Credential source selection across static, environment, file, IAM, and STS/web-identity variants. · `pkg/credentials/credentials.go`
- [Signers](https://github.com/minio/minio-go/blob/master/pkg/signer/request-signature-v4.go): sigv2-v4 · Request signing implementations for Signature V2, Signature V4, and streaming signatures. · `pkg/signer/request-signature-v4.go`

### Domain Models

Shared S3/MinIO configuration and metadata packages.

- [S3 Models](https://github.com/minio/minio-go/blob/master/pkg/policy/bucket-policy.go): shared payloads · Shared configuration and payload models for policy, lifecycle, notification, replication, tags, CORS, encryption, and SSE helpers. · `pkg/policy/bucket-policy.go`
- [S3 Utils](https://github.com/minio/minio-go/blob/master/pkg/s3utils/utils.go): helpers · Shared utility functions and low-level S3 helpers used across the SDK. · `pkg/s3utils/utils.go`

### Runtime

Transport, retry, caching, and concurrency helpers.

- [Transport](https://github.com/minio/minio-go/blob/master/transport.go): http execution · HTTP request execution boundary used by all SDK operations. · `transport.go`
- [Retry](https://github.com/minio/minio-go/blob/master/retry.go): network resilience · Retry policy and continuous retry behavior around request execution. · `retry.go`
- [Caches](https://github.com/minio/minio-go/blob/master/bucket-cache.go): lookup optimization · Bucket cache and singleflight coordination to reduce duplicate lookups and concurrent work. · `bucket-cache.go`

### Extensions

MinIO-specific and advanced flows beyond basic S3 object access.

- [MinIO Extensions](https://github.com/minio/minio-go/blob/master/rdma.go): advanced features · MinIO-specific additions such as RDMA paths, prompt object support, inventory extensions, and session creation. · `rdma.go`

### Usage

Examples and binaries that demonstrate the SDK flows.

- [S3 Examples](https://github.com/minio/minio-go/blob/master/examples/s3/putobject.go): usage samples · Example programs showing standard bucket, object, presigned, encryption, multipart, and admin workflows. · `examples/s3/putobject.go`
- [MinIO Examples](https://github.com/minio/minio-go/blob/master/examples/minio/listen-notification.go): usage samples · Example programs for MinIO-specific flows such as notifications, replication metrics, fan-out, and snowball. · `examples/minio/listen-notification.go`
- [RDMA Test](https://github.com/minio/minio-go/blob/master/cmd/rdma-test/main.go): optional binary · Standalone RDMA test command for platform- or build-gated transport behavior. · `cmd/rdma-test/main.go`

## Connections

- Client API → Core Flow: uses · The public client API delegates request setup and execution to the core pipeline.
- Core Flow → Credentials: loads · Client initialization resolves credentials through provider chains and identity sources.
- Core Flow → Signers: signs · Requests are signed before being sent to the storage service.
- Core Flow → Transport: sends · The core pipeline dispatches HTTP requests through the transport layer.
- Transport → Retry: wraps · Transport behavior is governed by retry and error-handling logic.
- Client API → Bucket Ops: exposes · Bucket-level control-plane methods are part of the root SDK surface.
- Client API → Object Ops: exposes · Object CRUD and listing operations are the main user-facing contract.
- Client API → Transfer Paths: exposes · Large-object transfer APIs build on the same client surface.
- Client API → Access Flows: exposes · Presigned URL and policy generation are available from the root package.
- Client API → Object Config: exposes · Object retention, lock, legal hold, tagging, and encryption APIs are exported from the client.
- Client API → Error Model: decodes · API calls normalize service failures through the SDK error model.
- Bucket Ops → S3 Models: serializes · Bucket configuration APIs use shared domain models and XML payload structures.
- Object Config → S3 Models: serializes · Object configuration endpoints reuse shared metadata models.
- Transfer Paths → S3 Utils: streams · Transfer paths use common helpers for checksums, part handling, and body setup.
- Access Flows → Signers: derives · Presigned URLs and POST policies depend on signing primitives.
- Bucket Ops → Caches: optimizes · Repeated bucket and lookup work is accelerated with caching and singleflight coordination.
- Object Ops → S3 Utils: uses · Object operations rely on shared S3 helper utilities.
- MinIO Extensions → Signers: depends on · Advanced MinIO features still rely on the same signing boundary.
- MinIO Extensions → Transport: extends · Optional RDMA and related features integrate with the request execution path.
- S3 Examples → Client API: demonstrates · S3 examples show consumer usage of the root client API.
- MinIO Examples → MinIO Extensions: demonstrates · MinIO examples focus on advanced MinIO-specific flows.
- RDMA Test → MinIO Extensions: exercises · The RDMA test binary validates the optional RDMA extension path.
