# iam-veeramalla/three-tier-architecture-demo architecture

> Architecture diagram of the GitHub repository iam-veeramalla/three-tier-architecture-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/iam-veeramalla/three-tier-architecture-demo
- Repository: https://github.com/iam-veeramalla/three-tier-architecture-demo

## Overview

##### Main Components
- Frontend Component: The “web” service (using Docker for Nginx + static files) serves as the externally facing storefront.
- Business Logic / Microservices: Several independent microservices exist – for example, cart, catalogue, dispatch, payment, ratings, shipping, and user. Each service is built with different technology stacks (NodeJS for cart and user, Java for shipping, Go for dispatch, PHP for ratings, etc.). Also note that there is a load generator (load-gen) which simulates user behavior.
- Data Stores: There are containerized databases and caches such as MongoDB, MySQL, Redis, and message brokers like RabbitMQ.
- Infrastructure / Monitoring: Side components include configuration for container orchestration (Kubernetes helm charts, Docker Compose files, etc.) plus integrations with Instana for full end-to-end tracing and Prometheus metrics endpoints exposed by some services.

##### Relationships and Interactions
- External users make requests to the web storefront. The web service is the entry-point where requests enter the system.
- The web service interfaces with backend microservices (e.g., cart, catalogue, payment, shipping, user) to process business logic.
- Services interact with each other as needed – for example, the cart service might communicate with catalogue to retrieve product info, and the payment service receives data from the cart.
- Data transactions occur with databases (e.g., MongoDB for non-relational data, MySQL for relational data, Redis for caching) and messaging via RabbitMQ for decoupling.
- The load generator and monitoring components (i.e., Instana instrumentation) help capture performance data and simulate loads.

##### Architectural Patterns and Deployment Strategies
- Microservices Architecture: Each service is independently containerized and deployed either via Docker Compose or orchestrated on platforms like Kubernetes, DCOS, or Swarm.
- Use of Helm Charts and Cloud-Specific Directories: The presence of dedicated directories for AKS, EKS, GKE, K8s, OpenShift, etc. indicates that while the service design remains consistent, the deployment tooling and configurations vary. Represent these as deployment environments or orchestration platforms that encapsulate the microservices.

##### Technologies and Integration Points
- For services, note the languages and frameworks (e.g., NodeJS for cart and user, Java/Spring Boot for shipping, etc.).
- Databases (MongoDB, MySQL, Redis) and external integrations such as RabbitMQ.
- That services expose Prometheus metrics endpoints (notably cart and payment) to facilitate monitoring.
- Optionally, note Instana’s role for distributed tracing and monitoring (this might be shown as an overlay monitoring service that “watches” all microservice interactions).

## Diagram (Mermaid)

