# instana/robot-shop architecture

> Architecture diagram of the GitHub repository instana/robot-shop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/instana/robot-shop
- Repository: https://github.com/instana/robot-shop

## Overview

##### Project type and purpose
- This is a full-stack, sample microservice application (“Stan’s Robot Shop”) intended as a sandbox for learning containerized orchestration (Docker Compose, Swarm, DCOS, Kubernetes/Helm, OpenShift) plus distributed tracing and monitoring (Instana).
- It consists of multiple language-specific microservices (NodeJS, Java/Spring Boot, Python/Flask, Go, PHP), a static/AngularJS web UI served by Nginx, message-driven integration via RabbitMQ, and persistence layers (MongoDB, MySQL, Redis).

##### File structure
- Top-level microservice directories: cart (Node), catalogue (Node), dispatch (Go), payment (Python), ratings (PHP/Apache), shipping (Java/Spring Boot), user (Node), web (Nginx + static front end).
- Persistence directories: mongo, mysql; each provides Dockerfiles and init scripts.
- Cross-cutting concerns: fluentd (logging aggregator), load-gen (Python/Locust load tester).
- Orchestration/deployment manifests under: docker-compose.yaml(s), Swarm/, DCOS/, K8s/ (with Istio gateway + Helm chart), OpenShift/.
- Env/config files: .env, Helm values.yaml, Kubernetes YAMLs, DCOS manifests, service startup scripts.

##### README for additional insights
- Stack: NodeJS/Express, Spring Boot, Flask, Golang, PHP + MySQL, MongoDB, Redis, RabbitMQ, Nginx, AngularJS.
- Monitoring/tracing via Instana agents built into each service.
- Prometheus metrics exposed on cart and payment services.
- Load-generation (Locust) separate, optional.
- Multiple deployment targets: local Docker Compose, Swarm, DCOS, Kubernetes (Helm/OpenShift).

