# pramithamj/fully-completed-microservices-java-springboot architecture

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

- Interactive diagram: https://gitdiagram.com/pramithamj/fully-completed-microservices-java-springboot
- Repository: https://github.com/pramithamj/fully-completed-microservices-java-springboot

## Overview

##### Project type and purpose
- This is a Java-based, Spring Cloud microservices ecosystem (Spring Boot 3.2.5, Java 17) demonstrating common distributed-system patterns: centralized config, service discovery, API gateway, async messaging, resilience, and tracing.
- The README confirms eight distinct services—Config Server, Eureka Discovery, API Gateway, and six domain services (Customer, Product, Order, Payment, Notification)—plus Kafka for messaging and Zipkin for tracing.

##### File structure
- Top-level directories:
- services/… (each microservice is self-contained with its own pom.xml, src/, resources, tests, Dockerfile support)
- docker-compose.yml (to orchestrate services in containers)
- resources/… (business needs, curriculum, distributed patterns—reference docs)
- Each service:
- config-server: holds central application.yml fragments for all services
- discovery: Eureka registry
- gateway: Spring Cloud Gateway (routing, circuit breaker)
- customer, product, order, payment, notification: domain microservices, some using Kafka producers/consumers, some REST clients to others.
- Product service also shows Flyway migrations under src/main/resources/db/migration.
- Configuration files (application.yml) use placeholders to pull from Config Server.
- kafka-related configs appear in order, payment, and notification services.

##### Additional insights from README
- Spring Cloud Config Server backs all service configs.
- Eureka handles service registration and discovery.
- Gateway enforces cross-cutting concerns (resilience, tracing).
- Kafka for events (order placed, payment processed → notification).
- Zipkin traces distributed calls.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client
    Client["Client"]:::external

    %% Infrastructure Subgraph
    subgraph "Infrastructure"
        style Infrastructure fill:#E3F2FD,stroke:#90CAF9
        ConfigServer["Config Server (port 8888)"]:::infra
        Eureka["Eureka Discovery (port 8761)"]:::infra
        Gateway["API Gateway (port 8080)"]:::infra
        Kafka[(Kafka Broker)]:::broker
        Zipkin[(Zipkin Tracing)]:::trace
        SMTP["SMTP Server"]:::external
    end

    %% Domain Services Subgraph
    subgraph "Domain Services"
        style Domain Services fill:#E8F5E9,stroke:#66BB6A
        Customer["Customer Service"]:::domain
        Product["Product Service"]:::domain
        Order["Order Service"]:::domain
        Payment["Payment Service"]:::domain
        Notification["Notification Service"]:::domain
    end

    %% Databases Subgraph
    subgraph "Databases"
        style Databases fill:#E0F2F1,stroke:#4DB6AC
        DB_Customer[(Customer DB)]:::db
        DB_Product[(Product DB)]:::db
        DB_Order[(Order DB)]:::db
        DB_Payment[(Payment DB)]:::db
        DB_Notification[(Notification DB)]:::db
    end

    %% Client to Gateway
    Client -->|"HTTP /api/... "| Gateway

    %% Synchronous calls via Gateway
    Gateway -->|"Route to Customer"| Customer
    Gateway -->|"Route to Product"| Product
    Gateway -->|"Route to Order"| Order
    Gateway -->|"Route to Payment"| Payment
    Gateway -->|"Route to Notification"| Notification

    %% Config retrieval (dotted)
    Customer -.->|"GET config"| ConfigServer
    Product  -.->|"GET config"| ConfigServer
    Order    -.->|"GET config"| ConfigServer
    Payment  -.->|"GET config"| ConfigServer
    Notification -.->|"GET config"| ConfigServer
    Eureka   -.->|"GET config"| ConfigServer
    Gateway  -.->|"GET config"| ConfigServer
    Zipkin   -.->|"GET config"| ConfigServer
    Kafka    -.->|"GET config"| ConfigServer

    %% Service registration
    Customer -->|"register() "| Eureka
    Product  -->|"register() "| Eureka
    Order    -->|"register() "| Eureka
    Payment  -->|"register() "| Eureka
    Notification -->|"register() "| Eureka
    Gateway  -->|"register() "| Eureka

    %% Service-to-service sync calls
    Order -->|"GET /customers/{id}"| Customer
    Order -->|"GET /products/{id}"| Product
    Order -->|"POST /payments"| Payment

    %% Databases
    Customer --> DB_Customer
    Product  --> DB_Product
    Order    --> DB_Order
    Payment  --> DB_Payment
    Notification --> DB_Notification

    %% Asynchronous messaging
    Order -->|"- - publish OrderCreated"| Kafka
    Payment -->|"- - publish PaymentProcessed"| Kafka
    Kafka -->|"- - consume OrderCreated"| Notification
    Kafka -->|"- - consume PaymentProcessed"| Notification

    %% Notification to SMTP
    Notification -->|"send email"| SMTP

    %% Tracing
    Customer -->|"trace spans"| Zipkin
    Product  -->|"trace spans"| Zipkin
    Order    -->|"trace spans"| Zipkin
    Payment  -->|"trace spans"| Zipkin
    Notification -->|"trace spans"| Zipkin
    Gateway  -->|"trace spans"| Zipkin

    %% Click Events
    click ConfigServer "https://github.com/pramithamj/fully-completed-microservices-java-springboot/tree/main/services/config-server"
    click Eureka "https://github.com/pramithamj/fully-completed-microservices-java-springboot/tree/main/services/discovery"
    click Gateway "https://github.com/pramithamj/fully-completed-microservices-java-springboot/tree/main/services/gateway"
    click Customer "https://github.com/pramithamj/fully-completed-microservices-java-springboot/tree/main/services/customer"
    click Product "https://github.com/pramithamj/fully-completed-microservices-java-springboot/tree/main/services/product"
    click Order "https://github.com/pramithamj/fully-completed-microservices-java-springboot/tree/main/services/order"
    click Payment "https://github.com/pramithamj/fully-completed-microservices-java-springboot/tree/main/services/payment"
    click Notification "https://github.com/pramithamj/fully-completed-microservices-java-springboot/tree/main/services/notification"
    click Kafka "https://github.com/pramithamj/fully-completed-microservices-java-springboot/blob/main/docker-compose.yml"
    click Zipkin "https://github.com/pramithamj/fully-completed-microservices-java-springboot/blob/main/docker-compose.yml"
    click Template "https://github.com/pramithamj/fully-completed-microservices-java-springboot/blob/main/diagrams/micro-services.drawio"

    %% Styles
    classDef infra fill:#BBDEFB,stroke:#1E88E5
    classDef domain fill:#C8E6C9,stroke:#43A047
    classDef broker fill:#FFCC80,stroke:#FB8C00
    classDef db fill:#B2DFDB,stroke:#00796B
    classDef trace fill:#E1BEE7,stroke:#8E24AA
    classDef external fill:#FFE082,stroke:#F9A825
```
