# belennazareth/app architecture

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

- Interactive diagram: https://gitdiagram.com/belennazareth/app
- Repository: https://github.com/belennazareth/app

## Overview

A. Project Type and Purpose
1. This is a Node.js–based web application (app.js + EJS views) packaged in Docker, deployed via a Helm chart to Kubernetes, and built/rolled out via Jenkins CI.
2. There is no database or external API in this repo—just a server‐rendered web UI and a CI/CD pipeline.

B. Top‐Level Components to Represent
##### Source Code Repository
- app.js, views/, package.json, Dockerfile, Jenkinsfile, chart/ (Helm chart).
##### Continuous Integration / Delivery (Jenkins)
- Jenkinsfile that builds the Docker image, pushes to registry, and triggers Helm deployment.
##### Container Registry
- Docker registry (e.g., DockerHub or private registry) holding built images.
##### Kubernetes Cluster
- Ingress (ingress.yaml)
- Service (service.yaml)
- Deployment (deployment.yaml + image)
- Horizontal Pod Autoscaler (hpa.yaml)
##### End User / Browser
- HTTP(S) requests coming through Ingress to the Node.js server.

C. Relationships and Data Flows
##### Jenkins runs Helm upgrade/install against the target Kubernetes cluster.
4. Kubernetes Ingress receives HTTP(S) requests → forwards to Service → load-balances to Node.js pods.
##### Pods run the Node.js app, render views, return HTML to the user’s browser.

D. Architectural Patterns and Principles
##### Containerization: Dockerfile ensures environment consistency.

- Rectangles for code & CI/CD components
- Blue for Dev Tools (Repo, Jenkins)
- Green for Containers/Registry
- Orange for Kubernetes
- Gray for User.

##### Middle Row (Deployment)
- Grouped area labeled “Kubernetes Cluster” containing:
- HPA attached to Deployment
##### Bottom Row (Clients)

G. “Corrections” to Ensure Accurate Representation
- Helm chart’s role: group all chart/templates files under “Helm Chart” component pointing at K8s.
- Jenkinsfile: it orchestrates both container build and Helm deployment in one pipeline.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Development & CI/CD"
        subgraph "Git Repository" 
            app_js["app.js"]:::devtools
            pkg_json["package.json"]:::devtools
            pkg_lock["package-lock.json"]:::devtools
            view_idx["views/index.ejs"]:::devtools
            view_posts["views/posts.ejs"]:::devtools
            dockerfile["Dockerfile"]:::devtools
            jenkinsfile["Jenkinsfile"]:::devtools
            subgraph "Helm Chart"
                chart_yaml["Chart.yaml"]:::infra
                values_yaml["values.yaml"]:::infra
                helmignore[".helmignore"]:::infra
                helpers_tpl["_helpers.tpl"]:::infra
                notes_txt["NOTES.txt"]:::infra
                test_conn["test-connection.yaml"]:::infra
            end
        end
        git_repo["Source Code Repository"]:::devtools
        jenkins["Jenkins Server"]:::devtools
        registry["Docker Registry"]:::registry
    end

    subgraph "Kubernetes Cluster"
        ingress["Ingress"]:::k8s
        service["Service"]:::k8s
        deployment["Deployment (3 Pods)"]:::k8s
        hpa["Horizontal Pod Autoscaler"]:::k8s
        sa["ServiceAccount"]:::k8s
    end

    browser["End User Browser"]:::user

    browser -->|"HTTP(S)"| ingress
    ingress -->|"forwards"| service
    service -->|"load-balances"| deployment
    hpa -->|"scales"| deployment

    git_repo -->|"git push"| jenkins
    jenkins -->|"docker build/push"| registry
    jenkins -->|"helm upgrade/install"| ingress

    click app_js "https://github.com/belennazareth/app/blob/main/app.js"
    click pkg_json "https://github.com/belennazareth/app/blob/main/package.json"
    click pkg_lock "https://github.com/belennazareth/app/blob/main/package-lock.json"
    click view_idx "https://github.com/belennazareth/app/blob/main/views/index.ejs"
    click view_posts "https://github.com/belennazareth/app/blob/main/views/posts.ejs"
    click dockerfile "https://github.com/belennazareth/app/tree/main/Dockerfile"
    click jenkinsfile "https://github.com/belennazareth/app/tree/main/Jenkinsfile"
    click chart_yaml "https://github.com/belennazareth/app/blob/main/chart/Chart.yaml"
    click values_yaml "https://github.com/belennazareth/app/blob/main/chart/values.yaml"
    click helmignore "https://github.com/belennazareth/app/blob/main/chart/.helmignore"
    click helpers_tpl "https://github.com/belennazareth/app/blob/main/chart/templates/_helpers.tpl"
    click notes_txt "https://github.com/belennazareth/app/blob/main/chart/templates/NOTES.txt"
    click test_conn "https://github.com/belennazareth/app/blob/main/chart/templates/tests/test-connection.yaml"
    click ingress "https://github.com/belennazareth/app/blob/main/chart/templates/ingress.yaml"
    click service "https://github.com/belennazareth/app/blob/main/chart/templates/service.yaml"
    click deployment "https://github.com/belennazareth/app/blob/main/chart/templates/deployment.yaml"
    click hpa "https://github.com/belennazareth/app/blob/main/chart/templates/hpa.yaml"
    click sa "https://github.com/belennazareth/app/blob/main/chart/templates/serviceaccount.yaml"

    classDef devtools fill:#ADD8E6,stroke:#000;
    classDef registry fill:#90EE90,stroke:#000;
    classDef k8s fill:#FFA500,stroke:#000;
    classDef user fill:#D3D3D3,stroke:#000;
    classDef infra fill:#ADD8E6,stroke:#000;
```
