# skbablualam/nestly architecture

> Architecture diagram of the GitHub repository skbablualam/nestly, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/skbablualam/nestly
- Repository: https://github.com/skbablualam/nestly

## Overview

#### Purpose and Entry Points
Nestly is a small Airbnb-inspired stay-listing application used primarily to demonstrate a Node/Express-to-Kubernetes DevOps delivery lifecycle. The runtime entry point is `server.js`; the browser entry asset is `public/index.html`, which loads client behavior from `public/app.js`.

#### Application Runtime
The Node.js/Express server serves the application on port 3000 and provides the boundary between HTTP clients and static frontend assets. Dependencies and npm start/test scripts are defined in `package.json`. The frontend is a static HTML/CSS/JavaScript experience under `public/`, with no indicated database, authentication, booking, or payment integration.

Paths:
- `server.js`
- `package.json`
- `public/index.html`

#### Frontend Delivery
The browser receives static listing UI markup, styling, and interactive behavior from the public asset bundle. This is a same-origin static frontend served by Express rather than a separately deployed SPA or API client.

Paths:
- `public/index.html`
- `public/app.js`
- `public/style.css`

#### Container Boundary
`Dockerfile` packages the Node application and public assets into a portable image exposing the application runtime. `.dockerignore` constrains Docker build context. The resulting image is intended for local execution and publication to Docker Hub.

Paths:
- `Dockerfile`
- `.dockerignore`
- `package.json`

#### CI/CD Control Plane
`Jenkinsfile` defines the automation pipeline initiated by source changes in GitHub. The documented flow runs Jest/Supertest testing, SonarCloud quality analysis, and Trivy security scanning before building an image, pushing it to Docker Hub, and deploying it to Kubernetes. Jenkins requires Docker socket access and cluster credentials; `kubeconfig-jenkins.yaml` is the cluster-access boundary for the Jenkins environment.

Paths:
- `Jenkinsfile`
- `kubeconfig-jenkins.yaml`
- `package.json`

#### Kubernetes Deployment
Kubernetes manifests separate workload rollout from network exposure. The deployment consumes the built container image and creates application pods; the service exposes those pods within/through the Minikube cluster. Kubernetes is the production-like runtime target, while Minikube is the documented local cluster implementation.

Paths:
- `k8s/deployment.yaml`
- `k8s/service.yaml`
- `Dockerfile`

#### External Services and Observability
The delivery path crosses GitHub, Jenkins, SonarCloud, Trivy, Docker Hub, and Kubernetes. Prometheus and Grafana are installed as an external cluster monitoring stack through Helm; they monitor Kubernetes/application infrastructure rather than being application code in this repository. No persistence or third-party business API is represented.

Paths:
- `Jenkinsfile`
- `k8s/deployment.yaml`
- `README.md`

