# coip/banalplatitude architecture

> Architecture diagram of the GitHub repository coip/banalplatitude, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/coip/banalplatitude
- Repository: https://github.com/coip/banalplatitude

## Overview

Project Type: This is a containerized Go-based HTTP service with CI/CD automation, designed to demonstrate basic Docker container lifecycle and GitHub Packages integration.

##### Client Layer
- HTTP Client (curl)
- Port mapping (hostPort:8080)

##### Container Layer
- Docker Container ("acker")
- Port binding (8080:8080)
- Container lifecycle states

##### Application Layer
- Go HTTP Server
- Request handler (showing header processing for "id")

##### CI/CD Pipeline
- GitHub Actions workflows
- GitHub Packages (Docker registry)

- [Client Layer]
- ↓
- [Container Layer]
- ↓
- [Application Layer]

##### A separate pipeline flow on the side
- [GitHub Actions] → [GitHub Packages] → [Docker Pull]

- Blue: Client components
- Green: Container components
- Yellow: Application components
- Purple: CI/CD components

Important Elements to Highlight:
##### Container lifecycle states (pull → run → stop → remove)

**[HTTP Client (curl)] ---(HTTP Request with 'id' header)--→ [Host Port :8080]**
- ↓
- [Docker Container Port :8080]
- ↓
- [Go HTTP Server Listener]

**[GitHub Actions] ---(Build)--→ [Docker Image] ---(Push)--→ [GitHub Packages]**
- ↑                                                         ↓
- [Source Code] ←---------------------------------------- [Docker Pull]

##### Configurable ports (hostPort and svcPort)

Level of Detail:
- Keep the main flow simple and clear
- Version tags and port numbers
- Authentication touchpoints

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef client fill:#3498db,stroke:#2980b9,color:white
    classDef container fill:#2ecc71,stroke:#27ae60,color:white
    classDef app fill:#f1c40f,stroke:#f39c12,color:black
    classDef cicd fill:#9b59b6,stroke:#8e44ad,color:white

    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        Client["HTTP Client (curl)"]:::client
        HostPort["Host Port :8080"]:::client
    end

    %% Container Layer
    subgraph ContainerLayer["Container Layer"]
        DockerContainer["Docker Container (acker)"]:::container
        ContainerPort["Container Port :8080"]:::container
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        GoServer["Go HTTP Server"]:::app
        Handler["Request Handler\n(id header processing)"]:::app
    end

    %% CI/CD Pipeline
    subgraph Pipeline["CI/CD Pipeline"]
        GHActions["GitHub Actions"]:::cicd
        GHPackages["GitHub Packages\n(Docker Registry)"]:::cicd
        DockerImage["Docker Image"]:::cicd
    end

    %% Connections
    Client -->|HTTP Request\nwith 'id' header| HostPort
    HostPort --> ContainerPort
    ContainerPort --> GoServer
    GoServer --> Handler

    GHActions -->|Build| DockerImage
    DockerImage -->|Push| GHPackages
    GHPackages -->|Pull| DockerContainer

    %% Legend
    subgraph Legend["Container Lifecycle"]
        L1["Pull → Run → Stop → Remove"]
    end

    %% Click Events
    click DockerContainer "https://github.com/coip/banalplatitude/tree/master/Dockerfile"
    click GoServer "https://github.com/coip/banalplatitude/blob/master/main.go"
    click Handler "https://github.com/coip/banalplatitude/blob/master/main.go"
    click GHActions "https://github.com/coip/banalplatitude/blob/master/.github/workflows/binartifacts.yml"
    click DockerImage "https://github.com/coip/banalplatitude/blob/master/.github/workflows/go.yml"

    %% Styling Classes
    class Client,HostPort client
    class DockerContainer,ContainerPort container
    class GoServer,Handler app
    class GHActions,GHPackages,DockerImage cicd
```
