# ali-bouali/microservices-full-code architecture

> Architecture diagram of the GitHub repository ali-bouali/microservices-full-code, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ali-bouali/microservices-full-code
- Repository: https://github.com/ali-bouali/microservices-full-code

## Overview

##### Project type and purpose
- This is a learning‐focused Spring Boot microservices project implementing a simple e-commerce domain (customer, product, order, payment, notification).
- It uses Spring Cloud patterns: a centralized Config Server, a Discovery Service (Eureka), an API Gateway, domain‐specific microservices, and Kafka for asynchronous events.

##### File structure
- Top‐level:
- docker-compose.yml – brings up all services and Kafka/Eureka/etc.
- services/ – contains one Maven‐based Spring Boot app per directory:
– config-server/
– discovery/
– gateway/
– customer/, product/, order/, payment/, notification/
- resources/ – contains business needs and design patterns notes.
- Each service follows a standard structure:
src/main/java – application starter, controllers, services, repositories, DTOs.
src/main/resources/application.yml – service‐specific settings.
product/ even has Flyway migrations under resources/db/migration.
- All services include tests and error‐handling packages.

##### README
- Minimal: “Spring boot microservice for learning.” Confirms: the goal is microservices architecture demonstration.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Orchestration"
        DOCKER["Docker Compose"]:::platform
    end

    subgraph "Platform Services"
        CS["Config Server"]:::platform
        ES["Service Registry (Eureka)"]:::platform
    end

    ExternalClient["UI/Clients"]:::external
    Gateway["API Gateway"]:::gateway

    subgraph "Domain Services"
        CUS["Customer Service"]:::service
        PRO["Product Service"]:::service
        ORS["Order Service"]:::service
        PAY["Payment Service"]:::service
        NOT["Notification Service"]:::service
    end

    subgraph "Datastores"
        PDB["Product DB"]:::db
    end

    subgraph "Messaging"
        KAFKA["Kafka Cluster"]:::messaging
    end

    DOCKER --> CS
    DOCKER --> ES
    DOCKER --> Gateway
    DOCKER --> CUS
    DOCKER --> PRO
    DOCKER --> ORS
    DOCKER --> PAY
    DOCKER --> NOT
    DOCKER --> KAFKA

    CS --> CUS
    CS --> PRO
    CS --> ORS
    CS --> PAY
    CS --> NOT
    CS --> Gateway

    ES --> CUS
    ES --> PRO
    ES --> ORS
    ES --> PAY
    ES --> NOT
    ES --> Gateway

    ExternalClient -->|REST| Gateway
    Gateway -->|service lookup| ES
    Gateway -->|routes| CUS
    Gateway -->|routes| PRO
    Gateway -->|routes| ORS
    Gateway -->|routes| PAY
    Gateway -->|routes| NOT

    ORS -->|REST| CUS
    ORS -->|REST| PRO

    ORS -->|publish OrderTopic| KAFKA
    PAY -->|publish PaymentTopic| KAFKA
    KAFKA -->|consume| NOT

    PRO --> PDB

    click CS "https://github.com/ali-bouali/microservices-full-code/blob/main/services/config-server/src/main/java/com/alibou/configserver/ConfigServerApplication.java"
    click ES "https://github.com/ali-bouali/microservices-full-code/blob/main/services/discovery/src/main/java/com/alibou/discovery/DiscoveryApplication.java"
    click Gateway "https://github.com/ali-bouali/microservices-full-code/blob/main/services/gateway/src/main/java/com/alibou/gateway/GatewayApplication.java"
    click CUS "https://github.com/ali-bouali/microservices-full-code/blob/main/services/customer/src/main/java/com/alibou/ecommerce/CustomerApplication.java"
    click PRO "https://github.com/ali-bouali/microservices-full-code/blob/main/services/product/src/main/java/com/alibou/ecommerce/ProductApplication.java"
    click ORS "https://github.com/ali-bouali/microservices-full-code/blob/main/services/order/src/main/java/com/alibou/ecommerce/OrderApplication.java"
    click PAY "https://github.com/ali-bouali/microservices-full-code/blob/main/services/payment/src/main/java/com/alibou/ecommerce/PaymentApplication.java"
    click NOT "https://github.com/ali-bouali/microservices-full-code/blob/main/services/notification/src/main/java/com/alibou/ecommerce/NotificationApplication.java"
    click ORS "https://github.com/ali-bouali/microservices-full-code/blob/main/services/order/src/main/java/com/alibou/ecommerce/config/KafkaOrderTopicConfig.java"
    click PAY "https://github.com/ali-bouali/microservices-full-code/blob/main/services/payment/src/main/java/com/alibou/ecommerce/configuration/KafkaPaymentTopicConfig.java"
    click PRO "https://github.com/ali-bouali/microservices-full-code/tree/main/services/product/src/main/resources/db/migration"
    click DOCKER "https://github.com/ali-bouali/microservices-full-code/blob/main/docker-compose.yml"

    classDef platform fill:#cccccc,stroke:#333,stroke-width:1px
    classDef gateway fill:#a0c4ff,stroke:#333,stroke-width:1px
    classDef service fill:#c2f0c2,stroke:#333,stroke-width:1px
    classDef messaging fill:#ffb347,stroke:#333,stroke-width:1px
    classDef db fill:#d3c1fc,stroke:#333,stroke-width:1px
    classDef external fill:#f0f0f0,stroke:#333,stroke-width:1px
```
