# jseb37/devsecops-project architecture

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

- Interactive diagram: https://gitdiagram.com/jseb37/devsecops-project
- Repository: https://github.com/jseb37/devsecops-project

## Overview

##### Main Components Identification
- Frontend Application: Represented by React components (files under src/components, src/pages, etc.) that comprise the user interface (e.g., HomePage, WatchPage).
- Containerization: Illustrate the Docker build process which generates the container image (Dockerfile, .dockerignore, etc.). Include the TMDB API key build arg integration.
- Source code checkout,
- Code quality and security scanning via SonarQube, Trivy, and OWASP Dependency-Check,
- Dependency installation,
- Docker build and push,
- Deployment to a container.
- Deployment Infrastructure:
- AWS EC2: The host where Docker and CI/CD tools reside.
- Kubernetes: Shown with deployment YAML files under the Kubernetes directory, used for orchestrated container deployment.
- Monitoring Stack:
- Prometheus: For scraping metrics (with associated Node Exporter running on nodes).
- Grafana: For visualizing these metrics.
- Notification & Security Tools: Include not only the static analysis and scanning tools (SonarQube, Trivy, Dependency-Check) but also the integration with external sources like the TMDB API.

##### Architectural Patterns and Design Principles
- Component Separation: Clearly show the distinction between the frontend (React application) and the underlying infrastructure (CI/CD, container orchestration, security, and monitoring).
- Containerization & Orchestration: Emphasize design principles such as container immutability and the role of Kubernetes in scaling and managing the services.
- DevSecOps Integration: Highlight how security (via SonarQube, Trivy, and Dependency-Check) is tightly coupled in the CI/CD flow, ensuring quality releases.

##### Relevant Technologies, Frameworks, and Libraries
- Frontend: React with TypeScript, Material UI components (e.g., MUI since image assets hint at Netflix-like UI).
- Containerization: Docker.
- CI/CD: Jenkins (with configuration for Java, Node.js, and plugins like SonarQube Scanner).
- Security: SonarQube, Trivy, OWASP Dependency-Check.
- Monitoring: Prometheus (with node exporter), Grafana.
- Orchestration: Kubernetes (YAML deployments, services, node-service configurations) and ArgoCD for deployment synchronization.
- Cloud: AWS EC2, with additional usage of AWS EKS for Kubernetes if needed.

##### Detailing the DevSecOps Pipeline
- Clean workspace
- Checkout from Git
- Code Quality Analysis using SonarQube
- Quality Gate confirmation
- Dependency installation via npm
- Security scans (OWASP Dependency-Check and Trivy)
- Docker Build & Push (including DockerHub credential steps)
- Deployment to container and image scan confirmation post-push.
- Integrations such as Jenkins credentials (Sonar token, Docker credentials) and external API integrations.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Code Layer
    subgraph "Code Layer"
        A1["GitHub Repository: Netflix Clone"]:::code
        A2["React Frontend"]:::frontend
        A3["UI: src/"]:::frontend
        A4["Components: src/components/"]:::frontend
        A5["Pages: src/pages/"]:::frontend
        A1 --> A2
        A2 --> A3
        A2 --> A4
        A2 --> A5
    end

    %% Build & Containerization Layer
    subgraph "Build & Containerization Layer"
        B1["Docker Build Process"]:::build
        B2["Dockerfile"]:::build
        B3[".dockerignore"]:::build
        B4["Env Config: .env.example"]:::build
        B5["CI/CD Pipeline (Jenkins)"]:::build

        subgraph "Pipeline Stages"
            P1["CleanWorkspace"]:::pipeline
            P2["CheckoutCode"]:::pipeline
            P3["SonarQubeAnalysis"]:::pipeline
            P4["SecurityScans"]:::pipeline
            P5["DependencyInstall"]:::pipeline
            P6["DockerBuild&Pushed"]:::pipeline
            P7["DeploymentTrigger"]:::pipeline
        end
        B5 --> P1
        P1 --> P2
        P2 --> P3
        P3 --> P4
        P4 --> P5
        P5 --> P6
        P6 --> P7
        B1 --> B2
        B1 --> B3
        B1 --> B4
        P7 --> B1
    end

    %% Deployment & Orchestration Layer
    subgraph "Deployment & Orchestration Layer"
        D1["AWS EC2"]:::deploy
        D2["Kubernetes Cluster"]:::deploy
        D3["Kubernetes Manifests: Kubernetes/"]:::deploy
        D4["ArgoCD"]:::deploy
        D2 --> D3
        D4 --> D2
    end

    %% Monitoring & Security Layer
    subgraph "Monitoring & Security Layer"
        M1["Prometheus"]:::monitor
        M2["Grafana"]:::monitor
        S1["SonarQube"]:::security
        S2["Trivy"]:::security
        S3["OWASPDependencyCheck"]:::security
    end

    %% External Services
    E1["TMDB API"]:::external

    %% Inter-Layer Connections
    A2 -->|"pushCode"| B5
    B1 -->|"DockerImageBuilt&Pushed"| D1
    B1 -->|"DockerImageBuilt"| D2
    D1 -->|"runsContainer"| A2
    D2 -->|"managesDeployments"| A2
    A2 -->|"fetchesContent"| E1
    D2 -->|"exposesMetrics"| M1
    M1 -->|"visualizesMetrics"| M2
    B5 -->|"triggers"| S1
    B5 -->|"triggers"| S2
    B5 -->|"triggers"| S3

    %% Click Events
    click A3 "https://github.com/jseb37/devsecops-project/tree/main/src/"
    click A4 "https://github.com/jseb37/devsecops-project/tree/main/src/components/"
    click A5 "https://github.com/jseb37/devsecops-project/tree/main/src/pages/"
    click B2 "https://github.com/jseb37/devsecops-project/tree/main/Dockerfile"
    click B3 "https://github.com/jseb37/devsecops-project/blob/main/.dockerignore"
    click B4 "https://github.com/jseb37/devsecops-project/blob/main/.env.example"
    click B5 "https://github.com/jseb37/devsecops-project/blob/main/pipeline.txt"
    click D3 "https://github.com/jseb37/devsecops-project/tree/main/Kubernetes/"

    %% Styles
    classDef code fill:#f9c,stroke:#333,stroke-width:2px;
    classDef frontend fill:#a7c7e7,stroke:#333,stroke-width:2px;
    classDef build fill:#c3f7d2,stroke:#333,stroke-width:2px;
    classDef pipeline fill:#9ad1f5,stroke:#333,stroke-width:2px;
    classDef deploy fill:#fdd49e,stroke:#333,stroke-width:2px;
    classDef monitor fill:#ffe680,stroke:#333,stroke-width:2px;
    classDef security fill:#f4a7a0,stroke:#333,stroke-width:2px;
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:2px;
```
