# saiupadhyayula/springboot-microservices-project architecture

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

- Interactive diagram: https://gitdiagram.com/saiupadhyayula/springboot-microservices-project
- Repository: https://github.com/saiupadhyayula/springboot-microservices-project

## Overview

##### Main Components
- API Gateway Service – Acts as the entry point and request router. It includes its own configuration (e.g., SecurityConfig) and is responsible for handling client requests.
- Configuration Server – Provides central configuration management for all microservices.
- Discovery Server – Serves as the service registry where each microservice registers itself, enabling dynamic discovery and communication.
- Inventory Service – Manages inventory data. It includes controllers, repositories, and model definitions, and even has some predefined data (data.sql).
- Order Service – Handles order processing and interacts with other services. Notice it includes an InventoryClient, security configuration, controllers, models, and repository.
- Product Service – Manages product data and includes dedicated controllers, security configuration, models, and the repository.
- Notification Service – Responsible for notifications (for example, sending emails) when events such as orders are placed.

##### Out Their Interactions
- Clients (or external consumers) will start by sending requests to the API Gateway.
- API Gateway will route these requests to the appropriate microservices. For instance, product or order management requests go to the corresponding services.
- All microservices (Inventory, Order, Product, Notification) should be registered with the Discovery Server, so they become discoverable.
- They also use the Configuration Server to load centralized configuration properties.
- The Order Service might communicate directly with the Inventory Service (using InventoryClient) to check product availability and with the Notification Service to send order confirmations.
– API Gateway sends incoming requests to the microservices.
– Each microservice registers with and discovers peers via the Discovery Server.
– The Configuration Server supplies configuration to each service.
– There are explicit client calls between the Order Service and other domain services (such as Inventory and Notification).

##### Architectural Patterns and Technologies
- Microservices architecture using Spring Boot.
- Centralized configuration management via a dedicated Configuration Server.
- Service discovery through Discovery Server.
- API gateway pattern to manage routing, security, and entry point concerns.
- Service-to-service communication (potentially using REST/HTTP and/or client libraries such as Feign for invoking other microservices).
- Each service follows standard layered architecture (Controller, Service/Business Logic, Repository, Model).

##### Final Design Notes for the Principal Software Engineer
– Start by sketching a high-level overview with external clients communicating with the API Gateway.
– Then, detail the connectivity:
- API Gateway routes traffic.
- Configuration Server and Discovery Server serve all registered services.
– If desired, add additional layers (such as repository and controller layers) within each service for more granularity, but a focus on service-level interactions is usually sufficient at the system design level.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CLIENTS("Clients/External"):::external

    subgraph "Infrastructure"
        APIGW("API Gateway Service"):::infrastructure
        CONFIG("Configuration Server"):::infrastructure
        DISC("Discovery Server"):::infrastructure
    end

    subgraph "Microservices"
        INVENT("Inventory Service"):::microservice
        ORDER("Order Service"):::microservice
        PROD("Product Service"):::microservice
        NOTIF("Notification Service"):::microservice
    end

    CLIENTS -->|"sendsRequest"| APIGW
    APIGW -->|"routes"| INVENT
    APIGW -->|"routes"| ORDER
    APIGW -->|"routes"| PROD
    APIGW -->|"routes"| NOTIF

    ORDER -->|"checkInventory"| INVENT
    ORDER -->|"orderConfirmation"| NOTIF

    INVENT -->|"registersWith"| DISC
    ORDER -->|"registersWith"| DISC
    PROD -->|"registersWith"| DISC
    NOTIF -->|"registersWith"| DISC

    INVENT -->|"loadsConfig"| CONFIG
    ORDER -->|"loadsConfig"| CONFIG
    PROD -->|"loadsConfig"| CONFIG
    NOTIF -->|"loadsConfig"| CONFIG

    click APIGW "https://github.com/saiupadhyayula/springboot-microservices-project/blob/master/api-gateway-service/api-gateway-service/src/main/java/com/programming/techie/apigatewayservice/config/SecurityConfig.java"
    click CONFIG "https://github.com/saiupadhyayula/springboot-microservices-project/blob/master/configuration-server/configuration-server/src/main/java/com/programming/techie/configurationserver/ConfigurationServerApplication.java"
    click DISC "https://github.com/saiupadhyayula/springboot-microservices-project/blob/master/discovery-server/discovery-server/src/main/java/com/programming/techie/discoveryserver/DiscoveryServerApplication.java"
    click INVENT "https://github.com/saiupadhyayula/springboot-microservices-project/tree/master/inventory-service/inventory-service"
    click ORDER "https://github.com/saiupadhyayula/springboot-microservices-project/blob/master/order-service/order-service/OrderServiceApplication.java"
    click PROD "https://github.com/saiupadhyayula/springboot-microservices-project/tree/master/product-service/product-service"
    click NOTIF "https://github.com/saiupadhyayula/springboot-microservices-project/tree/master/notification-service/notification-service"

    classDef external fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#87CEFA,stroke:#333,stroke-width:2px;
    classDef microservice fill:#90EE90,stroke:#333,stroke-width:2px;
```
