# redhat-developer/mapt architecture

> Architecture diagram of the GitHub repository redhat-developer/mapt, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/redhat-developer/mapt
- Repository: https://github.com/redhat-developer/mapt

## Overview

##### Project type and purpose
- Mapt is a Go-based, multi-cloud CLI tool for on-demand provisioning of compute instances and managed services across AWS and Azure.
- It exposes a command-line interface (cmd/mapt), implements a provider-plugin architecture (pkg/provider), and integrates with CI/CD systems via snippets and Tekton tasks (tkn).

##### File structure
- Top-level:
- cmd/mapt – CLI entrypoint and subcommands for AWS, Azure, parameters, and root.
- pkg/manager – orchestration: context, credentials, execution logic.
- pkg/provider – cloud-agnostic API definitions and provider-specific implementations (aws, azure).
- pkg/integrations – external CI integrations (GitHub, Cirrus).
- docs, examples, hacks – usage documentation and scripts.
- tkn – Tekton task definitions for dynamic provisioning within pipelines.
- .github/workflows & oci/Containerfile – CI/CD pipelines and container builds.
- Patterns:
- Provider-plugin pattern: common API → each “pkg/provider/<cloud>” implements actions, data, modules, services.
- Layered architecture: CLI → Manager → Provider API → Cloud modules & SDK → Cloud endpoints.
- Config-templating: uses cloud-config templates for initializing instances.

##### README for additional insights
- Highlights three focus areas: Instances, Services, Integrations.
- Lists supported OS targets and managed services (EKS, AKS, Mac-Pool).
- Mentions integrations with GitHub Self-Hosted Runners, Cirrus Persistent Workers, and Tekton tasks.

