# avinash026/spring-webflux-reactive-databases architecture

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

- Interactive diagram: https://gitdiagram.com/avinash026/spring-webflux-reactive-databases
- Repository: https://github.com/avinash026/spring-webflux-reactive-databases

## Overview

##### Main Components
- product-api: A Spring Boot WebFlux application that manages products and uses MongoDB as its data store.
- customer-api: A Spring Boot WebFlux application that manages customers with Postgres as its storage.
- order-api: A Spring Boot WebFlux application that manages orders, stores data in Cassandra, and uses non-blocking WebClient (and CompletableFuture) to retrieve extra details (like customer details and product info) from customer-api and product-api.
- notification-api: A Spring Boot WebFlux application that manages notifications, which uses MySQL for persistence and also may depend on other APIs (e.g., customer-api and order-api) to obtain necessary information.
- client-shell: A Spring Boot Shell application that provides commands to interact with the various REST APIs offered by the above services.

##### Data Stores
- MongoDB for product-api
- Postgres for customer-api
- Cassandra for order-api
- MySQL for notification-api

##### Relationships and Interactions
- The client-shell acts as an entry point for users, sending commands that trigger REST API calls to product-, customer-, order-, and notification-api.
- Each API connects directly with its underlying database.

##### Architectural Patterns & Design Principles
- Reactive/non-blocking design pattern since Spring WebFlux is used across the board.

##### Final Reminders
- Use clear, self-explanatory labels for each module.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Shell Layer
    ES["client-shell (Spring Boot Shell)"]:::shell

    %% Microservices Layer
    PA["product-api (Spring Boot + WebFlux)"]:::api
    CA["customer-api (Spring Boot + WebFlux)"]:::api
    OA["order-api (Spring Boot + WebFlux)"]:::api
    NA["notification-api (Spring Boot + WebFlux)"]:::api

    %% Databases Layer
    MDB["MongoDB"]:::db
    PG["Postgres"]:::db
    CASS["Cassandra"]:::db
    MYSQL["MySQL"]:::db

    %% Inter-layer connections: Client Shell to Microservices
    ES -->|"REST_Call"| PA
    ES -->|"REST_Call"| CA
    ES -->|"REST_Call"| OA
    ES -->|"REST_Call"| NA

    %% Microservice to Database connections
    PA -->|"CRUD"| MDB
    CA -->|"CRUD"| PG
    OA -->|"CRUD"| CASS
    NA -->|"CRUD"| MYSQL

    %% Intra-service interactions (asynchronous and external calls)
    OA -->|"AsyncREST"| PA
    OA -->|"AsyncREST"| CA
    NA -->|"FetchInfo"| CA
    NA -->|"FetchInfo"| OA

    %% Click Events for Component Mapping
    click PA "https://github.com/avinash026/spring-webflux-reactive-databases/tree/master/product-api/src/main/java/com/ivanfranchin/productapi"
    click PA "https://github.com/avinash026/spring-webflux-reactive-databases/blob/master/product-api/src/main/resources/application.properties"
    click CA "https://github.com/avinash026/spring-webflux-reactive-databases/tree/master/customer-api/src/main/java/com/ivanfranchin/customerapi"
    click CA "https://github.com/avinash026/spring-webflux-reactive-databases/blob/master/customer-api/src/main/resources/application.properties"
    click OA "https://github.com/avinash026/spring-webflux-reactive-databases/tree/master/order-api/src/main/java/com/ivanfranchin/orderapi"
    click OA "https://github.com/avinash026/spring-webflux-reactive-databases/blob/master/order-api/src/main/resources/application.properties"
    click NA "https://github.com/avinash026/spring-webflux-reactive-databases/tree/master/notification-api/src/main/java/com/ivanfranchin/notificationapi"
    click NA "https://github.com/avinash026/spring-webflux-reactive-databases/blob/master/notification-api/src/main/resources/application.properties"
    click ES "https://github.com/avinash026/spring-webflux-reactive-databases/tree/master/client-shell/src/main/java/com/ivanfranchin/clientshell"
    click ES "https://github.com/avinash026/spring-webflux-reactive-databases/blob/master/client-shell/src/main/resources/application.properties"

    %% Classes for styling
    classDef api fill:#C8E6C9,stroke:#2E7D32,stroke-width:2px;
    classDef shell fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef db fill:#BBDEFB,stroke:#1565C0,stroke-width:2px;
```
