# qdrant/qcloud-cli architecture

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

- Interactive diagram: https://gitdiagram.com/qdrant/qcloud-cli
- Repository: https://github.com/qdrant/qcloud-cli

## Overview

qcloud is the official Qdrant Cloud CLI. Users configure credentials and an account context, then invoke commands to inspect or manage cloud resources; the Quick Start demonstrates cluster creation, description, and API-key creation. The graph preserves the documented management areas and a shared configuration/API layer. Edges are limited to relationships shown by excerpts or the README; unsampled command internals and their service calls are not asserted.

Main entry points: [`internal/cli/root.go`](https://github.com/qdrant/qcloud-cli/blob/main/internal/cli/root.go) (Root command), [`internal/cmd/cluster`](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/cluster) (Cluster operations), [`internal/cmd/serverless/space`](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/serverless/space) (Serverless spaces), [`internal/state/state.go`](https://github.com/qdrant/qcloud-cli/blob/main/internal/state/state.go) (Shared state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry and configuration"]
  node_main["Executable entry<br/>[main.go]"]
  node_root["Root command<br/>[root.go]"]
  node_contexts["Named contexts"]
  node_config[("Configuration<br/>[config.go]")]
end

subgraph group_resources["Cloud resource management"]
  node_clusters["Cluster operations"]
  node_backups["Backup operations"]
  node_hybrid["Hybrid cloud"]
  node_catalog["Providers and packages<br/>[package.go]"]
  node_regions["Cloud regions"]
  node_inference["Inference models"]
end

subgraph group_identity["Accounts and access"]
  node_accounts["Account management"]
  node_iam["IAM management"]
end

subgraph group_serverless["Serverless operations"]
  node_serverless["Serverless spaces"]
  node_serverless_metrics["Space metrics<br/>[metrics_usage.go]"]
  node_serverless_backup["Space backups<br/>[backup.go]"]
end

subgraph group_shared["Shared runtime"]
  node_completion["Shell completion<br/>[completion.go]"]
  node_output["Output formatting<br/>[output.go]"]
  node_state["Shared state<br/>[state.go]"]
  node_api_client["gRPC API client<br/>[client.go]"]
end

node_user(("CLI user"))
node_cloud_api{{"Qdrant Cloud API"}}

node_user -->|"runs commands"| node_main
node_main -->|"creates command"| node_root
node_root -->|"registers"| node_contexts
node_root -->|"loads config"| node_config
node_root -->|"registers"| node_clusters
node_root -->|"registers"| node_backups
node_root -->|"registers"| node_hybrid
node_root -->|"registers"| node_accounts
node_root -->|"registers"| node_iam
node_root -->|"registers"| node_serverless
node_root -->|"registers"| node_inference
node_root -->|"registers"| node_regions
node_root -->|"registers"| node_catalog
node_contexts -->|"manages contexts"| node_config
node_root -->|"uses shared state"| node_state
node_state -->|"reads settings"| node_config
node_state -->|"creates client"| node_api_client
node_api_client -->|"connects to"| node_cloud_api
node_catalog -->|"requests packages"| node_api_client
node_user -->|"creates cluster"| node_clusters
node_user -->|"describes cluster"| node_clusters
node_user -->|"creates cluster key"| node_clusters
node_serverless -->|"includes metrics"| node_serverless_metrics
node_serverless -->|"includes backups"| node_serverless_backup
node_clusters -->|"uses completions"| node_completion
node_serverless_metrics -->|"formats results"| node_output

click node_main "https://github.com/qdrant/qcloud-cli/blob/main/cmd/qcloud/main.go"
click node_root "https://github.com/qdrant/qcloud-cli/blob/main/internal/cli/root.go"
click node_contexts "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/context"
click node_config "https://github.com/qdrant/qcloud-cli/blob/main/internal/state/config/config.go"
click node_clusters "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/cluster"
click node_backups "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/backup"
click node_hybrid "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/hybrid"
click node_catalog "https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/package/package.go"
click node_regions "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/cloudregion"
click node_accounts "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/account"
click node_iam "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/iam"
click node_serverless "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/serverless/space"
click node_serverless_metrics "https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/serverless/space/metrics_usage.go"
click node_serverless_backup "https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/serverless/space/backup.go"
click node_inference "https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/inference"
click node_completion "https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/completion/completion.go"
click node_output "https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/output/output.go"
click node_state "https://github.com/qdrant/qcloud-cli/blob/main/internal/state/state.go"
click node_api_client "https://github.com/qdrant/qcloud-cli/blob/main/internal/qcloudapi/client.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_main,node_root,node_contexts,node_config,node_user toneBlue
class node_clusters,node_backups,node_hybrid,node_catalog,node_regions,node_inference toneAmber
class node_accounts,node_iam,node_cloud_api toneMint
class node_serverless,node_serverless_metrics,node_serverless_backup toneRose
class node_completion,node_output,node_state,node_api_client toneIndigo
```

## Components

### CLI entry and configuration

- [Executable entry](https://github.com/qdrant/qcloud-cli/blob/main/cmd/qcloud/main.go): `cmd/qcloud/main.go`
- [Root command](https://github.com/qdrant/qcloud-cli/blob/main/internal/cli/root.go): `internal/cli/root.go`
- [Named contexts](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/context): `internal/cmd/context`
- [Configuration](https://github.com/qdrant/qcloud-cli/blob/main/internal/state/config/config.go): `internal/state/config/config.go`

### Cloud resource management

- [Cluster operations](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/cluster): `internal/cmd/cluster`
- [Backup operations](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/backup): `internal/cmd/backup`
- [Hybrid cloud](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/hybrid): `internal/cmd/hybrid`
- [Providers and packages](https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/package/package.go): `internal/cmd/package/package.go`
- [Cloud regions](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/cloudregion): `internal/cmd/cloudregion`
- [Inference models](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/inference): `internal/cmd/inference`

### Accounts and access

- [Account management](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/account): `internal/cmd/account`
- [IAM management](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/iam): `internal/cmd/iam`

### Serverless operations

- [Serverless spaces](https://github.com/qdrant/qcloud-cli/tree/main/internal/cmd/serverless/space): `internal/cmd/serverless/space`
- [Space metrics](https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/serverless/space/metrics_usage.go): `internal/cmd/serverless/space/metrics_usage.go`
- [Space backups](https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/serverless/space/backup.go): `internal/cmd/serverless/space/backup.go`

### Shared runtime

- [Shell completion](https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/completion/completion.go): `internal/cmd/completion/completion.go`
- [Output formatting](https://github.com/qdrant/qcloud-cli/blob/main/internal/cmd/output/output.go): `internal/cmd/output/output.go`
- [Shared state](https://github.com/qdrant/qcloud-cli/blob/main/internal/state/state.go): `internal/state/state.go`
- [gRPC API client](https://github.com/qdrant/qcloud-cli/blob/main/internal/qcloudapi/client.go): `internal/qcloudapi/client.go`

### Other components

- **CLI user**
- **Qdrant Cloud API**

## Connections

- CLI user → Executable entry: runs commands (evidence: `README.md`)
- Executable entry → Root command: creates command (evidence: `cmd/qcloud/main.go`)
- Root command → Named contexts: registers (evidence: `internal/cli/root.go`)
- Root command → Configuration: loads config (evidence: `internal/cli/root.go`)
- Root command → Cluster operations: registers (evidence: `internal/cli/root.go`)
- Root command → Backup operations: registers (evidence: `internal/cli/root.go`)
- Root command → Hybrid cloud: registers (evidence: `internal/cli/root.go`)
- Root command → Account management: registers (evidence: `internal/cli/root.go`)
- Root command → IAM management: registers (evidence: `internal/cli/root.go`)
- Root command → Serverless spaces: registers (evidence: `internal/cli/root.go`)
- Root command → Inference models: registers (evidence: `internal/cli/root.go`)
- Root command → Cloud regions: registers (evidence: `internal/cli/root.go`)
- Root command → Providers and packages: registers (evidence: `internal/cli/root.go`)
- Named contexts → Configuration: manages contexts (evidence: `internal/cmd/context/context.go`)
- Root command → Shared state: uses shared state (evidence: `internal/cli/root.go`)
- Shared state → Configuration: reads settings (evidence: `internal/state/state.go`)
- Shared state → gRPC API client: creates client (evidence: `internal/state/state.go`)
- gRPC API client → Qdrant Cloud API: connects to (evidence: `README.md`)
- Providers and packages → gRPC API client: requests packages (evidence: `internal/cmd/package/package.go`)
- CLI user → Cluster operations: creates cluster (evidence: `README.md`)
- CLI user → Cluster operations: describes cluster (evidence: `README.md`)
- CLI user → Cluster operations: creates cluster key (evidence: `README.md`)
- Serverless spaces → Space metrics: includes metrics
- Serverless spaces → Space backups: includes backups
- Cluster operations → Shell completion: uses completions (evidence: `internal/cmd/cluster/scale.go`)
- Space metrics → Output formatting: formats results (evidence: `internal/cmd/serverless/space/metrics_usage.go`)