##### Elements
- Provider Interfaces – another
- Cloud implementations – another

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global external user
    User["User"]:::external

    %% CLI Layer
    subgraph "CLI Layer"
        subgraph "CLI Frontend"
            MAIN["main.go"]:::cli
            ROOT["root.go"]:::cli
            AWS_CMD["aws subcommands"]:::cli
            AZ_CMD["azure subcommands"]:::cli
            PARAM_CMD["params subcommand"]:::cli
        end
    end

    %% Core Manager
    subgraph "Core Manager"
        MANAGER["manager.go"]:::cli
        CONTEXT["context.go"]:::cli
        CREDENTIALS["credentials.go"]:::cli
        UTIL["util.go"]:::cli
    end

    %% Provider Abstraction
    subgraph "Provider Abstraction Layer"
        PROVIDER_API["api"]:::api
        COMPUTE_API["compute-request.go"]:::api
        SPOT_API["spot.go"]:::api
        SPOT_TYPES["types.go"]:::api
    end

    %% Providers Implementation
    subgraph "Provider Implementations"
        subgraph "AWS Provider"
            AWS_PROVIDER["aws.go"]:::provider
            AWS_ACTION["action"]:::provider
            AWS_DATA["data"]:::provider
            AWS_MODULES["modules"]:::provider
            AWS_SERVICES["services"]:::provider
        end
        subgraph "Azure Provider"
            AZ_PROVIDER["azure.go"]:::provider
            AZ_ACTION["action"]:::provider
            AZ_DATA["data"]:::provider
            AZ_MODULES["module"]:::provider
        end
    end

    %% Integrations
    subgraph "Integrations"
        INTEGRATIONS["integrations.go"]:::integration
        GITHUB_INT["github"]:::integration
        CIRRUS_INT["cirrus"]:::integration
    end

    %% CI/CD
    subgraph "CI/CD Tooling"
        TKN["tkn"]:::cicd
        TKN_TEMPLATE["tkn/template"]:::cicd
        GH_WORKFLOWS[".github/workflows"]:::cicd
        OCI["Containerfile"]:::cicd
    end

    %% Documentation
    subgraph "Documentation & Examples"
        DOCS["docs"]:::docs
        EXAMPLES["examples"]:::docs
    end

    %% Cloud Endpoints
    AWS_CLOUD["AWS Cloud"]:::external
    AZURE_CLOUD["Azure Cloud"]:::external

    %% Connections
    User -->|"invokes"| MAIN
    MAIN -->|"calls"| ROOT
    ROOT -->|"parses args"| MANAGER
    MANAGER -->|"uses"| CONTEXT
    MANAGER -->|"uses"| CREDENTIALS
    MANAGER -->|"calls"| PROVIDER_API
    PROVIDER_API -->|"defines compute API"| COMPUTE_API
    PROVIDER_API -->|"defines spot API"| SPOT_API
    SPOT_API -->|"uses types"| SPOT_TYPES
    PROVIDER_API -->|"implemented by"| AWS_PROVIDER
    PROVIDER_API -->|"implemented by"| AZ_PROVIDER
    AWS_PROVIDER -->|"executes actions"| AWS_ACTION
    AWS_PROVIDER -->|"uses data defs"| AWS_DATA
    AWS_PROVIDER -->|"instantiates modules"| AWS_MODULES
    AWS_PROVIDER -->|"helper services"| AWS_SERVICES
    AZ_PROVIDER -->|"executes actions"| AZ_ACTION
    AZ_PROVIDER -->|"uses data defs"| AZ_DATA
    AZ_PROVIDER -->|"instantiates modules"| AZ_MODULES
    AWS_SERVICES -->|"provisions"| AWS_CLOUD
    AZ_MODULES -->|"provisions"| AZURE_CLOUD
    AWS_PROVIDER -->|"provides output to"| INTEGRATIONS
    AZ_PROVIDER -->|"provides output to"| INTEGRATIONS
    INTEGRATIONS -->|"registers runners"| GITHUB_INT
    INTEGRATIONS -->|"registers workers"| CIRRUS_INT
    GH_WORKFLOWS -->|"invoke CLI"| MAIN
    TKN -->|"wraps CLI calls"| MAIN
    TKN -->|"uses templates"| TKN_TEMPLATE

    %% Click Events
    click MAIN "https://github.com/redhat-developer/mapt/blob/main/cmd/mapt/main.go"
    click ROOT "https://github.com/redhat-developer/mapt/blob/main/cmd/mapt/cmd/root.go"
    click AWS_CMD "https://github.com/redhat-developer/mapt/tree/main/cmd/mapt/cmd/aws"
    click AZ_CMD "https://github.com/redhat-developer/mapt/tree/main/cmd/mapt/cmd/azure"
    click PARAM_CMD "https://github.com/redhat-developer/mapt/blob/main/cmd/mapt/cmd/params/params.go"
    click MANAGER "https://github.com/redhat-developer/mapt/blob/main/pkg/manager/manager.go"
    click CONTEXT "https://github.com/redhat-developer/mapt/blob/main/pkg/manager/context/context.go"
    click CREDENTIALS "https://github.com/redhat-developer/mapt/blob/main/pkg/manager/credentials/credentials.go"
    click UTIL "https://github.com/redhat-developer/mapt/blob/main/pkg/manager/util.go"
    click PROVIDER_API "https://github.com/redhat-developer/mapt/tree/main/pkg/provider/api"
    click COMPUTE_API "https://github.com/redhat-developer/mapt/blob/main/pkg/provider/api/compute-request/compute-request.go"
    click SPOT_API "https://github.com/redhat-developer/mapt/blob/main/pkg/provider/api/spot/spot.go"
    click SPOT_TYPES "https://github.com/redhat-developer/mapt/blob/main/pkg/provider/api/spot/types/types.go"
    click AWS_PROVIDER "https://github.com/redhat-developer/mapt/blob/main/pkg/provider/aws/aws.go"
    click AWS_ACTION "https://github.com/redhat-developer/mapt/tree/main/pkg/provider/aws/action"
    click AWS_DATA "https://github.com/redhat-developer/mapt/tree/main/pkg/provider/aws/data"
    click AWS_MODULES "https://github.com/redhat-developer/mapt/tree/main/pkg/provider/aws/modules"
    click AWS_SERVICES "https://github.com/redhat-developer/mapt/tree/main/pkg/provider/aws/services"
    click AZ_PROVIDER "https://github.com/redhat-developer/mapt/blob/main/pkg/provider/azure/azure.go"
    click AZ_ACTION "https://github.com/redhat-developer/mapt/tree/main/pkg/provider/azure/action"
    click AZ_DATA "https://github.com/redhat-developer/mapt/tree/main/pkg/provider/azure/data"
    click AZ_MODULES "https://github.com/redhat-developer/mapt/tree/main/pkg/provider/azure/module"
    click INTEGRATIONS "https://github.com/redhat-developer/mapt/blob/main/pkg/integrations/integrations.go"
    click GITHUB_INT "https://github.com/redhat-developer/mapt/tree/main/pkg/integrations/github"
    click CIRRUS_INT "https://github.com/redhat-developer/mapt/tree/main/pkg/integrations/cirrus"
    click TKN "https://github.com/redhat-developer/mapt/tree/main/tkn"
    click TKN_TEMPLATE "https://github.com/redhat-developer/mapt/tree/main/tkn/template"
    click DOCS "https://github.com/redhat-developer/mapt/tree/main/docs"
    click EXAMPLES "https://github.com/redhat-developer/mapt/tree/main/examples"
    click GH_WORKFLOWS "https://github.com/redhat-developer/mapt/tree/main/.github/workflows"
    click OCI "https://github.com/redhat-developer/mapt/tree/main/oci/Containerfile"

    %% Styles
    classDef cli fill:#d4e6f1,stroke:#1f618d,stroke-width:1px
    classDef api fill:#d5f5e3,stroke:#1e8449,stroke-width:1px
    classDef provider fill:#fdebd0,stroke:#d35400,stroke-width:1px
    classDef integration fill:#f9e79f,stroke:#b7950b,stroke-width:1px
    classDef cicd fill:#ebdef0,stroke:#8e44ad,stroke-width:1px
    classDef docs fill:#f2f3f4,stroke:#7f8c8d,stroke-width:1px
    classDef external fill:#f8f9f9,stroke:#566573,stroke-width:1px,stroke-dasharray: 2 2
```
