# aadi-sonwane/wanderlust-mega-project architecture

> Architecture diagram of the GitHub repository aadi-sonwane/wanderlust-mega-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/aadi-sonwane/wanderlust-mega-project
- Repository: https://github.com/aadi-sonwane/wanderlust-mega-project

## Overview

##### Main Components
a. Frontend Component:
- Located in the “frontend” directory with clear indications of React components, pages, assets, and configuration files.
- Represents the user interface of the travel blog.
- Communicates with the backend APIs.
b. Backend Component:
- Found in the “backend” directory, including API endpoints (in the “api”, “controllers”, “routes” folders) and services (such as Redis integration).
- Containerized via its Dockerfile.
c. Database & Caching:
- MongoDB (as the primary data store) and Redis (for caching) as inferred from the file structure and configuration scripts.
d. CI/CD Pipeline & Automation:
- Jenkins Master and Worker nodes with pipelines for CI (build and push Docker images) and CD (deploying versions via ArgoCD).
- Automation scripts in the “Automations” folder and GitOps configuration in the “GitOps” folder.
e. Infrastructure and Deployment:
- Kubernetes YAML configurations (in the “kubernetes” folder) for backend, frontend, MongoDB, persistent volumes, and Redis.
- Terraform scripts (in the “terraform” directory) for provisioning AWS resources.
f. Monitoring and Security:
- Prometheus and Grafana deployed via Helm charts (details provided in the README) for monitoring metrics.
- Tools like OWASP, SonarQube, and Trivy integrated in the pipeline for code quality and security scans.

##### Relationships and Interactions
- The Frontend communicates with the Backend via REST APIs.
- The Backend acts as an interface between user requests and the Database (MongoDB) while leveraging Redis for caching.
- The CI/CD pipeline (Jenkins jobs and automation scripts) triggers Docker builds and image pushes, which then update the deployed Kubernetes resources via ArgoCD.
- Infrastructure-as-code (Terraform & Kubernetes manifests) orchestrates deployment on AWS EKS.
- Monitoring and logging components (Prometheus & Grafana) observe the health and performance of the cluster and applications.

##### Architectural Patterns & Design Principles
- Separation of Concerns: Clearly separated frontend and backend layers.
- Containerization and Orchestration: Use of Docker, Kubernetes/EKS, and GitOps (ArgoCD) emphasizes microservice-like deployment.
- CI/CD with automated pipelines: Jenkins pipelines handling build, test, and deploy processes.
- Infrastructure as Code: Kubernetes YAML and Terraform scripts to manage and deploy infrastructure consistently.
- Security and Quality Assurance: Integration of security scanning (OWASP, Trivy) and code quality analysis (SonarQube).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Development Layer
    subgraph "Development Layer"
        FE["Frontend Application"]:::frontend
        BE["Backend API Server"]:::backend
    end
    FE -->|"REST_calls"| BE

    %% Data Layer
    subgraph "Data Layer"
        DB["MongoDB Database"]:::data
        RC["Redis Cache"]:::data
    end
    BE -->|"Queries"| DB
    BE -->|"Caches"| RC

    %% CI/CD Pipeline
    subgraph "CI/CD Pipeline"
        JMaster["Jenkins Master"]:::ci
        JWorker["Jenkins Worker"]:::ci
        AS["Automation Scripts"]:::ci
        DBuild["Docker_Build&Push"]:::ci
        GitOps["ArgoCD_(GitOps)"]:::ci
    end
    FE -->|"Code_commit"| JMaster
    BE -->|"Code_commit"| JMaster
    JMaster -->|"Triggers"| DBuild
    JWorker -->|"Executes"| DBuild
    AS -->|"Updates"| DBuild
    DBuild -->|"Deploys_to"| GitOps

    %% Infrastructure & Deployment
    subgraph "Infrastructure & Deployment"
        EKS["AWS_EKS_Cluster"]:::infra
        K8s["Kubernetes_Configurations"]:::infra
        Terraform["Terraform_Managed_Infrastructure"]:::infra
    end
    GitOps -->|"Deploys_to"| EKS
    K8s -->|"Manages"| EKS
    Terraform -->|"Provisions"| EKS
    DBuild -->|"Builds_images"| EKS

    %% Monitoring
    subgraph "Monitoring"
        Prom["Prometheus"]:::monitor
        Grafana["Grafana"]:::monitor
    end
    EKS -->|"Monitored_by"| Prom
    EKS -->|"Monitored_by"| Grafana

    %% Styles
    classDef frontend fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef backend fill:#ABEBC6,stroke:#28B463,stroke-width:2px;
    classDef data fill:#F9E79F,stroke:#CA6F1E,stroke-width:2px;
    classDef ci fill:#F5B7B1,stroke:#CD6155,stroke-width:2px;
    classDef infra fill:#D2B4DE,stroke:#7D3C98,stroke-width:2px;
    classDef monitor fill:#FAD7A0,stroke:#D68910,stroke-width:2px;

    %% Click Events
    click FE "https://github.com/aadi-sonwane/wanderlust-mega-project/tree/main/frontend/"
    click BE "https://github.com/aadi-sonwane/wanderlust-mega-project/tree/main/backend/"
    click DB "https://github.com/aadi-sonwane/wanderlust-mega-project/blob/main/kubernetes/mongodb.yaml"
    click RC "https://github.com/aadi-sonwane/wanderlust-mega-project/blob/main/backend/services/redis.js"
    click JMaster "https://github.com/aadi-sonwane/wanderlust-mega-project/tree/main/GitOps/Jenkinsfile"
    click GitOps "https://github.com/aadi-sonwane/wanderlust-mega-project/tree/main/GitOps/Jenkinsfile"
    click AS "https://github.com/aadi-sonwane/wanderlust-mega-project/tree/main/Automations/"
    click K8s "https://github.com/aadi-sonwane/wanderlust-mega-project/tree/main/kubernetes/"
    click Terraform "https://github.com/aadi-sonwane/wanderlust-mega-project/tree/main/terraform/"
```
