# vmelikyan/g2k architecture

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

- Interactive diagram: https://gitdiagram.com/vmelikyan/g2k
- Repository: https://github.com/vmelikyan/g2k

## Overview

Key Components to Include:

##### External Systems
- GitHub (Webhook Source)
- Downstream Applications (Webhook Consumers)

##### Core Services
- g2krelay (Webhook Receiver & Kafka Producer)
- g2krepeater (Kafka Consumer & Webhook Forwarder)
- Redpanda (Kafka-compatible Message Broker)
- Redpanda Console (Monitoring/Debug Interface)

##### Component Representations
- Use rectangles for services (g2krelay, g2krepeater)
- Use cloud symbols for external services (GitHub, downstream apps)
- Use a monitor symbol for Redpanda Console

##### Infrastructure Context
- Helm deployment indicators
- Ingress points

Detailed Flow Annotations:
##### GitHub → g2krelay
- "Webhook Secret Validation"

##### g2krelay → Redpanda
- "Preserved Headers & Payload"

##### Redpanda → g2krepeater
- "Consumer Groups"

##### g2krepeater → Downstream
- "Fanout to Multiple Endpoints"

Additional Elements:
##### Configuration points (webhook secrets, endpoints)

Technical Details to Highlight:
- Kubernetes deployments (from helm/chart/templates)
- Service networking (from k8s yaml files)
- Build/deployment pipeline (.github/workflows)

Keep the following aspects in mind:
##### Monitoring: Show integration with Redpanda Console

- Clear component relationships
- Proper technical iconography
- Easy updates for future modifications
- Export to standard formats (SVG, PNG)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        GitHub[GitHub Webhooks]:::external
        Downstream[Downstream Applications]:::external
    end

    subgraph Kubernetes["Kubernetes Cluster"]
        subgraph Core["Core Services"]
            g2krelay["g2krelay\nWebhook Receiver"]:::service
            g2krepeater["g2krepeater\nWebhook Forwarder"]:::service
        end

        subgraph Messaging["Message Broker"]
            Redpanda[(Redpanda/Kafka)]:::broker
        end

        subgraph Monitoring["Monitoring Layer"]
            Console["Redpanda Console"]:::monitor
        end
    end

    GitHub -->|HTTPS Webhooks| g2krelay
    g2krelay -.->|Kafka Protocol| Redpanda
    Redpanda -.->|Kafka Protocol| g2krepeater
    g2krepeater -->|HTTPS POST| Downstream
    Console -.->|Monitoring| Redpanda

    %% Click Events
    click g2krelay "https://github.com/vmelikyan/g2k/blob/main/g2krelay/main.go"
    click g2krepeater "https://github.com/vmelikyan/g2k/blob/main/g2krepeater/main.go"
    click Redpanda "https://github.com/vmelikyan/g2k/blob/main/helm/chart/templates/redpanda.yaml"
    click Console "https://github.com/vmelikyan/g2k/blob/main/helm/chart/templates/redpanda-console.yaml"

    %% Styles
    classDef external fill:#68a3ff,stroke:#2d6bcc
    classDef service fill:#90EE90,stroke:#006400
    classDef broker fill:#FFA500,stroke:#8B4513
    classDef monitor fill:#A9A9A9,stroke:#4A4A4A

    %% Legend
    subgraph Legend
        L1[External Services]:::external
        L2[Core Services]:::service
        L3[(Message Broker)]:::broker
        L4[Monitoring]:::monitor
    end

    %% Notes
    note1[Webhook Secret Validation]
    note2[Preserved Headers & Payload]
    note3[Consumer Groups]
    note4[Fanout to Multiple Endpoints]

    g2krelay --- note1
    Redpanda --- note2
    g2krepeater --- note3
    Downstream --- note4
```
