# rabbii96/mega architecture

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

- Interactive diagram: https://gitdiagram.com/rabbii96/mega
- Repository: https://github.com/rabbii96/mega

## Overview

1. This repository is a full-stack MERN application with a delivery platform built around Docker, Jenkins, GitOps, and Kubernetes on AWS EKS. The application itself is a simple product-management domain, but the repo is equally about the deployment pipeline and cluster operations around it.

2. The core request/response path is: browser UI in the frontend sends HTTP calls through an Axios wrapper to the backend API, the backend reads/writes product data in MongoDB, and responses are rendered back in the React UI. That is the main data flow you would diagram.

3. The backend lives in `backend/` and is organized as a small Express-style API with clear layers: `routes/` defines endpoints, `controllers/` contains request handlers, `models/` defines the product schema, and `config/` holds database connection and utility code. `server.mjs` is the entrypoint, and the use of `.mjs` indicates ES modules.

4. The backend domain is centered on products only. Files like `controllers/productController.mjs`, `models/product.mjs`, and `routes/productRoutes.mjs` show CRUD-style product operations rather than a broad multi-domain service.

5. The frontend lives in `frontend/` and is a Vite-based React app. The main screens are `ProductPage.jsx` and `ProductForm.jsx`, with `ProductCard.jsx` as a reusable view component. Routing is handled under `frontend/src/routes/`, and `frontend/src/axios/invAxios.js` is the API client boundary to the backend.

6. Frontend configuration suggests environment-specific API endpoints via `frontend/src/config/index.js` and `.env.docker`. This implies the UI is meant to run both locally and in containers, with the backend URL injected per environment.

7. MongoDB is treated as a separate infrastructure component rather than an embedded dependency. The repo includes `kubernetes/mongodb.yaml`, persistent volume and claim manifests, and `database/` with a Dockerfile plus `db-setup.sh`, indicating the database can be provisioned in cluster with durable storage.

8. Containerization is first-class. Both `frontend/` and `backend/` have Dockerfiles, and there is a top-level `docker-compose.yml` for local multi-container execution. That means the app can run as a 3-tier stack: frontend container, backend container, and MongoDB container.

9. Kubernetes deployment is defined in `kubernetes/` with separate manifests for frontend, backend, MongoDB, and storage. The README shows the app is exposed through NodePort services, with frontend and backend assigned fixed external ports, so the cluster boundary is intentionally public-facing through worker nodes.

10. GitOps is the CD model. `GitOps/Jenkinsfile` and the ArgoCD setup in the README indicate Jenkins builds artifacts and then updates Kubernetes manifests in Git, while ArgoCD watches the repo and syncs the cluster from the `kubernetes/` directory. In other words, Git is the source of truth for deployment state.

11. Jenkins is the main CI orchestrator. The repo contains a root `Jenkinsfile` for CI and a separate GitOps pipeline file under `GitOps/`. The pipelines are designed to run scans and quality gates, then build container images and push them to the registry before CD takes over.

12. The supply-chain/security tooling is built into the delivery flow: OWASP Dependency-Check, SonarQube, and Trivy are all called out in the README and wired into Jenkins. SonarQube handles code-quality analysis, OWASP handles dependency vulnerability checks, and Trivy scans the filesystem/image content.

13. The AWS infrastructure layer is split between cluster provisioning and node provisioning. `terraform/` contains EC2-related infrastructure code, while the README describes EKS creation via `eksctl` and then cluster access through Jenkins/master EC2. So Terraform supports base infrastructure, but EKS is the actual runtime platform for the app.

14. Operational automation is in `Automations/`, with scripts for updating frontend and backend deployment values before CI/CD runs. Those scripts appear to inject the current worker-node instance ID, which suggests the app’s exposed endpoints or deployment manifests depend on the target node address.

15. Monitoring is layered on top of the cluster using Helm-installed Prometheus and Grafana. This is not part of the application code path, but it is part of the production architecture: app pods emit metrics to the monitoring stack running in the same EKS environment.

16. Overall boundary map: React UI at the edge, Express/Mongo backend in the application tier, Kubernetes as the runtime boundary, Jenkins as build/scan/orchestration, ArgoCD as deployment reconciler, and AWS EKS/EC2/Terraform as infrastructure. The diagram should emphasize that the repo is not just an app—it is an app plus a full CI/CD and GitOps delivery system.