##### Elements
- Clear, human-readable labels for each service component and database
- Cross-cutting (monitoring/logging agents in a different style)
- Deployment context overlays: containers/pods, sidecar proxies (Istio), namespaces

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% UI Layer
    subgraph "UI Layer"
        Browser["End-User (Browser)"]:::ui
        Web["Web UI / API Gateway\n(Nginx + AngularJS)"]:::ui
    end

    %% Service Layer
    subgraph "Service Layer"
        Cart["Cart Service"]:::service
        Catalogue["Catalogue Service"]:::service
        User["User Service"]:::service
        Dispatch["Dispatch Service"]:::service
        Shipping["Shipping Service"]:::service
        Payment["Payment Service"]:::service
        Ratings["Ratings Service"]:::service
    end

    %% Messaging
    subgraph "Messaging"
        RabbitMQ["RabbitMQ Broker"]:::message
    end

    %% Data Layer
    subgraph "Data Layer"
        Redis["Redis Cache"]:::cache
        Mongo["MongoDB"]:::db
        MySQL["MySQL"]:::db
    end

    %% Cross-Cutting
    subgraph "Cross-Cutting"
        Fluentd["Fluentd Logging Aggregator"]:::infra
        Instana["Instana Agent"]:::infra
        Prometheus["Prometheus Metrics"]:::infra
    end

    %% Load Generator
    subgraph "Load Generation"
        LoadGen["Load Generator\n(Locust)"]:::load
    end

    %% Orchestration Context
    subgraph "Orchestration & Deployment"
        K8sIstio["Kubernetes + Istio\n(Helm)"]:::infra
    end

    %% Flows
    Browser -->|"HTTP"| Web
    LoadGen -->|"HTTP"| Web
    Web -->|"REST API"| Cart
    Web -->|"REST API"| Catalogue
    Web -->|"REST API"| User
    Web -->|"REST API"| Shipping
    Web -->|"REST API"| Payment
    Web -->|"REST API"| Ratings

    Cart -->|"cache"| Redis
    Catalogue -->|"persist"| Mongo
    User -->|"persist"| Mongo
    Payment -->|"persist"| MySQL
    Ratings -->|"persist"| MySQL

    Cart -->|"publish events"| RabbitMQ
    Payment -->|"publish events"| RabbitMQ
    RabbitMQ -->|"consume events"| Dispatch
    Dispatch -->|"notify"| Shipping

    Cart -->|"logs"| Fluentd
    Catalogue -->|"logs"| Fluentd
    User -->|"logs"| Fluentd
    Dispatch -->|"logs"| Fluentd
    Shipping -->|"logs"| Fluentd
    Payment -->|"logs"| Fluentd
    Ratings -->|"logs"| Fluentd
    Web -->|"logs"| Fluentd

    Cart -->|"metrics(/metrics)"| Prometheus
    Payment -->|"metrics(/metrics)"| Prometheus

    Instana -->|sidecar/tracing| Cart
    Instana -->|sidecar/tracing| Catalogue
    Instana -->|sidecar/tracing| User
    Instana -->|sidecar/tracing| Dispatch
    Instana -->|sidecar/tracing| Shipping
    Instana -->|sidecar/tracing| Payment
    Instana -->|sidecar/tracing| Ratings
    Instana -->|sidecar/tracing| Web

    %% Orchestration
    K8sIstio -->|deploys| Browser
    K8sIstio -->|deploys| Web
    K8sIstio -->|deploys| Cart
    K8sIstio -->|deploys| Catalogue
    K8sIstio -->|deploys| User
    K8sIstio -->|deploys| Dispatch
    K8sIstio -->|deploys| Shipping
    K8sIstio -->|deploys| Payment
    K8sIstio -->|deploys| Ratings
    K8sIstio -->|deploys| RabbitMQ
    K8sIstio -->|deploys| Redis
    K8sIstio -->|deploys| Mongo
    K8sIstio -->|deploys| MySQL
    K8sIstio -->|deploys| Fluentd
    K8sIstio -->|deploys| Prometheus
    K8sIstio -->|deploys| LoadGen

    %% Click Events
    click Cart "https://github.com/instana/robot-shop/tree/master/cart/Dockerfile"
    click Catalogue "https://github.com/instana/robot-shop/tree/master/catalogue/Dockerfile"
    click Dispatch "https://github.com/instana/robot-shop/blob/master/dispatch/main.go"
    click Payment "https://github.com/instana/robot-shop/blob/master/payment/payment.py"
    click Ratings "https://github.com/instana/robot-shop/blob/master/ratings/html/index.php"
    click Shipping "https://github.com/instana/robot-shop/tree/master/shipping/src/main/java/com/instana/robotshop/shipping/*"
    click User "https://github.com/instana/robot-shop/blob/master/user/server.js"
    click Web "https://github.com/instana/robot-shop/tree/master/web/Dockerfile"
    click Redis "https://github.com/instana/robot-shop/blob/master/K8s/helm/templates/redis-statefulset.yaml"
    click Mongo "https://github.com/instana/robot-shop/tree/master/mongo/Dockerfile"
    click MySQL "https://github.com/instana/robot-shop/tree/master/mysql/Dockerfile"
    click RabbitMQ "https://github.com/instana/robot-shop/blob/master/K8s/helm/templates/rabbitmq-deployment.yaml"
    click Fluentd "https://github.com/instana/robot-shop/tree/master/fluentd/Dockerfile"
    click LoadGen "https://github.com/instana/robot-shop/blob/master/load-gen/robot-shop.py"

    %% Styles
    classDef ui fill:#f9f,stroke:#333,stroke-width:1px
    classDef service fill:#bbf,stroke:#333,stroke-width:1px
    classDef db fill:#bfb,stroke:#333,stroke-width:1px
    classDef cache fill:#bff,stroke:#333,stroke-width:1px
    classDef message fill:#ffb,stroke:#333,stroke-width:1px
    classDef infra fill:#ddd,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef load fill:#fbb,stroke:#333,stroke-width:1px
```
