# shubha03/ci-cd-pipeline architecture

> Architecture diagram of the GitHub repository shubha03/ci-cd-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shubha03/ci-cd-pipeline
- Repository: https://github.com/shubha03/ci-cd-pipeline

## Overview

##### Project type and purpose
- This is a single‐service Python web application whose primary purpose is to demonstrate a full CI/CD pipeline.
- It uses GitHub Actions to build, test, and push a Docker image; Docker to containerize the app; and a local Kubernetes cluster (Minikube) to deploy and run the container.

##### File structure
- Top level:
- .github/workflows/ci-cd.yml → GitHub Actions workflow definition
- Dockerfile → instructions to build the app container
- app.py → the Python web service entry point
- requirements.txt → Python dependencies
- k8s/deployment.yaml & k8s/service.yaml → Kubernetes manifests for Deployment and Service
- No separate “frontend” directory—this is a backend/microservice demonstration.
- CI/CD‐related files are cleanly isolated under .github.

##### README for additional insights
- The README confirms the use of GitHub Actions for CI/CD, Docker for containerization, and Kubernetes (Minikube) for local deployment and testing.

##### Main components & their interactions
a. Components:
1. Developer workstation (pushes code)
2. GitHub repository & GitHub Actions runner
3. Docker build & registry (Docker Hub or GitHub Container Registry)
4. Minikube Kubernetes cluster (with a Node, Docker runtime inside)
5. Kubernetes objects: Deployment (running pods with the container), Service (exposes pods)
6. End user or API client
b. Relationships & data flows:
- Code push → triggers GitHub Actions
- Actions → runs lint/tests, builds Docker image → pushes to registry
- Actions (or manual kubectl) → applies k8s manifests to Minikube
- Kubernetes → pulls the image from registry, schedules pods
- Service → routes external HTTP traffic to app pods
- Client → sends HTTP requests to the Service’s endpoint
c. Architectural patterns & design principles:
- CI/CD pipeline as code (GitHub Actions)
- Containerization (Docker) for environment consistency
- Declarative infrastructure (Kubernetes manifests)
- Single responsibility microservice
d. Key technologies/frameworks:
- GitHub Actions
- Docker
- Python (Flask, FastAPI, or built-in HTTP server in app.py)
- Kubernetes (Deployment, Service)
- Minikube for local cluster

##### Detailed breakdown for maximum clarity
- Leftmost lane: Developer commits → GitHub Repository
- Middle lane: GitHub Actions → Tests → Docker Build → Docker Push
- Rightmost lane: Minikube Cluster → Kubernetes API → Deployment → Pods → Service → Client
- Kubernetes objects:
- Deployment (specifies replicas, image)
- Service (ClusterIP or NodePort)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Developer & CI/CD Pipeline
    subgraph "Developer & CI/CD Pipeline"
        Developer["Developer Workstation"]:::dev
        Repo["GitHub Repository"]:::ci
        Actions["GitHub Actions Runner"]:::ci
        CItest["Run Lint/Tests"]:::ci
        DockerBuild["Docker Build"]:::ci
        DockerPush["Docker Push"]:::ci
        Registry["Docker Registry"]:::ci
        AppPy["app.py"]:::code
        Req["requirements.txt"]:::code
        README["README.md"]:::doc

        Developer -->|"push code"| Repo
        Repo -->|"trigger workflow"| Actions
        Actions -->|"runs"| CItest
        CItest -->|"build image"| DockerBuild
        DockerBuild -->|"push image"| DockerPush
        DockerPush --> Registry
        Repo --> AppPy
        Repo --> Req
        Repo --> README
    end

    %% Runtime Infrastructure
    subgraph "Runtime Infrastructure"
        Registry -->|"docker pull"| Minikube["Minikube Cluster"]:::runtime
        Minikube -->|"kubectl apply"| K8sAPI["Kubernetes API"]:::runtime
        K8sAPI --> Deployment["Deployment"]:::runtime
        Deployment --> Pods["Pods (app container)"]:::runtime
        Pods --> Service["Service"]:::runtime
        Service -->|"HTTP 80/tcp"| Client["API Client / End User"]:::client
    end

    %% Click Events
    click Actions "https://github.com/shubha03/ci-cd-pipeline/blob/main/.github/workflows/ci-cd.yml"
    click DockerBuild "https://github.com/shubha03/ci-cd-pipeline/tree/main/Dockerfile"
    click AppPy "https://github.com/shubha03/ci-cd-pipeline/blob/main/app.py"
    click Req "https://github.com/shubha03/ci-cd-pipeline/blob/main/requirements.txt"
    click Deployment "https://github.com/shubha03/ci-cd-pipeline/blob/main/k8s/deployment.yaml"
    click Service "https://github.com/shubha03/ci-cd-pipeline/blob/main/k8s/service.yaml"
    click README "https://github.com/shubha03/ci-cd-pipeline/blob/main/README.md"

    %% Styles
    classDef dev fill:#FFD700,stroke:#333,stroke-width:1px
    classDef ci fill:#87CEEB,stroke:#333,stroke-width:1px
    classDef runtime fill:#98FB98,stroke:#333,stroke-width:1px
    classDef client fill:#FFB6C1,stroke:#333,stroke-width:1px
    classDef code fill:#D8BFD8,stroke:#333,stroke-width:1px
    classDef doc fill:#FFE4B5,stroke:#333,stroke-width:1px
```
