# mibha/devops-copilot-demo architecture

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

- Interactive diagram: https://gitdiagram.com/mibha/devops-copilot-demo
- Repository: https://github.com/mibha/devops-copilot-demo

## Overview

##### Project Type and Purpose
- This is an open-source demo tool (DevSecOps assistant) built in Python.
- It integrates with GitHub Actions for CI/CD, containerizes the application, and deploys it onto a Kubernetes cluster.
- Its goal is to provide AI-powered security checks or recommendations as part of a pipeline.

##### File Structure
- Top-level files:
- Dockerfile & .dockerignore → container build
- requirements.txt → Python dependencies
- hello.py & test_hello.py → core application + unit tests
- k8s/deployment.yaml → Kubernetes deployment manifest
- .github/workflows/ci.yml → GitHub Actions CI/CD pipeline definition
- No separate “frontend” or “backend” directories: this is a single microservice.

##### README for Additional Insights
- The README confirms the focus on AI-powered DevSecOps within CI/CD.

##### Main Components and Their Interactions
a. Version Control System (GitHub)
- Houses all code, manifests, and CI config.
- Triggers CI pipeline on push/PR.
b. CI/CD Pipeline (GitHub Actions)
- Runs test_hello.py
- Builds Docker image via Dockerfile
- Pushes image to a Container Registry (DockerHub/AWS ECR/etc.)
c. Container Registry
- Stores the built image tagged (e.g. devops-copilot-demo:latest).
d. Kubernetes Cluster
- pull the image according to k8s/deployment.yaml
- Runs the hello.py service in a Pod.
e. External AI Service (optional)
- The service likely calls an AI API (OpenAI, etc.) to provide security recommendations.

##### Architectural Patterns and Design Principles
- Infrastructure as Code: CI config + k8s manifest under version control
- Containerization: consistent dev/test/prod environments
- GitOps-style pipeline: repository → CI → registry → k8s
- Single-entry microservice design

##### Essential Elements
- Clear labels on each component (e.g., “GitHub Actions CI/CD,” “Docker Registry,” “K8s Pod: hello.py”)
- Arrowheads showing data/control flow
– Source & config (e.g., blue)
– Build pipeline (e.g., orange)
– Deployment runtime (e.g., green)
– External services (e.g., gray)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Developer
    Dev["Developer Workstation"]:::external

    %% GitHub Repository with source files
    subgraph "GitHub Repository"
        direction TB
        CIConfig[".github/workflows/ci.yml"]:::source
        Dockerfile["Dockerfile"]:::source
        Dockerignore[".dockerignore"]:::source
        HelloPy["hello.py"]:::source
        TestHello["test_hello.py"]:::source
        Requirements["requirements.txt"]:::source
        DeploymentYAML["k8s/deployment.yaml"]:::source
        Readme["README.md"]:::source
    end

    %% CI/CD Runner
    CI["GitHub Actions CI/CD"]:::build

    %% Build steps
    Tests["Run Unit Tests"]:::build
    BuildImage["Build Docker Image"]:::build
    Registry["Container Registry"]:::build

    %% Deployment runtime
    K8s["Kubernetes Cluster"]:::runtime
    Pod["Pod: hello.py Container"]:::runtime

    %% External AI Service
    AI["External AI Service"]:::external

    %% Connections
    Dev -->|"git push"| CIConfig
    CIConfig -->|"trigger pipeline"| CI
    CI -->|"run test_hello.py"| Tests
    CI -->|"build image (Dockerfile + .dockerignore)"| BuildImage
    BuildImage -->|"docker push"| Registry
    Registry -->|"pull image"| K8s
    K8s -->|"deploy (deployment.yaml)"| Pod
    Pod -->|"call AI Service API"| AI

    %% Click events
    click CIConfig "https://github.com/mibha/devops-copilot-demo/blob/main/.github/workflows/ci.yml"
    click Dockerfile "https://github.com/mibha/devops-copilot-demo/tree/main/Dockerfile"
    click Dockerignore "https://github.com/mibha/devops-copilot-demo/blob/main/.dockerignore"
    click HelloPy "https://github.com/mibha/devops-copilot-demo/blob/main/hello.py"
    click TestHello "https://github.com/mibha/devops-copilot-demo/blob/main/test_hello.py"
    click Requirements "https://github.com/mibha/devops-copilot-demo/blob/main/requirements.txt"
    click DeploymentYAML "https://github.com/mibha/devops-copilot-demo/blob/main/k8s/deployment.yaml"
    click Readme "https://github.com/mibha/devops-copilot-demo/blob/main/README.md"

    %% Styles
    classDef source fill:#D0E6FF,stroke:#333,stroke-width:1px
    classDef build fill:#FFE5B4,stroke:#333,stroke-width:1px
    classDef runtime fill:#D5FFD0,stroke:#333,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#333,stroke-width:1px
```