Main entry points: [`Jenkinsfile`](https://github.com/rabbii96/mega/tree/main/Jenkinsfile) (CI pipeline), [`frontend/src/pages/ProductPage.jsx`](https://github.com/rabbii96/mega/blob/main/frontend/src/pages/ProductPage.jsx) (Product page), [`frontend/src/axios/invAxios.js`](https://github.com/rabbii96/mega/blob/main/frontend/src/axios/invAxios.js) (API client), [`kubernetes/frontend.yaml`](https://github.com/rabbii96/mega/blob/main/kubernetes/frontend.yaml) (K8s manifests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Frontend"]
  node_ui_app["React app<br/>Vite React UI<br/>[App.jsx]"]
  node_ui_page["Product page<br/>screen<br/>[ProductPage.jsx]"]
  node_ui_form["Product form<br/>screen<br/>[ProductForm.jsx]"]
  node_ui_card["Product card<br/>[ProductCard.jsx]"]
  node_ui_client["API client<br/>axios wrapper<br/>[invAxios.js]"]
  node_ui_routes["Routes<br/>router<br/>[index.jsx]"]
  node_ui_config["Env config<br/>[index.js]"]
end

subgraph group_backend["Backend"]
  node_api_server["Server<br/>Express entrypoint<br/>[server.mjs]"]
  node_api_routes["Routes<br/>[productRoutes.mjs]"]
  node_api_ctrl["Controller<br/>request handlers"]
  node_api_model[("Product model<br/>Mongo schema<br/>[product.mjs]")]
  node_api_db["DB config<br/>connection setup<br/>[db.mjs]"]
end

subgraph group_data["Data"]
  node_data_mongo[("MongoDB<br/>database<br/>[mongodb.yaml]")]
  node_data_pv["Storage<br/>persistent volume"]
end

subgraph group_delivery["Delivery"]
  node_compose["Compose<br/>local stack<br/>[docker-compose.yml]"]
  node_backend_image["Backend image<br/>container build"]
  node_frontend_image["Frontend image<br/>container build"]
  node_db_image["DB image<br/>container build"]
  node_ci_root["CI pipeline<br/>Jenkinsfile"]
  node_gitops_ci["GitOps pipeline<br/>Jenkinsfile"]
  node_automation["Automation scripts<br/>shell ops"]
end

subgraph group_infra["Infrastructure"]
  node_k8s_stack["K8s manifests<br/>deployments<br/>[frontend.yaml]"]
  node_eks_cluster{{"EKS cluster<br/>runtime platform<br/>[README.md]"}}
  node_terraform["Terraform<br/>EC2 infra<br/>[ec2.tf]"]
  node_argo_cd{{"ArgoCD<br/>GitOps reconciler<br/>[README.md]"}}
  node_monitoring(("Monitoring<br/>Prometheus/Grafana<br/>[README.md]"))
end

node_ui_app -->|"uses"| node_ui_routes
node_ui_routes -->|"loads"| node_ui_page
node_ui_page -->|"opens"| node_ui_form
node_ui_page -->|"renders"| node_ui_card
node_ui_page -->|"calls API"| node_ui_client
node_ui_form -->|"calls API"| node_ui_client
node_ui_client -->|"reads"| node_ui_config
node_ui_client -->|"HTTP"| node_api_server
node_api_server -->|"registers"| node_api_routes
node_api_routes -->|"dispatches"| node_api_ctrl
node_api_ctrl -->|"uses"| node_api_model
node_api_model -->|"connects via"| node_api_db
node_api_db -->|"connects"| node_data_mongo
node_data_mongo -->|"stores on"| node_data_pv
node_compose -->|"builds"| node_frontend_image
node_compose -->|"builds"| node_backend_image
node_compose -->|"builds"| node_db_image
node_ci_root -->|"builds"| node_backend_image
node_ci_root -->|"builds"| node_frontend_image
node_ci_root -->|"uses"| node_automation
node_ci_root -->|"publishes"| node_k8s_stack
node_gitops_ci -->|"updates"| node_k8s_stack
node_argo_cd -->|"syncs"| node_k8s_stack
node_k8s_stack -->|"runs on"| node_eks_cluster
node_terraform -->|"provisions base"| node_eks_cluster
node_eks_cluster -->|"hosts"| node_monitoring
node_ci_root -->|"hands off to"| node_argo_cd

click node_ui_app "https://github.com/rabbii96/mega/blob/main/frontend/src/App.jsx"
click node_ui_page "https://github.com/rabbii96/mega/blob/main/frontend/src/pages/ProductPage.jsx"
click node_ui_form "https://github.com/rabbii96/mega/blob/main/frontend/src/pages/ProductForm.jsx"
click node_ui_card "https://github.com/rabbii96/mega/blob/main/frontend/src/components/ProductCard.jsx"
click node_ui_client "https://github.com/rabbii96/mega/blob/main/frontend/src/axios/invAxios.js"
click node_ui_routes "https://github.com/rabbii96/mega/blob/main/frontend/src/routes/index.jsx"
click node_ui_config "https://github.com/rabbii96/mega/blob/main/frontend/src/config/index.js"
click node_api_server "https://github.com/rabbii96/mega/blob/main/backend/server.mjs"
click node_api_routes "https://github.com/rabbii96/mega/blob/main/backend/routes/productRoutes.mjs"
click node_api_ctrl "https://github.com/rabbii96/mega/blob/main/backend/controllers/productController.mjs"
click node_api_model "https://github.com/rabbii96/mega/blob/main/backend/models/product.mjs"
click node_api_db "https://github.com/rabbii96/mega/blob/main/backend/config/db.mjs"
click node_data_mongo "https://github.com/rabbii96/mega/blob/main/kubernetes/mongodb.yaml"
click node_data_pv "https://github.com/rabbii96/mega/blob/main/kubernetes/persistentVolume.yaml"
click node_compose "https://github.com/rabbii96/mega/blob/main/docker-compose.yml"
click node_backend_image "https://github.com/rabbii96/mega/tree/main/backend/Dockerfile"
click node_frontend_image "https://github.com/rabbii96/mega/tree/main/frontend/Dockerfile"
click node_db_image "https://github.com/rabbii96/mega/tree/main/database/Dockerfile"
click node_ci_root "https://github.com/rabbii96/mega/tree/main/Jenkinsfile"
click node_gitops_ci "https://github.com/rabbii96/mega/tree/main/GitOps/Jenkinsfile"
click node_automation "https://github.com/rabbii96/mega/blob/main/Automations/updatefrontendnew.sh"
click node_k8s_stack "https://github.com/rabbii96/mega/blob/main/kubernetes/frontend.yaml"
click node_eks_cluster "https://github.com/rabbii96/mega/blob/main/README.md"
click node_terraform "https://github.com/rabbii96/mega/blob/main/terraform/ec2.tf"
click node_argo_cd "https://github.com/rabbii96/mega/blob/main/README.md"
click node_monitoring "https://github.com/rabbii96/mega/blob/main/README.md"

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_ui_app,node_ui_page,node_ui_form,node_ui_card,node_ui_client,node_ui_routes,node_ui_config toneBlue
class node_api_server,node_api_routes,node_api_ctrl,node_api_model,node_api_db toneAmber
class node_data_mongo,node_data_pv toneMint
class node_compose,node_backend_image,node_frontend_image,node_db_image,node_ci_root,node_gitops_ci,node_automation toneRose
class node_k8s_stack,node_eks_cluster,node_terraform,node_argo_cd,node_monitoring toneIndigo
```

## Components

### Frontend

Vite + React UI and API client boundary

- [React app](https://github.com/rabbii96/mega/blob/main/frontend/src/App.jsx): Vite React UI · Browser-facing product management interface · `frontend/src/App.jsx`
- [Product page](https://github.com/rabbii96/mega/blob/main/frontend/src/pages/ProductPage.jsx): screen · Main product listing and interaction screen · `frontend/src/pages/ProductPage.jsx`
- [Product form](https://github.com/rabbii96/mega/blob/main/frontend/src/pages/ProductForm.jsx): screen · Create/edit product form · `frontend/src/pages/ProductForm.jsx`
- [Product card](https://github.com/rabbii96/mega/blob/main/frontend/src/components/ProductCard.jsx): Reusable product presentation component · `frontend/src/components/ProductCard.jsx`
- [API client](https://github.com/rabbii96/mega/blob/main/frontend/src/axios/invAxios.js): axios wrapper · HTTP boundary to the backend API · `frontend/src/axios/invAxios.js`
- [Routes](https://github.com/rabbii96/mega/blob/main/frontend/src/routes/index.jsx): router · Frontend route wiring · `frontend/src/routes/index.jsx`
- [Env config](https://github.com/rabbii96/mega/blob/main/frontend/src/config/index.js): config · Environment-specific frontend endpoint settings · `frontend/src/config/index.js`

### Backend

Express API and product domain

- [Server](https://github.com/rabbii96/mega/blob/main/backend/server.mjs): Express entrypoint · Backend process bootstrap and HTTP server · `backend/server.mjs`
- [Routes](https://github.com/rabbii96/mega/blob/main/backend/routes/productRoutes.mjs): HTTP routes · Maps product endpoints to controllers · `backend/routes/productRoutes.mjs`
- [Controller](https://github.com/rabbii96/mega/blob/main/backend/controllers/productController.mjs): request handlers · Product CRUD request handling · `backend/controllers/productController.mjs`
- [Product model](https://github.com/rabbii96/mega/blob/main/backend/models/product.mjs): Mongo schema · Product data schema and persistence model · `backend/models/product.mjs`
- [DB config](https://github.com/rabbii96/mega/blob/main/backend/config/db.mjs): connection setup · MongoDB connection utilities · `backend/config/db.mjs`

### Data

MongoDB and durable storage

- [MongoDB](https://github.com/rabbii96/mega/blob/main/kubernetes/mongodb.yaml): database · Persistent product data store · `kubernetes/mongodb.yaml`
- [Storage](https://github.com/rabbii96/mega/blob/main/kubernetes/persistentVolume.yaml): persistent volume · Durable storage for MongoDB data · `kubernetes/persistentVolume.yaml`

### Delivery

CI/CD, GitOps, and automation

- [Compose](https://github.com/rabbii96/mega/blob/main/docker-compose.yml): local stack · Three-container local runtime composition · `docker-compose.yml`
- [Backend image](https://github.com/rabbii96/mega/tree/main/backend/Dockerfile): container build · Backend container definition · `backend/Dockerfile`
- [Frontend image](https://github.com/rabbii96/mega/tree/main/frontend/Dockerfile): container build · Frontend container definition · `frontend/Dockerfile`
- [DB image](https://github.com/rabbii96/mega/tree/main/database/Dockerfile): container build · MongoDB initialization container definition · `database/Dockerfile`
- [CI pipeline](https://github.com/rabbii96/mega/tree/main/Jenkinsfile): Jenkinsfile · Primary CI pipeline for build, scan, and publish · `Jenkinsfile`
- [GitOps pipeline](https://github.com/rabbii96/mega/tree/main/GitOps/Jenkinsfile): Jenkinsfile · Pipeline that updates deployment state in Git · `GitOps/Jenkinsfile`
- [Automation scripts](https://github.com/rabbii96/mega/blob/main/Automations/updatefrontendnew.sh): shell ops · Deployment value update scripts used before CI/CD · `Automations/updatefrontendnew.sh`

### Infrastructure

Kubernetes, cloud, and provisioning

- [K8s manifests](https://github.com/rabbii96/mega/blob/main/kubernetes/frontend.yaml): deployments · Frontend, backend, MongoDB, and storage manifests · `kubernetes/frontend.yaml`
- [EKS cluster](https://github.com/rabbii96/mega/blob/main/README.md): runtime platform · Kubernetes runtime boundary on AWS EKS · `README.md`
- [Terraform](https://github.com/rabbii96/mega/blob/main/terraform/ec2.tf): EC2 infra · Base AWS infrastructure provisioning · `terraform/ec2.tf`
- [ArgoCD](https://github.com/rabbii96/mega/blob/main/README.md): GitOps reconciler · Synchronizes cluster state from Git · `README.md`
- [Monitoring](https://github.com/rabbii96/mega/blob/main/README.md): Prometheus/Grafana · Cluster metrics and dashboards · `README.md`

## Connections

- React app → Routes: uses · Application shell is routed into screens
- Routes → Product page: loads · Primary product screen is routed
- Product page → Product form: opens · Create/edit actions open the form
- Product page → Product card: renders · Product list uses reusable cards
- Product page → API client: calls API · Screen issues backend requests through client wrapper
- Product form → API client: calls API · Form submits product mutations through client wrapper
- API client → Env config: reads · API base URL comes from environment config
- API client → Server: HTTP · Frontend talks to backend server endpoints
- Server → Routes: registers · Server mounts product route handlers
- Routes → Controller: dispatches · Route handlers delegate to controller logic
- Controller → Product model: uses · Controller persists and queries product records
- Product model → DB config: connects via · Model operations depend on Mongo connection setup
- DB config → MongoDB: connects · Backend connects to MongoDB service
- MongoDB → Storage: stores on · MongoDB data is backed by durable storage
- Compose → Frontend image: builds · Local stack includes the frontend container
- Compose → Backend image: builds · Local stack includes the backend container
- Compose → DB image: builds · Local stack includes the database container
- CI pipeline → Backend image: builds · CI builds backend image
- CI pipeline → Frontend image: builds · CI builds frontend image
- CI pipeline → Automation scripts: uses · Pipelines incorporate deployment update scripts
- CI pipeline → K8s manifests: publishes · CI produces deployable image and manifest changes
- GitOps pipeline → K8s manifests: updates · GitOps pipeline writes desired cluster state
- ArgoCD → K8s manifests: syncs · ArgoCD watches manifests as source of truth
- K8s manifests → EKS cluster: runs on · Manifests are applied to the EKS runtime
- Terraform → EKS cluster: provisions base · Terraform supports underlying AWS infrastructure
- EKS cluster → Monitoring: hosts · Cluster also runs metrics and dashboards
- CI pipeline → ArgoCD: hands off to · Git-based deployment is reconciled after CI
