# saiupadhyayula/spring-boot-3-microservices-course architecture

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

- Interactive diagram: https://gitdiagram.com/saiupadhyayula/spring-boot-3-microservices-course
- Repository: https://github.com/saiupadhyayula/spring-boot-3-microservices-course

## Overview

##### Project type and purpose
- This is a full-stack, cloud-native microservices e-commerce tutorial. It showcases a multi-service backend (Product, Order, Inventory, Notification), an API gateway (Spring Cloud Gateway), an Angular frontend, event streaming (Kafka), security (Keycloak), persistence (MySQL + MongoDB), and observability (Prometheus/Grafana/Loki/Tempo), all deployed on Kubernetes.

##### File structure
- Top-level services:
- api-gateway (Spring Boot, routes all client traffic, enforces security)
- product-service, order-service, inventory-service, notification-service (each a Spring Boot microservice)
- frontend (Angular 18 SPA)
- Infra definitions:
- docker/ (Compose files for local dev: MySQL, Keycloak, Grafana, Prometheus, Tempo)
- k8s/manifests/(infra + applications) for deploying to a kind Kubernetes cluster
- Common patterns:
- Each service has its own config, model, controller, service, repository layers (typical layered-architecture).
- Order service calls Inventory via a Spring REST client and emits an `OrderPlacedEvent` to Kafka. Notification service consumes that event.
- Flyway migrations in services that use SQL.
- ObservabilityConfig/OpenAPIConfig in services for metrics, tracing, and autogenerated API docs.

##### README for additional insights
- Confirms tech stack: Spring Boot, Angular, MySQL, MongoDB, Kafka, Keycloak, Testcontainers, Prometheus stack, Kubernetes.
- Shows how to build images, create a kind cluster, and deploy infra + apps.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Layer
    Browser["User Browser"]:::frontend
    Browser -->|"HTTPS/JWT"| Gateway["API Gateway"]:::gateway
    click Gateway "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/tree/master/api-gateway/"

    subgraph "Kubernetes Cluster"
        direction TB

        %% API Gateway to Services
        Gateway -->|"HTTP/REST"| Product["Product Service"]:::service
        click Product "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/tree/master/product-service/"
        Gateway -->|"HTTP/REST"| Order["Order Service"]:::service
        click Order "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/tree/master/order-service/"
        Gateway -->|"HTTP/REST"| Inventory["Inventory Service"]:::service
        click Inventory "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/tree/master/inventory-service/"
        Gateway -->|"HTTP/REST"| Notification["Notification Service"]:::service
        click Notification "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/tree/master/notification-service/"

        %% Service to Databases
        Order -->|"JDBC/MySQL"| OrderDB["Order MySQL DB"]:::db
        Inventory -->|"JDBC/MySQL"| InventoryDB["Inventory MySQL DB"]:::db
        Product -->|"MongoDB"| ProductDB["Product MongoDB"]:::db

        %% Service interactions
        Order -->|"REST Client"| Inventory
        Order -->|"Kafka Publish"| Kafka["Kafka Cluster"]:::eventbus
        Notification -->|"Kafka Consume"| Kafka

        %% Observability
        subgraph Observability
            direction TB
            Prometheus["Prometheus"]:::monitor
            click Prometheus "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/blob/master/docker/prometheus/prometheus.yml"
            Grafana["Grafana"]:::monitor
            click Grafana "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/blob/master/docker/grafana/dashboard.json"
            Loki["Loki"]:::monitor
            Tempo["Tempo"]:::monitor
            click Tempo "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/blob/master/docker/tempo/tempo.yml"
        end

        %% Metrics flows
        Product --> Prometheus
        Order --> Prometheus
        Inventory --> Prometheus
        Notification --> Prometheus
        Gateway --> Prometheus

        %% Dashboard & logs/traces
        Grafana --> Prometheus
        Grafana --> Loki
        Grafana --> Tempo
    end

    subgraph "Infrastructure Definitions (Local Dev)"
        direction TB
        DockerCompose["docker-compose.yml + docker/"]:::infra
        click DockerCompose "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/blob/master/docker-compose.yml"
        K8sApps["Kubernetes App Manifests"]:::infra
        click K8sApps "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/tree/master/k8s/manifests/applications/"
        K8sInfra["Kubernetes Infra Manifests"]:::infra
        click K8sInfra "https://github.com/saiupadhyayula/spring-boot-3-microservices-course/tree/master/k8s/manifests/infra/"
    end

    %% Database cluster and event bus grouping
    Kafka -->|"Managed by infra manifests"| K8sInfra

    classDef frontend fill:#FFD88C,stroke:#333,stroke-width:1px
    classDef gateway fill:#9AD1D4,stroke:#333,stroke-width:1px
    classDef service fill:#B8E0D2,stroke:#333,stroke-width:1px
    classDef db fill:#F4C2C2,stroke:#333,stroke-width:1px,shape:cylinder
    classDef eventbus fill:#FFD1DC,stroke:#333,stroke-width:1px,shape:cylinder
    classDef monitor fill:#CBB4D4,stroke:#333,stroke-width:1px
    classDef infra fill:#E8E8E8,stroke:#333,stroke-width:1px
```
