# londheshubham153/wanderlust-mega-project architecture

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

- Interactive diagram: https://gitdiagram.com/londheshubham153/wanderlust-mega-project
- Repository: https://github.com/londheshubham153/wanderlust-mega-project

## Overview

##### Project type and purpose
- This is a full‑stack, three‑tier MERN travel blog application (“Wanderlust”) that uses React/Vite for the frontend, Node/Express for the backend API, MongoDB for persistence and Redis for caching.
- It’s delivered via a GitOps CI/CD pipeline on AWS EKS (Kubernetes), with infrastructure managed via Terraform and Helm, and monitored by Prometheus/Grafana.

##### File structure
- Top‑level folders:
– frontend: React/TypeScript + Vite + Tailwind CSS, unit/integration tests, Dockerfile, Vercel config
– backend: Node/Express REST API, controllers/models/services, Redis integration, Dockerfile, tests
– database: Dockerfile for MongoDB
– kubernetes: YAMLs for frontend, backend, MongoDB, Redis, PV/PVC
– terraform: EC2 and EKS setup
– GitOps & Automations: Jenkinsfile, update scripts
- Jenkins CI/CD lives in GitOps, Terraform provisions AWS, k8s manifests describe runtime.

##### README insights
- CI uses Jenkins Master & Agents to build Docker images, run OWASP/Trivy/SonarQube scans, push to registry
- CD is driven by ArgoCD watching the GitOps repo and deploying to EKS
- Monitoring via Helm‑deployed Prometheus/Grafana in the cluster

##### Main components
a. User / Browser (client)
b. Frontend service (React/Vite app served via Node or static files)
c. Backend API (Node/Express)
d. Data layer: MongoDB (persistent storage) and Redis (cache)
e. CI pipeline: Jenkins Master, Jenkins Agents
f. Container registry (Docker Hub or AWS ECR)
g. Git repository (GitHub)
h. CD/GitOps tool: ArgoCD (inside Kubernetes)
i. Infrastructure: AWS EKS cluster (Pods, Deployments, Services, PV/PVC), Terraform-managed AWS resources, inode volumes
j. Monitoring: Prometheus & Grafana (Helm charts in k8s)

##### Relationships & data/control flows
- Developer → pushes code to GitHub
- Jenkins Master/Agent → pulls code, runs tests & scans, builds Docker images → pushes images to registry → updates GitOps manifests or triggers update scripts
- ArgoCD → watches GitOps repo → pulls new manifests → applies to EKS → spins up frontend/backend/MongoDB/Redis pods
- User → hits LoadBalancer/NodePort → routes to Frontend pods → frontend makes REST calls to Backend pods
- Backend → reads/writes to MongoDB, reads/writes cache in Redis
- Prometheus → scrapes metrics from application and k8s endpoints → Grafana → dashboards
- Terraform → provisions EKS cluster, EC2 for Jenkins, IAM roles

##### Architectural patterns & principles
- Three‑tier separation: Presentation (frontend), Business (backend), Data (DB/cache)
- Microservices‑style isolation between frontend and backend
- GitOps for declarative CD—ArgoCD pulls from Git
- Infrastructure-as-code with Terraform & Helm
- CI/CD as code with Jenkinsfile
- PVCs for stateful workloads (MongoDB)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% CI Infrastructure
    subgraph "CI Infrastructure"
        GH["GitHub"]:::external
        JM["Jenkins Master"]:::tool
        JA["Jenkins Agents"]:::tool
        REG["Container Registry"]:::external
        GH -->|"push code"| JM
        JM -->|"delegate build"| JA
        JA -->|"build/tests/scans"| REG
    end

    %% Terraform-managed Infra
    subgraph "Terraform‑provisioned AWS Infra"
        Terra["Terraform"]:::infra
        AWS["AWS"]:::cloud
        Terra -->|"provision"| AWS
    end

    %% CD/GitOps
    subgraph "CD/GitOps"
        ARC["ArgoCD"]:::tool
        GH -->|"sync manifests"| ARC
        REG -->|"images"| ARC
    end

    %% Kubernetes Cluster
    subgraph "AWS EKS Cluster"
        direction TB
        LB["LoadBalancer"]:::infra
        USR["User Browser"]:::external

        LB -->|"HTTP"| FE_DEP
        USR -->|"HTTP"| LB

        subgraph "Application Pods"
            FE_DEP["Frontend (React/Vite/Tailwind)"]:::service
            BE_DEP["Backend (Node/Express)"]:::service
            MONGO["MongoDB"]:::database
            REDIS["Redis"]:::database
            PV1["PersistentVolume"]:::infra
            PVC["PersistentVolumeClaim"]:::infra
        end

        FE_DEP -->|"REST API calls"| BE_DEP
        BE_DEP -->|"read/write"| MONGO
        BE_DEP -->|"cache ops"| REDIS
        MONGO --> PVC
        MONGO --> PV1

        ARC -->|"deploy manifests"| FE_DEP
        ARC -->|"deploy manifests"| BE_DEP
        ARC -->|"deploy manifests"| MONGO
        ARC -->|"deploy manifests"| REDIS
    end

    %% Monitoring
    subgraph "Monitoring"
        PROM["Prometheus"]:::monitor
        GRAF["Grafana"]:::monitor
        PROM -->|"metrics"| GRAF
        FE_DEP -->|"scrape"| PROM
        BE_DEP -->|"scrape"| PROM
        MONGO -->|"metrics"| PROM
        REDIS -->|"metrics"| PROM
        ARC -->|"deploy charts"| PROM
        ARC -->|"deploy charts"| GRAF
    end

    %% Connections
    Terra --> AWS
    ARC -->|"applies to"| LB

    %% Click Events
    click FE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/frontend/"
    click FE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/frontend/src/"
    click FE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/frontend/Dockerfile"
    click FE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/blob/main/frontend/vercel.json"
    click BE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/backend/"
    click BE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/backend/controllers/"
    click BE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/backend/routes/"
    click BE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/backend/models/"
    click BE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/blob/main/backend/services/redis.js"
    click BE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/backend/utils/"
    click BE_DEP "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/backend/Dockerfile"
    click MONGO "https://github.com/londheshubham153/wanderlust-mega-project/blob/main/kubernetes/mongodb.yaml"
    click REDIS "https://github.com/londheshubham153/wanderlust-mega-project/blob/main/kubernetes/redis.yaml"
    click PV1 "https://github.com/londheshubham153/wanderlust-mega-project/blob/main/kubernetes/persistentVolume.yaml"
    click PVC "https://github.com/londheshubham153/wanderlust-mega-project/blob/main/kubernetes/persistentVolumeClaim.yaml"
    click JM "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/GitOps/Jenkinsfile"
    click JA "https://github.com/londheshubham153/wanderlust-mega-project/tree/main/Jenkinsfile"
    click Terra "https://github.com/londheshubham153/wanderlust-mega-project/blob/main/terraform/terraform.tf"

    %% Styles
    classDef external fill:#D3E5FF,stroke:#034694,color:#034694;
    classDef cloud fill:#E0F7FA,stroke:#00796B,color:#00796B;
    classDef tool fill:#FFF3E0,stroke:#F57C00,color:#E65100,shape:hexagon;
    classDef infra fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32;
    classDef service fill:#E3F2FD,stroke:#1E88E5,color:#0D47A1,shape:round-rect;
    classDef database fill:#FCE4EC,stroke:#C2185B,color:#880E4F,shape:cylinder;
    classDef monitor fill:#FFFDE7,stroke:#FBC02D,color:#F57F17;
```
