# descartesresearch/teastore architecture

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

- Interactive diagram: https://gitdiagram.com/descartesresearch/teastore
- Repository: https://github.com/descartesresearch/teastore

## Overview

##### Project type and purpose
- This is TeaStore, a distributed micro-service reference and test application that emulates an online tea store.
- It comprises six core microservices (auth, image, persistence, recommender, registry, webui) plus supporting tooling for deployment, load generation, instrumentation (Kieker), and end-to-end testing.

##### File structure
- Top-level folders:
- services/… – each subfolder is one Java microservice, built with Maven, packaged as Docker images, exposing REST endpoints via servlets.
- interfaces/… – shared entity definitions (Category, Product, User, Order, etc.) used by all services.
- utilities/… – helper Docker images (database container, base Java/Tomcat image, Kieker probes, RabbitMQ integration).
- examples/… – deployment manifests (Docker Compose, Kubernetes YAML, Helm charts) and load-generator scripts (JMeter, Locust, custom HTTP).
- e2e-tests/… – Cypress end-to-end tests against running TeaStore.
- tools/… – shell scripts for building/testing.

##### README for additional insights
- TeaStore uses REST for inter-service communication and Netflix Ribbon for client-side load balancing.
- Services register with a central registry and discover each other dynamically.
- Instrumented variants send monitoring data (via Kieker, RabbitMQ) for performance analysis.

##### Detail
- Six microservice components plus the registry.
- Shared “interfaces” module as a UML package or note that entity DTOs are common.
- External dependencies: Ribbon client-side load balancer, MySQL, RabbitMQ.
- Which services use which utilities (e.g., Kieker probe library in the instrumented containers).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Clients"
        Browser["Browser UI"]:::client
        LoadGen["Load Generators"]:::client
    end
    Browser -->|"HTTP"| WebUI
    LoadGen -->|"HTTP"| WebUI

    WebUI["WebUI Service"]:::service
    click WebUI "https://github.com/descartesresearch/teastore/blob/master/services/tools.descartes.teastore.webui"
    WebUI -->|"Service Discovery"| Registry

    subgraph "Microservices"
        Registry["Service Registry"]:::registry
        AuthService["Auth Service"]:::service
        ImageService["Image Service"]:::service
        PersistenceService["Persistence Service"]:::service
        RecommenderService["Recommender Service"]:::service
    end
    click Registry "https://github.com/descartesresearch/teastore/blob/master/services/tools.descartes.teastore.registry"
    WebUI --> Registry
    AuthService --> Registry
    ImageService --> Registry
    PersistenceService --> Registry
    RecommenderService --> Registry

    WebUI -->|"REST Calls"| AuthService
    WebUI -->|"REST Calls"| PersistenceService
    WebUI -->|"REST Calls"| ImageService
    WebUI -->|"REST Calls"| RecommenderService

    PersistenceService -->|"JPA/SQL"| DB["MySQL Database"]:::database
    click DB "https://github.com/descartesresearch/teastore/blob/master/utilities/tools.descartes.teastore.database"

    RecommenderService -->|"Query History"| PersistenceService
    ImageService -->|"Store/Retrieve"| DB

    subgraph "Shared Modules"
        Entities["Shared Entities"]:::shared
    end
    click Entities "https://github.com/descartesresearch/teastore/blob/master/interfaces/tools.descartes.teastore.entities"
    AuthService --> Entities
    ImageService --> Entities
    PersistenceService --> Entities
    RecommenderService --> Entities
    WebUI --> Entities
    Registry --> Entities

    subgraph "Monitoring Pipeline"
        KiekerProbes["Kieker Probes Library"]:::monitor
        RabbitMQ["RabbitMQ Broker"]:::broker
        KiekerRabbit["Kieker→RabbitMQ Transport"]:::monitor
    end
    click KiekerProbes "https://github.com/descartesresearch/teastore/blob/master/utilities/tools.descartes.teastore.kieker.probes"
    click KiekerRabbit "https://github.com/descartesresearch/teastore/blob/master/utilities/tools.descartes.teastore.kieker.rabbitmq"
    AuthService -->|"Instrumented"| KiekerProbes
    ImageService -->|"Instrumented"| KiekerProbes
    PersistenceService -->|"Instrumented"| KiekerProbes
    RecommenderService -->|"Instrumented"| KiekerProbes
    WebUI -->|"Instrumented"| KiekerProbes
    KiekerProbes --> KiekerRabbit --> RabbitMQ

    subgraph "Utilities"
        RegistryClient["Registry Client (Ribbon)"]:::util
    end
    click RegistryClient "https://github.com/descartesresearch/teastore/blob/master/utilities/tools.descartes.teastore.registryclient"
    AuthService --> RegistryClient
    WebUI --> RegistryClient
    ImageService --> RegistryClient
    PersistenceService --> RegistryClient
    RecommenderService --> RegistryClient

    subgraph "Deployment Examples"
        DockerCompose["Docker Compose"]:::example
        Kubernetes["Kubernetes Manifests"]:::example
        Helm["Helm Charts"]:::example
    end
    click DockerCompose "https://github.com/descartesresearch/teastore/tree/master/examples/docker"
    click Kubernetes "https://github.com/descartesresearch/teastore/tree/master/examples/kubernetes"
    click Helm "https://github.com/descartesresearch/teastore/tree/master/examples/helm"

    subgraph "Load Generator Scripts"
        HTTPLG["HTTP Load Generator"]:::example
        JMeterLG["JMeter Scripts"]:::example
        LocustLG["Locust Script"]:::example
    end
    click HTTPLG "https://github.com/descartesresearch/teastore/tree/master/examples/httploadgenerator"
    click JMeterLG "https://github.com/descartesresearch/teastore/tree/master/examples/jmeter"
    click LocustLG "https://github.com/descartesresearch/teastore/blob/master/examples/locust/locustfile.py"

    subgraph "Testing & Tools"
        E2ETests["Cypress E2E Tests"]:::example
        BuildScripts["Build & Test Scripts"]:::example
    end
    click E2ETests "https://github.com/descartesresearch/teastore/tree/master/e2e-tests"
    click BuildScripts "https://github.com/descartesresearch/teastore/blob/master/tools/build_docker.sh"

    classDef client fill:#B3E5FC,stroke:#0288D1
    classDef service fill:#C8E6C9,stroke:#388E3C
    classDef registry fill:#FFF9C4,stroke:#FBC02D
    classDef database fill:#FFCDD2,stroke:#D32F2F
    classDef shared fill:#E1BEE7,stroke:#7B1FA2
    classDef monitor fill:#D1C4E9,stroke:#5E35B1,stroke-dasharray:3 3
    classDef broker fill:#FFCCBC,stroke:#E64A19
    classDef util fill:#B2DFDB,stroke:#00796B
    classDef example fill:#CFD8DC,stroke:#455A64
```
