# stackitcloud/stackit-cli architecture

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

- Interactive diagram: https://gitdiagram.com/stackitcloud/stackit-cli
- Repository: https://github.com/stackitcloud/stackit-cli

## Overview

STACKIT CLI is a Cobra-based command-line client for managing STACKIT cloud resources and services. A typical workflow starts with a user invoking a command; the CLI initializes configuration and shared command parameters, routes the request to a service command, configures an authenticated API client, and communicates with STACKIT. The tree and README show broad resource-management capabilities, including servers, networking, databases, DNS, Kubernetes, and object storage. Some command implementations were not sampled, so subsystem coverage reflects documented capabilities; only directly supported wiring is shown.

Main entry points: [`internal/cmd/root.go`](https://github.com/stackitcloud/stackit-cli/blob/main/internal/cmd/root.go) (Command router), [`internal/pkg/generic-client/generic_client.go`](https://github.com/stackitcloud/stackit-cli/blob/main/internal/pkg/generic-client/generic_client.go) (API client setup), [`internal/cmd/server`](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/server) (Server and IaaS), [`internal/cmd/postgresflex`](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/postgresflex) (Managed databases)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["CLI entry and settings"]
  node_main["Process setup<br/>[main.go]"]
  node_root["Command router<br/>[root.go]"]
  node_config["CLI configuration"]
end

subgraph group_identity["Identity and shared clients"]
  node_authcmd["Authentication commands"]
  node_authstore[("Credential storage<br/>[storage.go]")]
  node_generic["API client setup<br/>[generic_client.go]"]
end

subgraph group_infra["Infrastructure management"]
  node_iaas["Server and IaaS"]
  node_network["Network resources"]
  node_ske["Kubernetes engine"]
end

subgraph group_services["Cloud services"]
  node_dns["DNS resources"]
  node_databases["Managed databases"]
  node_object["Object storage"]
end

node_user(("CLI user"))
node_api{{"STACKIT services"}}

node_user -->|"runs command"| node_main
node_main -->|"executes CLI"| node_root
node_root -->|"routes commands"| node_config
node_root -->|"routes commands"| node_authcmd
node_root -->|"routes commands"| node_iaas
node_root -.->|"routes commands"| node_network
node_root -.->|"routes commands"| node_ske
node_root -->|"routes commands"| node_dns
node_root -.->|"routes commands"| node_databases
node_root -.->|"routes commands"| node_object
node_authcmd -.->|"stores credentials"| node_authstore
node_iaas -.->|"configures API"| node_generic
node_databases -.->|"configures API"| node_generic
node_generic -.->|"loads credentials"| node_authstore
node_generic -.->|"configures SDK access"| node_api
node_iaas -.->|"manages resources"| node_api
node_network -.->|"manages resources"| node_api
node_ske -.->|"manages clusters"| node_api
node_dns -.->|"manages DNS"| node_api
node_databases -.->|"manages databases"| node_api
node_object -.->|"manages storage"| node_api

click node_main "https://github.com/stackitcloud/stackit-cli/blob/main/main.go"
click node_root "https://github.com/stackitcloud/stackit-cli/blob/main/internal/cmd/root.go"
click node_config "https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/config"
click node_authcmd "https://github.com/stackitcloud/stackit-cli/blob/main/internal/cmd/auth/activate-service-account/activate_service_account.go"
click node_authstore "https://github.com/stackitcloud/stackit-cli/blob/main/internal/pkg/auth/storage.go"
click node_generic "https://github.com/stackitcloud/stackit-cli/blob/main/internal/pkg/generic-client/generic_client.go"
click node_iaas "https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/server"
click node_network "https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/network-area"
click node_ske "https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/ske"
click node_dns "https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/dns"
click node_databases "https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/postgresflex"
click node_object "https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/object-storage"

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_config,node_user toneBlue
class node_authcmd,node_authstore,node_generic toneAmber
class node_iaas,node_network,node_ske toneMint
class node_dns,node_databases,node_object toneRose
class node_api toneIndigo
```

## Components

### CLI entry and settings

- [Process setup](https://github.com/stackitcloud/stackit-cli/blob/main/main.go): `main.go`
- [Command router](https://github.com/stackitcloud/stackit-cli/blob/main/internal/cmd/root.go): `internal/cmd/root.go`
- [CLI configuration](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/config): `internal/cmd/config`

### Identity and shared clients

- [Authentication commands](https://github.com/stackitcloud/stackit-cli/blob/main/internal/cmd/auth/activate-service-account/activate_service_account.go): `internal/cmd/auth/activate-service-account/activate_service_account.go`
- [Credential storage](https://github.com/stackitcloud/stackit-cli/blob/main/internal/pkg/auth/storage.go): `internal/pkg/auth/storage.go`
- [API client setup](https://github.com/stackitcloud/stackit-cli/blob/main/internal/pkg/generic-client/generic_client.go): `internal/pkg/generic-client/generic_client.go`

### Infrastructure management

- [Server and IaaS](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/server): `internal/cmd/server`
- [Network resources](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/network-area): `internal/cmd/network-area`
- [Kubernetes engine](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/ske): `internal/cmd/ske`

### Cloud services

- [DNS resources](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/dns): `internal/cmd/dns`
- [Managed databases](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/postgresflex): `internal/cmd/postgresflex`
- [Object storage](https://github.com/stackitcloud/stackit-cli/tree/main/internal/cmd/object-storage): `internal/cmd/object-storage`

### Other components

- **CLI user**
- **STACKIT services**

## Connections

- CLI user → Process setup: runs command
- Process setup → Command router: executes CLI (evidence: `main.go`)
- Command router → CLI configuration: routes commands (evidence: `internal/cmd/root.go`)
- Command router → Authentication commands: routes commands (evidence: `internal/cmd/root.go`)
- Command router → Server and IaaS: routes commands (evidence: `internal/cmd/root.go`)
- Command router → Network resources: routes commands (evidence: `internal/cmd/root.go`)
- Command router → Kubernetes engine: routes commands (evidence: `internal/cmd/root.go`)
- Command router → DNS resources: routes commands (evidence: `internal/cmd/root.go`)
- Command router → Managed databases: routes commands (evidence: `internal/cmd/root.go`)
- Command router → Object storage: routes commands (evidence: `internal/cmd/root.go`)
- Authentication commands → Credential storage: stores credentials
- Server and IaaS → API client setup: configures API
- Managed databases → API client setup: configures API
- API client setup → Credential storage: loads credentials
- API client setup → STACKIT services: configures SDK access
- Server and IaaS → STACKIT services: manages resources
- Network resources → STACKIT services: manages resources
- Kubernetes engine → STACKIT services: manages clusters
- DNS resources → STACKIT services: manages DNS
- Managed databases → STACKIT services: manages databases
- Object storage → STACKIT services: manages storage
