# khadeer0503/microservices_project architecture

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

- Interactive diagram: https://gitdiagram.com/khadeer0503/microservices_project
- Repository: https://github.com/khadeer0503/microservices_project

## Overview

- API Gateway – handles incoming client requests and routes them appropriately;
- Config Server – centralizes configuration management for the other microservices;
- Discovery Server – offers service registration and discovery to simplify inter-service communication;
- Student Microservice – manages student-related data and operations;
- School Microservice – manages school-related data and operations;
- Additionally, the project demonstrates inter-service communication using OpenFeign and distributed tracing with Zipkin.

##### Main Components Identification
- API Gateway
- Config Server
- Discovery Server
- Student Microservice
- School Microservice
- Optionally, include external systems/libraries like Zipkin (for tracing) and OpenFeign (as part of the inter-service communication layer).

##### Component Relationships and Data Flow
- Microservice with the Discovery Server, showing service registration and lookup.
- Distributed tracing by linking each component (e.g., API Gateway, microservices) to a Zipkin component to indicate that calls are traced across the system.

##### Architectural Patterns and Principles
- Microservices architectural style by clearly separating each service into its own component.
- Use of the gateway pattern (API Gateway) and central configuration (Config Server).
- Mention service discovery as a key pattern (Discovery Server).
- An “observability” layer for Zipkin to capture distributed traces.
- That OpenFeign is used as a declarative REST client across service boundaries.

##### Technologies and Frameworks
- The use of Spring Boot (inferred from the typical Java package structure and Maven configurations).
- Spring Cloud components likely powering the API Gateway, Config Server, and Discovery Server.
- OpenFeign as the tool for inter-service REST communication.
- Zipkin for tracing.

##### Final Recommendations
- That all relationships and dependencies are clearly shown with directional flows.
- Annotations where needed to describe each interaction, for example, noting “OpenFeign REST call” or “Configuration lookup”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    CLIENT("Client"):::client
    APIGATEWAY("API Gateway"):::api
    STUDENT("Student Microservice"):::micro
    SCHOOL("School Microservice"):::micro
    DISCOVERY("Discovery Server"):::infra
    CONFIG("Config Server"):::infra
    CONFIG_FILES("Configurations"):::infra
    ZIPKIN("Zipkin (Tracing)"):::tracing
    OPENFEIGN("OpenFeign Client"):::feign

    %% Client to API Gateway
    CLIENT -->|"request"| APIGATEWAY

    %% API Gateway flows
    APIGATEWAY -->|"routes"| STUDENT
    APIGATEWAY -->|"routes"| SCHOOL
    APIGATEWAY -->|"fetches config"| CONFIG
    APIGATEWAY -->|"traces"| ZIPKIN

    %% Microservices to infrastructure
    STUDENT -->|"registers with"| DISCOVERY
    STUDENT -->|"fetches config"| CONFIG
    STUDENT -->|"traces"| ZIPKIN

    SCHOOL -->|"registers with"| DISCOVERY
    SCHOOL -->|"fetches config"| CONFIG
    SCHOOL -->|"traces"| ZIPKIN

    %% Inter-service communication using OpenFeign
    SCHOOL -->|"uses"| OPENFEIGN
    OPENFEIGN -->|"OpenFeignRESTcall"| STUDENT

    %% Config Server linking to configuration files
    CONFIG -->|"holds"| CONFIG_FILES

    %% Discovery connection (both services register)
    STUDENT -->|"discovers services"| DISCOVERY
    SCHOOL -->|"discovers services"| DISCOVERY

    %% Styling for vertical layout enforcement
    style CLIENT fill:#f4d03f,stroke:#d68910,stroke-width:2px
    style APIGATEWAY fill:#85c1e9,stroke:#2980b9,stroke-width:2px
    style STUDENT fill:#aed6f1,stroke:#5dade2,stroke-width:2px
    style SCHOOL fill:#aed6f1,stroke:#5dade2,stroke-width:2px
    style DISCOVERY fill:#f5b7b1,stroke:#e74c3c,stroke-width:2px
    style CONFIG fill:#f5b7b1,stroke:#e74c3c,stroke-width:2px
    style CONFIG_FILES fill:#f5b7b1,stroke:#e74c3c,stroke-width:2px
    style ZIPKIN fill:#d5f5e3,stroke:#27ae60,stroke-width:2px
    style OPENFEIGN fill:#fad7a0,stroke:#e67e22,stroke-width:2px

    %% Click Events
    click APIGATEWAY "https://github.com/khadeer0503/microservices_project/blob/main/api-gateway/src/main/java/com/test/apigateway/ApiGatewayApplication.java"
    click CONFIG "https://github.com/khadeer0503/microservices_project/blob/main/configServer/src/main/java/com/test/configServer/ConfigServerApplication.java"
    click CONFIG_FILES "https://github.com/khadeer0503/microservices_project/tree/main/configServer/src/main/resources/configurations"
    click DISCOVERY "https://github.com/khadeer0503/microservices_project/blob/main/discoveryServer/src/main/java/com/test/discoveryServer/DiscoveryServerApplication.java"
    click STUDENT "https://github.com/khadeer0503/microservices_project/blob/main/student/src/main/java/com/test/student/StudentApplication.java"
    click SCHOOL "https://github.com/khadeer0503/microservices_project/blob/main/school/src/main/java/com/test/school/SchoolApplication.java"
    click OPENFEIGN "https://github.com/khadeer0503/microservices_project/blob/main/school/src/main/java/com/test/school/client/StudentClient.java"

classDef client fill:#f4d03f,stroke:#d68910,stroke-width:2px;
classDef api fill:#85c1e9,stroke:#2980b9,stroke-width:2px;
classDef micro fill:#aed6f1,stroke:#5dade2,stroke-width:2px;
classDef infra fill:#f5b7b1,stroke:#e74c3c,stroke-width:2px;
classDef tracing fill:#d5f5e3,stroke:#27ae60,stroke-width:2px;
classDef feign fill:#fad7a0,stroke:#e67e22,stroke-width:2px;
```
