# getporter/porter architecture

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

- Interactive diagram: https://gitdiagram.com/getporter/porter
- Repository: https://github.com/getporter/porter

## Overview

##### Main Components

a. Core Components:
- Porter CLI (cmd/porter)
- Agent (pkg/agent)
- Runtime Engine (pkg/runtime)
- Storage Layer (pkg/storage)
- CNAB Handler (pkg/cnab)

b. Extension Systems:
- Mixin System (pkg/mixin)
- Plugin System (pkg/plugins)

##### Key Architectural Elements

a. Data Flow Layers:
**[User Interface Layer]**
- Porter CLI
- ↓
**[Control Layer]**
- Runtime Engine ←→ CNAB Handler
- ↓
**[Extension Layer]**
- Mixins ←→ Plugins
- ↓
**[Storage Layer]**
- Storage Providers

b. Integration Points:
- Registry Integration (pkg/cnab/cnab-to-oci)
- Container Runtime (Docker/BuildKit)
- Cloud Provider Plugins
- Secret Management

##### Component Relationships

- Rectangles: Core components
- Hexagons: Extension points (Mixins/Plugins)
- Clouds: External services

##### Implementation Details

a. Core Services:
**Porter CLI**
- ↓
**Runtime Engine**
- Bundle Management
- Action Execution
- State Management
- ↓
**Storage Layer**
- Credentials
- Parameters
- State
- Claims

b. Extension Architecture:
**Mixins (Tool Integration)**
- Docker
- Kubernetes
- Helm
- Terraform
- Cloud Provider Tools

**Plugins (Infrastructure Integration)**
- Storage Providers
- Secret Management
- Authentication

##### Additional Elements

Specific sections for:
- Authentication flows
- Bundle lifecycle management
- Configuration management
- State persistence
- Plugin communication protocols

##### Notes

Annotations for:
- Security boundaries
- Scaling considerations
- High availability options
- Plugin extension points
- Configuration requirements

Remember to include key features like:
- Bundle management workflow
- Credential handling
- Parameter management
- State persistence
- Plugin architecture
- Mixin integration
- Registry interaction

This will provide a clear understanding of Porter's architecture while maintaining the right level of detail for a principal software engineer to understand the system's design and implementation.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI["User Interface Layer"]
        CLI["Porter CLI"]
    end

    subgraph Control["Control Layer"]
        RE["Runtime Engine"]
        CNAB["CNAB Handler"]
    end

    subgraph Extensions["Extension Layer"]
        subgraph MixinSystem["Mixin System"]
            MCore["Mixin Core"]
            Docker["Docker Mixin"]
            K8s["Kubernetes Mixin"]
            Helm["Helm Mixin"]
            Terraform["Terraform Mixin"]
        end

        subgraph PluginSystem["Plugin System"]
            PCore["Plugin Core"]
            StorageP["Storage Plugins"]
            SecretP["Secret Plugins"]
            AuthP["Authentication Plugins"]
            SignP["Signing Plugins"]
        end
    end

    subgraph Storage["Storage Layer"]
        Store["Core Storage"]
        CredStore["Credential Store"]
        ParamStore["Parameter Store"]
        InstallStore["Installation Store"]
    end

    subgraph External["External Services"]
        Registry["Registry Integration"]
        ContainerRuntime["Container Runtime"]
        CloudProviders["Cloud Providers"]
    end

    %% Relationships
    CLI --> RE
    RE <--> CNAB
    RE --> MixinSystem
    RE --> PluginSystem
    RE --> Storage
    CNAB --> Registry
    MixinSystem --> ContainerRuntime
    PluginSystem --> CloudProviders

    %% Component styling
    classDef core fill:#2374ab
    classDef extension fill:#57a773
    classDef storage fill:#484d6d
    classDef external fill:#f7b267
    classDef ui fill:#2374ab,stroke:#fff,stroke-width:2px

    class CLI,RE,CNAB core
    class MCore,PCore,Docker,K8s,Helm,Terraform extension
    class Store,CredStore,ParamStore,InstallStore storage
    class Registry,ContainerRuntime,CloudProviders external

    %% Click events
    click CLI "https://github.com/getporter/porter/tree/main/cmd/porter/"
    click RE "https://github.com/getporter/porter/blob/main/pkg/runtime/runtime.go"
    click CNAB "https://github.com/getporter/porter/tree/main/pkg/cnab/"
    click MCore "https://github.com/getporter/porter/blob/main/pkg/mixin/mixin.go"
    click PCore "https://github.com/getporter/porter/blob/main/pkg/plugins/plugins.go"
    click Store "https://github.com/getporter/porter/blob/main/pkg/storage/store.go"
    click CredStore "https://github.com/getporter/porter/blob/main/pkg/storage/credential_store.go"
    click ParamStore "https://github.com/getporter/porter/blob/main/pkg/storage/parameter_store.go"
    click InstallStore "https://github.com/getporter/porter/blob/main/pkg/storage/installation_store.go"
    click StorageP "https://github.com/getporter/porter/tree/main/pkg/storage/plugins/"
    click SecretP "https://github.com/getporter/porter/tree/main/pkg/secrets/plugins/"
    click SignP "https://github.com/getporter/porter/tree/main/pkg/signing/plugins/"
```
