# npatil9287/java-microservices-examples architecture

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

- Interactive diagram: https://gitdiagram.com/npatil9287/java-microservices-examples
- Repository: https://github.com/npatil9287/java-microservices-examples

## Overview

##### Project Types and Their Purposes
- There are three main examples:
- A basic Spring Boot + Spring Cloud example that uses OAuth2 with Okta, Eureka (service discovery), and Zuul.
- A JHipster-based example where services (blog, gateway, store) are centrally configured via Spring Cloud Config (with Dockerized deployment files and liquibase migrations).
- A reactive Spring Cloud Gateway example that leverages Spring WebFlux to create a reactive API gateway and secured car-service.
- All examples integrate with Okta for OAuth2 authentication and use external services that include Eureka for service discovery, Spring Cloud Config (in the JHipster example), and in one case a reactive stack via Spring Cloud Gateway.

##### File Structure for Architectural Clues
- Top-level directories such as “jhipster”, “spring-boot+cloud”, and “spring-cloud-gateway” each contain a complete microservices solution.
- The “spring-boot+cloud” folder includes projects like “api-gateway”, “car-service”, and “discovery-service”. Notice the configuration using Maven, Docker files, and application properties with Okta settings.
- The “spring-cloud-gateway” folder is similar in concept to the Spring Boot+Cloud sample but uses a reactive stack.
- Docker Compose files, configuration YAMLs, and resource files (like liquibase changelogs, TLS keystores, and application.yml) indicate the deployment and runtime environments (e.g., central config, Dockerized registries, and monitoring setups).
- The directions in the README show how each “example” should be run and how services interconnect (for example, the registration of microservices with Eureka and routing by the gateway).

- For the Spring Boot + Spring Cloud example:
- An API Gateway, Car Service, and Discovery Service (Eureka). Show an external Okta Authorization Server.
- Communication flows: the API Gateway routes requests to the Car Service; both are secured (show Okta interactions).
- For the JHipster + Spring Cloud Config Example:
- Components such as the Blog, Gateway, and Store services.
- A central configuration server (JHipster Registry) and the service discovery component (Eureka).
- To note Dockerized deployments and configuration propagation from Spring Cloud Config.
- For the Spring Cloud Gateway Example:
- A reactive API Gateway alongside the reactive Car Service.
- Okta integration component and how the service registry is used.

b. Interactions and Data Flow:
- Service discovery flows (e.g., registration to Eureka) and the configuration flow from the Cloud Config Server.

c. Architectural Patterns and Layers:
- Separation of concerns: API Gateway (front door), Service Registry, and individual microservices.
- For the JHipster services, indicate that the UI-side (Angular application inside the gateway) is tightly integrated as the front end.

d. Technologies and Frameworks:
- Communication protocols (REST, OAuth2 secured endpoints) and consider adding notes for soft dependencies—like Maven builds, Docker deployments, Liquibase migrations, and monitoring setups (Grafana, Prometheus).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Global External Nodes
    Client["Client"]:::external
    Okta["Okta Authorization Server"]:::external

    %% Spring Boot + Spring Cloud Example
    subgraph "Spring Boot + Spring Cloud Example"
        A["Spring Boot API Gateway"]:::gateway
        B["Spring Boot Car Service"]:::microservice
        C["Discovery Service (Eureka)"]:::registry
    end

    %% JHipster Example
    subgraph "JHipster Example"
        D["JHipster Gateway"]:::gateway
        E["JHipster Blog Service"]:::microservice
        F["JHipster Store Service"]:::microservice
        G["JHipster Registry (Eureka/Config)"]:::registry
    end

    %% Reactive Spring Cloud Gateway Example
    subgraph "Reactive Spring Cloud Gateway Example"
        H["Reactive API Gateway"]:::gateway
        I["Reactive Car Service"]:::microservice
        J["Reactive Discovery Service (Eureka)"]:::registry
    end

    %% Client to Gateways
    Client -->|"calls"| A
    Client -->|"calls"| D
    Client -->|"calls"| H

    %% Spring Boot + Cloud Interactions
    A -->|"routes"| B
    A -->|"registers"| C
    B -->|"registers"| C
    A -->|"authenticates"| Okta

    %% JHipster Interactions
    D -->|"routes"| E
    D -->|"routes"| F
    D -->|"registers"| G
    E -->|"registers"| G
    F -->|"registers"| G
    D -->|"authenticates"| Okta

    %% Reactive Interactions
    H -->|"routes"| I
    H -->|"authenticates"| Okta
    I -->|"registers"| J

    %% Click Events
    click A "https://github.com/npatil9287/java-microservices-examples/tree/master/spring-boot+cloud/api-gateway"
    click B "https://github.com/npatil9287/java-microservices-examples/tree/master/spring-boot+cloud/car-service"
    click C "https://github.com/npatil9287/java-microservices-examples/tree/master/spring-boot+cloud/discovery-service"
    click D "https://github.com/npatil9287/java-microservices-examples/tree/master/jhipster/gateway"
    click E "https://github.com/npatil9287/java-microservices-examples/tree/master/jhipster/blog"
    click F "https://github.com/npatil9287/java-microservices-examples/tree/master/jhipster/store"
    click H "https://github.com/npatil9287/java-microservices-examples/tree/master/spring-cloud-gateway/api-gateway"
    click I "https://github.com/npatil9287/java-microservices-examples/tree/master/spring-cloud-gateway/car-service"
    click J "https://github.com/npatil9287/java-microservices-examples/tree/master/spring-cloud-gateway/discovery-service"

    %% Styles
    classDef gateway fill:#F9E79F,stroke:#D4AC0D,stroke-width:2px;
    classDef microservice fill:#D6EAF8,stroke:#3498DB,stroke-width:2px;
    classDef registry fill:#ABEBC6,stroke:#28B463,stroke-width:2px;
    classDef external fill:#FAD7A0,stroke:#E67E22,stroke-width:2px;
```
