# himanshusinghtomar/ecom_micro_service architecture

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

- Interactive diagram: https://gitdiagram.com/himanshusinghtomar/ecom_micro_service
- Repository: https://github.com/himanshusinghtomar/ecom_micro_service

## Overview

##### Project type and purpose
- This is an e-commerce microservices application built in Java 17 using Spring Boot.
- It demonstrates independent, scalable services (product-, order-, user-services) that register with a Eureka Service Registry for discovery.

##### File structure
- Top-level directories:
- eureka-server – the Spring Boot Eureka registry
- product-service, order-service, user-service – three independent Spring Boot microservices
- Each service uses Maven (pom.xml, mvnw, .mvn) and follows the standard Spring Boot layout (src/main/java, src/main/resources).
- Controllers packages under each service indicate REST endpoints.
- application.properties in each service configures ports and Eureka settings.

##### README for additional insights
- Eureka Server runs on port 8761 and provides the dashboard/UI.
- Product Service (port 8081), Order Service (8082), User Service (8083).
- Order Service uses RestTemplate or OpenFeign to call Product Service.
- Future enhancements mention a config server, API Gateway, resilience patterns, databases, and security—but these are not yet implemented.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Client["Client (Postman/UI)"]:::client

    subgraph "Service Discovery"
        Eureka["Eureka Service Registry (8761)"]:::registry
    end

    subgraph "e-commerce application" 
        subgraph "Product Service"
            ProductApp["Product Service<br>(8081)"]:::service
            ProdController["ProductController"]:::service
            ProdConfig["application.properties"]:::config
        end
        subgraph "Order Service"
            OrderApp["Order Service<br>(8082)"]:::service
            OrderController["OrderController"]:::service
            OrderConfig["application.properties"]:::config
        end
        subgraph "User Service"
            UserApp["User Service<br>(8083)"]:::service
            UserController["UserController"]:::service
            UserConfig["application.properties"]:::config
        end
    end

    subgraph "Future Components"
        APIGW["API Gateway (planned)"]:::future
        ConfigServer["Config Server (planned)"]:::registry
        CircuitBreaker["Circuit Breaker (planned)"]:::future
        Databases["Databases (planned)"]:::database
    end

    Client -->|"Service Discovery"| Eureka
    Client -->|"REST Call"| ProductApp
    Client -->|"REST Call"| OrderApp
    Client -->|"REST Call"| UserApp

    ProductApp -->|"Register"| Eureka
    OrderApp -->|"Register"| Eureka
    UserApp -->|"Register"| Eureka

    OrderApp -->|"Feign/RestTemplate: GET /products/{name}/available"| ProductApp

    classDef client fill:#ffb74d,stroke:#000,stroke-width:1px;
    classDef registry fill:#42a5f5,stroke:#000,stroke-width:1px;
    classDef service fill:#66bb6a,stroke:#000,stroke-width:1px;
    classDef future fill:#ffb74d,stroke:#000,stroke-width:1px,stroke-dasharray: 5 5;
    classDef database fill:#b0bec5,stroke:#000,stroke-width:1px;
    classDef config fill:#eeeeee,stroke:#000,stroke-width:1px;

    click Eureka "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/eureka-server/src/main/java/com/ecommerce/eurekaserver/EurekaServerApplication.java"
    click Eureka "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/eureka-server/src/main/resources/application.properties"
    click ProductApp "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/product-service/src/main/java/com/ecommerce/productservice/ProductServiceApplication.java"
    click ProdController "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/product-service/src/main/java/com/ecommerce/productservice/controllers/productControllers.java"
    click ProdConfig "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/product-service/src/main/resources/application.properties"
    click OrderApp "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/order-service/src/main/java/com/ecommerce/orderservice/OrderServiceApplication.java"
    click OrderController "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/order-service/src/main/java/com/ecommerce/orderservice/controllers/OrderController.java"
    click OrderConfig "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/order-service/src/main/resources/application.properties"
    click UserApp "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/user-service/src/main/java/com/ecommerce/userservice/UserServiceApplication.java"
    click UserController "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/user-service/src/main/java/com/ecommerce/userservice/controllers/UserController.java"
    click UserConfig "https://github.com/himanshusinghtomar/ecom_micro_service/blob/main/user-service/src/main/resources/application.properties"
```
