# rohitghatol/spring-boot-microservices architecture

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

- Interactive diagram: https://gitdiagram.com/rohitghatol/spring-boot-microservices
- Repository: https://github.com/rohitghatol/spring-boot-microservices

## Overview

- config-server – Provides centralized external configuration using Spring Cloud Config
- webservice-registry – Acts as an Eureka server for service discovery
- auth-server – Serves as an OAuth2 authorization server
- user-webservice – Manages user-related functionalities
- task-webservice – Handles task-related business logic
- comments-webservice – Provides support for comments on tasks
- api-gateway – Implements a Zuul-based API Gateway to route requests to back-end microservices
- web-portal – A single page application (with both a public folder and server-side code) acting as the front-end UI

##### Main Components
- Microservice as a separate component: config-server, webservice-registry, auth-server, user-webservice, task-webservice, comments-webservice, api-gateway, and web-portal.
- Additionally, note external components such as any databases (e.g., MySQL in the docker instructions), OAuth2 resource servers, and support for containerized deployment (via Docker) if needed.
- Orchestration or additional external services (for example, if there is a consumer driven contract mechanism or distributed tracing in place).

##### Relationships and Interactions
- That the config-server is the centralized configuration provider that all services fetch configuration from at startup.
- That the webservice-registry (Eureka) is the service discovery mechanism: all microservices (including auth-server, user, task, comments, and API gateway & web-portal) register themselves here.
- That the API gateway stands as the single entry point for external clients. It routes incoming HTTP requests to the appropriate microservice.
- Out that the auth-server provides authorization tokens and OAuth2-related security for client requests, and that this service interacts with client requests from both the API gateway and possibly directly with some microservices.
- Front-end web-portal as the client UI that uses the API gateway to interact with backend services.

##### Architectural Patterns and Important Technologies
- Microservices Pattern: Note that each service is independently built and deployed.
- Service Registration & Discovery: Using Eureka (webservice-registry).
- API Gateway Pattern: Implemented via Zuul (in the api-gateway project).
- Centralized Configuration: Provided by config-server.
- Security & OAuth2: Managed by auth-server, with Spring OAuth2 configurations visible in each relevant project.
- The use of Spring Boot and Gradle for each service means they all follow convention over configuration; this can be noted as providing consistency in service creation.
- Additionally, mention Netflix OSS integrations such as Hystrix (for circuit breakers) if they are used in a later iteration or if they are part of the suggestions in the README.

##### Final Remarks
- Balance the level of detail – focus on the interactions, dependencies, and data flow directions.
- Remember that the goal is to provide a high-fidelity architectural overview that a principal software engineer can use to understand, maintain, and further evolve the system.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Infrastructure: Configuration & Discovery
    subgraph "Configuration & Discovery"
        config["config-server (Config Server)"]:::infra
        registry["webservice-registry (Eureka)"]:::infra
    end

    %% Business Microservices
    subgraph "Business Microservices"
        auth["auth-server (OAuth2 Server)"]:::service
        user["user-webservice (User Service)"]:::service
        task["task-webservice (Task Service)"]:::service
        comments["comments-webservice (Comments Service)"]:::service
    end

    %% API Gateway & Client Side
    subgraph "API Gateway & Client"
        gateway["api-gateway (Zuul API Gateway)"]:::gateway
        portal["web-portal (Front-end UI)"]:::gateway
    end

    %% Config fetch from config-server
    auth -->|"fetchConfig"| config
    user -->|"fetchConfig"| config
    task -->|"fetchConfig"| config
    comments -->|"fetchConfig"| config
    gateway -->|"fetchConfig"| config

    %% Service Registration with Eureka
    auth -->|"register"| registry
    user -->|"register"| registry
    task -->|"register"| registry
    comments -->|"register"| registry
    gateway -->|"register"| registry

    %% API Gateway routes requests to backend microservices
    portal -->|"HTTPRequest"| gateway
    gateway -->|"routeToAuth"| auth
    gateway -->|"routeToUser"| user
    gateway -->|"routeToTask"| task
    gateway -->|"routeToComments"| comments

    %% Click Events
    click config "https://github.com/rohitghatol/spring-boot-microservices/blob/master/config-server/src/main/java/com/rohitghatol/microservices/config/Application.java"
    click registry "https://github.com/rohitghatol/spring-boot-microservices/blob/master/webservice-registry/src/main/java/com/rohitghatol/microservices/registry/Application.java"
    click auth "https://github.com/rohitghatol/spring-boot-microservices/blob/master/auth-server/src/main/java/com/rohitghatol/microservice/auth/Application.java"
    click user "https://github.com/rohitghatol/spring-boot-microservices/blob/master/user-webservice/src/main/java/com/rohitghatol/microservices/user/Application.java"
    click task "https://github.com/rohitghatol/spring-boot-microservices/blob/master/task-webservice/src/main/java/com/rohitghatol/microservices/task/Application.java"
    click comments "https://github.com/rohitghatol/spring-boot-microservices/blob/master/comments-webservice/src/main/java/com/rohitghatol/microservices/comments/Application.java"
    click gateway "https://github.com/rohitghatol/spring-boot-microservices/blob/master/api-gateway/src/main/java/com/rohitghatol/microservice/gateway/Application.java"
    click portal "https://github.com/rohitghatol/spring-boot-microservices/blob/master/web-portal/src/main/java/com/rohitghatol/microservices/portal/Application.java"

    %% Styles
    classDef infra fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef service fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef gateway fill:#FFB6C1,stroke:#333,stroke-width:2px;
```
