# bsnanda27/kaiburr-cicd architecture

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

- Interactive diagram: https://gitdiagram.com/bsnanda27/kaiburr-cicd
- Repository: https://github.com/bsnanda27/kaiburr-cicd

## Overview

##### Main Components
a. Source Code Repository: Represent the complete Java backend API code, housed under “task-1-java-backend-api” that includes the main application, controllers, models, repositories, and services.
b. CI/CD Pipeline: Break down the process into three major pipeline stages as indicated in the README:
- Build & Test: Involves Maven compiling, JDK 17 setup, and unit testing.
- Docker Build & Push: Uses Maven (skipping tests), Dockerfile to create an image, and handles pushing to Docker Hub.
- Deploy to Kubernetes: Manages deployment using Kubernetes manifests (under k8s folder) and starts a Minikube cluster.
c. Container Registry: Represent Docker Hub where the container images are stored.
d. Deployment Environment: A Kubernetes Cluster which is used to deploy and run the application (and Minikube for local testing).

##### Relationships and Interactions
- How the repository is the starting point of the CI/CD process triggered by GitHub Actions (with separate jobs for build, container image creation, and deployment).
- From source code to “Build & Test” (using Maven).
- From “Build & Test” to “Docker Build & Push” (passing the built artifact).
- From “Docker Build & Push” pushing the image to Docker Hub.
- From Docker Hub to “Deploy to Kubernetes” on a Minikube cluster.
- Role of external services like GitHub Actions (automating the jobs) and the version control system.

##### Architectural Patterns
- Separation of concerns: development code is segregated by layers (controller, service, repository, model).
- Use of containerization and orchestration – how the Docker image is built and deployed to Kubernetes.

##### Relevant Technologies
- JDK 17 for compiling and running the application.
- Maven for dependency management and build automation.
- Docker (and Dockerfile) for containerization.
- GitHub Actions with its three pipeline jobs.
- Kubernetes (with manifest files in the “k8s” directory) for deployment orchestration within Minikube.
- Git (including .gitattributes and .gitignore files) for source control.

- Relationships between Java packages (controller, service, model, repository) to illustrate the internal structure if needed.
- Optionally, include external triggers from GitHub (pushes, PRs) that kick off the automated pipeline.

Happy diagramming!

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Source Code Layer"
        SRC["Java Backend API Source"]:::source
        subgraph "Application Layers"
            AEP["Application Entry Point"]:::source
            CTRL["Controllers"]:::source
            MODELS["Models"]:::source
            REPO["Repositories"]:::source
            SERV["Services"]:::source
        end
        SRC -->|"contains"| AEP
        SRC -->|"contains"| CTRL
        SRC -->|"contains"| MODELS
        SRC -->|"contains"| REPO
        SRC -->|"contains"| SERV
    end

    subgraph "CI/CD Pipeline"
        GHA["GitHub Actions (CI/CD)"]:::cicd
        BUILD["Maven Build & Unit Test Stage"]:::cicd
        DOCKER["Docker Build & Push Stage"]:::cicd
        DEPLOY["Deploy to Kubernetes Stage"]:::cicd
    end

    subgraph "Infrastructure"
        HUB["Docker Hub"]:::infra
        KUBE["Kubernetes Cluster (Minikube)"]:::infra
    end

    SRC -->|"triggers"| GHA
    GHA -->|"runs"| BUILD
    BUILD -->|"produces artifact"| DOCKER
    DOCKER -->|"pushes image to"| HUB
    HUB -->|"deploys image"| DEPLOY
    DEPLOY -->|"rolls out to"| KUBE

    click SRC "https://github.com/bsnanda27/kaiburr-cicd/tree/main/task-1-java-backend-api"
    click AEP "https://github.com/bsnanda27/kaiburr-cicd/blob/main/task-1-java-backend-api/src/main/java/com/bsnanda/kaiburr/TaskApiApplication.java"
    click CTRL "https://github.com/bsnanda27/kaiburr-cicd/blob/main/task-1-java-backend-api/src/main/java/com/bsnanda/kaiburr/controller/TaskController.java"
    click MODELS "https://github.com/bsnanda27/kaiburr-cicd/tree/main/task-1-java-backend-api/src/main/java/com/bsnanda/kaiburr/model"
    click REPO "https://github.com/bsnanda27/kaiburr-cicd/blob/main/task-1-java-backend-api/src/main/java/com/bsnanda/kaiburr/repository/TaskRepository.java"
    click SERV "https://github.com/bsnanda27/kaiburr-cicd/blob/main/task-1-java-backend-api/src/main/java/com/bsnanda/kaiburr/service/TaskService.java"
    click GHA "https://github.com/bsnanda27/kaiburr-cicd/blob/main/.github/workflows/cicd.yml"
    click BUILD "https://github.com/bsnanda27/kaiburr-cicd/blob/main/task-1-java-backend-api/pom.xml"
    click DOCKER "https://github.com/bsnanda27/kaiburr-cicd/tree/main/task-1-java-backend-api/Dockerfile"
    click DEPLOY "https://github.com/bsnanda27/kaiburr-cicd/blob/main/task-1-java-backend-api/k8s/deployment.yaml"

    classDef source fill:#FFA500,stroke:#333,stroke-width:2px;
    classDef cicd fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef infra fill:#90EE90,stroke:#333,stroke-width:2px;
```
