# alexlondon07/spring-boot-microservices-angular architecture

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

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

## Overview

##### Main Components
- Frontend Client: Represent your Angular application. It is located in the “frontend” folder and interacts with the backend over HTTP/REST.
- API Gateways: There are at least two gateway services visible – “api-gateway-service” and “zuul-service.” These components route requests from the frontend to the appropriate microservices.
- Service Discovery: Mark the “eureka-service” as the service registry where all microservices register themselves dynamically.
- Domain Microservices: Include the various domain-specific microservices such as:
– answer-service
– exam-service
– course-service
– user-service
– common-exam, common-service, and common-student (for shared functionality)
- Database: Include a central or distributed database referenced by microservices (indicated by the “microservices_db.sql” file) if applicable.
- Inter-service Communication: Several microservices use Feign clients (for example, ExamFeignClient in answer-service and course-service) to communicate with each other. Represent these as connectors between services.

##### Relationships and Data Flow
- The gateways then use routing logic to forward these requests to the appropriate microservices based on URL paths.
- Additionally, if the gateways or any microservice directly accesses the database, label that connection.

##### Architectural Patterns and Design Principles
- Microservices Architecture: Clearly split the system into discrete, independently deployable services.
- Service Discovery: Use the “Eureka service” for dynamic discovery of microservices.
- API Gateway Pattern: Show a façade (by the gateways) that centralizes client requests and abstracts the complexity of the microservices.
- Resilience and Loose Coupling: While not visible explicitly in the file tree, the presence of multiple services and clients implies patterns such as circuit breakers, which might be used.

##### Technologies and Frameworks
- Spring Boot and Spring Cloud: For building microservices and for service discovery.
- Angular: For the frontend client.
- Maven: As the build and dependency management tool (visible via pom.xml and maven-wrapper scripts).
- Feign Clients: For inter-service communication.
- Also, note the use of Docker (as seen in some Dockerfiles), which might be included in the deployment or container orchestration context.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Angular Frontend"]:::frontend
    B["API Gateway Service"]:::gateway
    C["Zuul Gateway"]:::gateway
    D["Eureka Service"]:::discovery

    subgraph "Backend Microservices"
        E1["Answer Service"]:::microservice
        E2["Exam Service"]:::microservice
        E3["Course Service"]:::microservice
        E4["User Service"]:::microservice
        E5["Common Exam"]:::microservice
        E6["Common Service"]:::microservice
        E7["Common Student"]:::microservice
    end

    F["Database"]:::database

    %% Frontend communication to Gateways
    A -->|"HTTP/REST"| B
    A -->|"HTTP/REST"| C

    %% Gateway routing to Microservices
    B -->|"routes"| E1
    B -->|"routes"| E2
    B -->|"routes"| E3
    B -->|"routes"| E4

    C -->|"routes"| E5
    C -->|"routes"| E6
    C -->|"routes"| E7

    %% Microservices register with Eureka Service
    E1 -->|"registers"| D
    E2 -->|"registers"| D
    E3 -->|"registers"| D
    E4 -->|"registers"| D
    E5 -->|"registers"| D
    E6 -->|"registers"| D
    E7 -->|"registers"| D

    %% Inter-service communication using Feign Clients
    E1 -->|"Feign"| E2
    E3 -->|"Feign"| E2

    %% Microservices database access
    E1 -->|"DB"| F
    E2 -->|"DB"| F
    E3 -->|"DB"| F
    E4 -->|"DB"| F

    %% Click Events
    click A "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/frontend/"
    click B "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/api-gateway-service/"
    click C "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/zuul-service/"
    click D "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/eureka-service/"
    click E1 "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/answer-service/"
    click E2 "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/exam-service/"
    click E3 "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/course-service/"
    click E4 "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/user-service/"
    click E5 "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/common-exam/"
    click E6 "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/common-service/"
    click E7 "https://github.com/alexlondon07/spring-boot-microservices-angular/tree/main/backend/common-student/"
    click F "https://github.com/alexlondon07/spring-boot-microservices-angular/blob/main/microservices_db.sql"

    %% Class Definitions for Colors
    classDef frontend fill:#f9c,stroke:#333,stroke-width:2px;
    classDef gateway fill:#bbf,stroke:#333,stroke-width:2px;
    classDef discovery fill:#ff9,stroke:#333,stroke-width:2px;
    classDef microservice fill:#afa,stroke:#333,stroke-width:2px;
    classDef database fill:#fcc,stroke:#333,stroke-width:2px;
```
