# piomin/sample-spring-microservices architecture

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

- Interactive diagram: https://gitdiagram.com/piomin/sample-spring-microservices
- Repository: https://github.com/piomin/sample-spring-microservices

## Overview

##### Project type and purpose
- This is a Spring Cloud–based microservices demo. It uses Spring Boot 1.5 and Spring Cloud Netflix components to illustrate a service gateway (Zuul), service discovery (Eureka), inter-service communication (Feign/Ribbon), and distributed tracing (Sleuth/Zipkin).

##### File structure
- Top-level services (each a separate Maven module with its own Dockerfile and Jenkinsfile):
- discovery-service – Eureka server
- gateway-service – Zuul API gateway
- account-service – CRUD microservice for accounts
- customer-service – CRUD microservice for customers (calls account-service via Feign/Ribbon)
- zipkin-service – distributed tracing server
- A root pom.xml orchestrates all modules.
- docker-compose.yml brings up all services together.

##### README for additional insights
- Confirms the architecture: gateway → discovery → microservices → Zipkin

## Diagram (Mermaid)

```mermaid
flowchart TD
    classDef client fill:#f0f0f0,stroke:#333,stroke-width:1px
    classDef gateway fill:#ffa500,stroke:#333,stroke-width:1px
    classDef micro fill:#add8e6,stroke:#333,stroke-width:1px
    classDef infra fill:#90ee90,stroke:#333,stroke-width:1px
    classDef boundary stroke-dasharray:5 5,stroke:#999

    Client["Client\n(Postman/cURL)"]:::client

    subgraph "Docker-Compose Environment" 
        direction TB
        Gateway["Zuul API Gateway\n(gateway-service:8080)"]:::gateway
        Eureka["Eureka Service Registry\n(discovery-service:8761)"]:::infra
        Account["Account Service\n(account-service:8081)"]:::micro
        Customer["Customer Service\n(customer-service:8082)"]:::micro
        Zipkin["Zipkin Tracing Server\n(zipkin-service:9411)"]:::infra
    end

    Client -->|"HTTP/REST"| Gateway
    Gateway -->|"Service Lookup (Eureka)"| Eureka
    Gateway -->|"HTTP/REST (Ribbon/Feign)"| Account
    Gateway -->|"HTTP/REST (Ribbon/Feign)"| Customer
    Customer -->|"Feign Client (HTTP/REST)"| Account
    Gateway -->|"Tracing data (Sleuth)"| Zipkin
    Eureka -->|"Tracing data (Sleuth)"| Zipkin
    Account -->|"Tracing data (Sleuth)"| Zipkin
    Customer -->|"Tracing data (Sleuth)"| Zipkin

    click Eureka "https://github.com/piomin/sample-spring-microservices/blob/master/discovery-service/src/main/java/pl/piomin/microservices/eureka/DiscoveryServiceApplication.java"
    click Gateway "https://github.com/piomin/sample-spring-microservices/blob/master/gateway-service/src/main/java/pl/piomin/microservices/edge/GatewayServiceApplication.java"
    click Account "https://github.com/piomin/sample-spring-microservices/blob/master/account-service/src/main/java/pl/piomin/microservices/account/AccountServiceApplication.java"
    click Customer "https://github.com/piomin/sample-spring-microservices/blob/master/customer-service/src/main/java/pl/piomin/microservices/customer/CustomerServiceApplication.java"
    click Zipkin "https://github.com/piomin/sample-spring-microservices/blob/master/zipkin-service/src/main/java/pl/piomin/microservices/zipkin/ZipkinServiceApplication.java"
    click AccountClient "https://github.com/piomin/sample-spring-microservices/blob/master/customer-service/src/main/java/pl/piomin/microservices/customer/intercomm/AccountClient.java"
```