```mermaid
flowchart TD

    %% Frontend Layer
    subgraph "Frontend Layer"
        External["External Users"]:::external
        Web["Web Service"]:::frontend
        LoadGen["Load Generator"]:::frontend
    end

    %% Backend Microservices Layer
    subgraph "Backend Microservices Layer"
        Cart["Cart Microservice"]:::microservice
        Catalogue["Catalogue Microservice"]:::microservice
        Dispatch["Dispatch Microservice"]:::microservice
        Payment["Payment Microservice"]:::microservice
        Ratings["Ratings Microservice"]:::microservice
        Shipping["Shipping Microservice"]:::microservice
        User["User Microservice"]:::microservice
    end

    %% Data Persistence Layer
    subgraph "Data Persistence Layer"
        MongoDB["MongoDB"]:::database
        MySQL["MySQL"]:::database
        Redis["Redis Cache"]:::database
        RabbitMQ["RabbitMQ"]:::database
    end

    %% Deployment Infrastructure Layer
    subgraph "Deployment Infrastructure"
        AKS["AKS Helm Charts"]:::deployment
        EKS["EKS Helm Charts"]:::deployment
        GKE["GKE Helm Charts"]:::deployment
        K8s["K8s Helm Charts"]:::deployment
        OpenShift["OpenShift Deployments"]:::deployment
        Swarm["Swarm Configurations"]:::deployment
    end

    %% Monitoring & Logging Layer
    subgraph "Monitoring & Logging"
        Instana["Instana Monitoring"]:::monitoring
        Prometheus["Prometheus Metrics"]:::monitoring
        Fluentd["Fluentd Log Forwarder"]:::monitoring
    end

    %% Relationships

    %% Frontend interactions
    External -->|"request"| Web
    LoadGen -->|"simulate_load"| Web

    %% Web service calls backend microservices
    Web -->|"calls"| Cart
    Web -->|"calls"| Catalogue
    Web -->|"calls"| Dispatch
    Web -->|"calls"| Payment
    Web -->|"calls"| Ratings
    Web -->|"calls"| Shipping
    Web -->|"calls"| User

    %% Inter-service communications
    Cart -->|"get_product_info"| Catalogue
    Cart -->|"submit_order"| Payment
    Dispatch -->|"trigger_delivery"| Shipping
    Payment -->|"publish_event"| RabbitMQ

    %% Microservices data transactions
    Cart -->|"uses_nonrelational"| MongoDB
    Catalogue -->|"uses_nonrelational"| MongoDB
    User -->|"uses_nonrelational"| MongoDB
    Shipping -->|"uses_relational"| MySQL
    Payment -->|"uses_relational"| MySQL
    Ratings -->|"uses_relational"| MySQL

    %% Prometheus metrics exposed by select services
    Cart -->|"metrics"| Prometheus
    Payment -->|"metrics"| Prometheus

    %% Deployment Infrastructure associations
    AKS ---|"deploys"| Cart
    AKS ---|"deploys"| Catalogue
    AKS ---|"deploys"| Dispatch
    AKS ---|"deploys"| Payment
    AKS ---|"deploys"| Ratings
    AKS ---|"deploys"| Shipping
    AKS ---|"deploys"| User

    EKS ---|"deploys"| Cart
    EKS ---|"deploys"| Catalogue
    EKS ---|"deploys"| Dispatch
    EKS ---|"deploys"| Payment
    EKS ---|"deploys"| Ratings
    EKS ---|"deploys"| Shipping
    EKS ---|"deploys"| User

    GKE ---|"deploys"| Cart
    GKE ---|"deploys"| Catalogue
    GKE ---|"deploys"| Dispatch
    GKE ---|"deploys"| Payment
    GKE ---|"deploys"| Ratings
    GKE ---|"deploys"| Shipping
    GKE ---|"deploys"| User

    K8s ---|"deploys"| Cart
    K8s ---|"deploys"| Catalogue
    K8s ---|"deploys"| Dispatch
    K8s ---|"deploys"| Payment
    K8s ---|"deploys"| Ratings
    K8s ---|"deploys"| Shipping
    K8s ---|"deploys"| User

    OpenShift ---|"deploys"| Cart
    OpenShift ---|"deploys"| Catalogue
    OpenShift ---|"deploys"| Dispatch
    OpenShift ---|"deploys"| Payment
    OpenShift ---|"deploys"| Ratings
    OpenShift ---|"deploys"| Shipping
    OpenShift ---|"deploys"| User

    Swarm ---|"deploys"| Cart
    Swarm ---|"deploys"| Catalogue
    Swarm ---|"deploys"| Dispatch
    Swarm ---|"deploys"| Payment
    Swarm ---|"deploys"| Ratings
    Swarm ---|"deploys"| Shipping
    Swarm ---|"deploys"| User

    %% Monitoring & Logging associations
    Instana ---|"traces"| Cart
    Instana ---|"traces"| Catalogue
    Instana ---|"traces"| Dispatch
    Instana ---|"traces"| Payment
    Instana ---|"traces"| Ratings
    Instana ---|"traces"| Shipping
    Instana ---|"traces"| User

    Fluentd ---|"aggregates_logs"| Cart
    Fluentd ---|"aggregates_logs"| Catalogue
    Fluentd ---|"aggregates_logs"| Dispatch
    Fluentd ---|"aggregates_logs"| Payment
    Fluentd ---|"aggregates_logs"| Ratings
    Fluentd ---|"aggregates_logs"| Shipping
    Fluentd ---|"aggregates_logs"| User

    %% Class Definitions
    classDef external fill:#ffde59,stroke:#333,stroke-width:2px;
    classDef frontend fill:#f9a602,stroke:#333,stroke-width:2px;
    classDef microservice fill:#a1c4fd,stroke:#333,stroke-width:2px;
    classDef database fill:#c4f7c5,stroke:#333,stroke-width:2px;
    classDef deployment fill:#f7c4d5,stroke:#333,stroke-width:2px;
    classDef monitoring fill:#c2e7f9,stroke:#333,stroke-width:2px;

    %% Click events for component mappings
    click Web "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/web/"
    click Cart "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/cart/"
    click Catalogue "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/catalogue/"
    click Dispatch "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/dispatch/"
    click Payment "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/payment/"
    click Ratings "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/ratings/"
    click Shipping "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/shipping/"
    click User "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/user/"
    click LoadGen "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/load-gen/"
    click MongoDB "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/mongo/"
    click MySQL "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/mysql/"
    click AKS "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/AKS/helm/"
    click EKS "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/EKS/helm/"
    click GKE "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/GKE/helm/"
    click K8s "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/K8s/helm/"
    click OpenShift "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/OpenShift/"
    click Swarm "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/Swarm/"
    click Fluentd "https://github.com/iam-veeramalla/three-tier-architecture-demo/tree/master/fluentd/"
```