Main entry points: [`Jenkinsfile`](https://github.com/skbablualam/nestly/tree/main/Jenkinsfile) (Jenkins pipeline), [`server.js`](https://github.com/skbablualam/nestly/blob/main/server.js) (Express server), [`k8s/deployment.yaml`](https://github.com/skbablualam/nestly/blob/main/k8s/deployment.yaml) (Deployment), [`public/index.html`](https://github.com/skbablualam/nestly/blob/main/public/index.html) (Listing UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_browser(("Browser<br/>client"))
  node_server["Express server<br/>Node runtime<br/>[server.js]"]
  node_html["Listing UI<br/>static HTML<br/>[index.html]"]
  node_client_js["Client behavior<br/>browser JavaScript<br/>[app.js]"]
  node_styles["UI styles<br/>CSS<br/>[style.css]"]
  node_package["Node package<br/>npm manifest<br/>[package.json]"]
end

subgraph group_delivery["Delivery Pipeline"]
  node_github{{"GitHub<br/>source control"}}
  node_jenkins{{"Jenkins pipeline<br/>CI/CD"}}
  node_tests["Jest / Supertest<br/>test stage<br/>[package.json]"]
  node_sonar{{"SonarCloud<br/>quality analysis"}}
  node_trivy{{"Trivy<br/>security scan"}}
  node_dockerfile["Container build<br/>Docker image definition"]
  node_dockerhub[("Docker Hub<br/>image registry")]
  node_kubeconfig["Jenkins kubeconfig<br/>cluster credentials"]
end

subgraph group_cluster["Kubernetes Runtime"]
  node_deployment{{"Deployment<br/>Kubernetes workload<br/>[deployment.yaml]"}}
  node_service{{"Service<br/>Kubernetes network exposure<br/>[service.yaml]"}}
  node_pods["Application pods<br/>Node containers"]
  node_minikube{{"Minikube<br/>local Kubernetes cluster"}}
  node_monitoring["Prometheus + Grafana<br/>cluster monitoring"]
end

node_browser -->|"HTTP"| node_server
node_server -->|"serves"| node_html
node_html -->|"loads"| node_client_js
node_html -->|"loads"| node_styles
node_package -->|"starts"| node_server
node_github -->|"source changes trigger"| node_jenkins
node_jenkins -->|"runs"| node_tests
node_jenkins -->|"analyzes"| node_sonar
node_jenkins -->|"scans"| node_trivy
node_jenkins -->|"builds"| node_dockerfile
node_dockerfile -->|"pushes image"| node_dockerhub
node_jenkins -.->|"uses credentials"| node_kubeconfig
node_jenkins -->|"deploys"| node_deployment
node_dockerhub -->|"image"| node_deployment
node_deployment -->|"creates"| node_pods
node_service -->|"routes to"| node_pods
node_minikube -->|"hosts"| node_deployment
node_minikube -->|"hosts"| node_service
node_monitoring -.->|"monitors"| node_minikube
node_dockerfile -->|"packages"| node_server

click node_server "https://github.com/skbablualam/nestly/blob/main/server.js"
click node_html "https://github.com/skbablualam/nestly/blob/main/public/index.html"
click node_client_js "https://github.com/skbablualam/nestly/blob/main/public/app.js"
click node_styles "https://github.com/skbablualam/nestly/blob/main/public/style.css"
click node_package "https://github.com/skbablualam/nestly/blob/main/package.json"
click node_jenkins "https://github.com/skbablualam/nestly/tree/main/Jenkinsfile"
click node_tests "https://github.com/skbablualam/nestly/blob/main/package.json"
click node_dockerfile "https://github.com/skbablualam/nestly/tree/main/Dockerfile"
click node_kubeconfig "https://github.com/skbablualam/nestly/blob/main/kubeconfig-jenkins.yaml"
click node_deployment "https://github.com/skbablualam/nestly/blob/main/k8s/deployment.yaml"
click node_service "https://github.com/skbablualam/nestly/blob/main/k8s/service.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_server,node_html,node_client_js,node_styles,node_package toneBlue
class node_github,node_jenkins,node_tests,node_sonar,node_trivy,node_dockerfile,node_dockerhub,node_kubeconfig toneAmber
class node_deployment,node_service,node_pods,node_minikube,node_monitoring toneMint
```

## Components

### Application

- **Browser**: client
- [Express server](https://github.com/skbablualam/nestly/blob/main/server.js): Node runtime · Serves the same-origin static application on port 3000. · `server.js`
- [Listing UI](https://github.com/skbablualam/nestly/blob/main/public/index.html): static HTML · `public/index.html`
- [Client behavior](https://github.com/skbablualam/nestly/blob/main/public/app.js): browser JavaScript · `public/app.js`
- [UI styles](https://github.com/skbablualam/nestly/blob/main/public/style.css): CSS · `public/style.css`
- [Node package](https://github.com/skbablualam/nestly/blob/main/package.json): npm manifest · Defines dependencies and start/test scripts. · `package.json`

### Delivery Pipeline

- **GitHub**: source control
- [Jenkins pipeline](https://github.com/skbablualam/nestly/tree/main/Jenkinsfile): CI/CD · Runs validation, image delivery, and deployment. · `Jenkinsfile`
- [Jest / Supertest](https://github.com/skbablualam/nestly/blob/main/package.json): test stage · `package.json`
- **SonarCloud**: quality analysis
- **Trivy**: security scan
- [Container build](https://github.com/skbablualam/nestly/tree/main/Dockerfile): Docker image definition · Packages the Node runtime and public assets. · `Dockerfile`
- **Docker Hub**: image registry
- [Jenkins kubeconfig](https://github.com/skbablualam/nestly/blob/main/kubeconfig-jenkins.yaml): cluster credentials · `kubeconfig-jenkins.yaml`

### Kubernetes Runtime

- [Deployment](https://github.com/skbablualam/nestly/blob/main/k8s/deployment.yaml): Kubernetes workload · Rolls out pods from the published container image. · `k8s/deployment.yaml`
- [Service](https://github.com/skbablualam/nestly/blob/main/k8s/service.yaml): Kubernetes network exposure · `k8s/service.yaml`
- **Application pods**: Node containers
- **Minikube**: local Kubernetes cluster
- **Prometheus + Grafana**: cluster monitoring · Helm-installed external monitoring stack.

## Connections

- Browser → Express server: HTTP
- Express server → Listing UI: serves
- Listing UI → Client behavior: loads
- Listing UI → UI styles: loads
- Node package → Express server: starts
- GitHub → Jenkins pipeline: source changes trigger
- Jenkins pipeline → Jest / Supertest: runs
- Jenkins pipeline → SonarCloud: analyzes
- Jenkins pipeline → Trivy: scans
- Jenkins pipeline → Container build: builds
- Container build → Docker Hub: pushes image
- Jenkins pipeline → Jenkins kubeconfig: uses credentials
- Jenkins pipeline → Deployment: deploys
- Docker Hub → Deployment: image
- Deployment → Application pods: creates
- Service → Application pods: routes to
- Minikube → Deployment: hosts
- Minikube → Service: hosts
- Prometheus + Grafana → Minikube: monitors
- Container build → Express server: packages
