# abhinavgupta-de/microservices-quiz-app architecture

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

- Interactive diagram: https://gitdiagram.com/abhinavgupta-de/microservices-quiz-app
- Repository: https://github.com/abhinavgupta-de/microservices-quiz-app

## Overview

##### Main Components Identification
The system consists of three primary microservices with distinct responsibilities:
- Service Registry (Eureka Server)
- Question Service
- Quiz Service

a. Service Registration Flow:

b. Service Discovery Flow:

c. API Calls Flow:

##### Additional Elements

b. Technical Stack Annotations:
- Spring Boot
- Spring Data JPA
- PostgreSQL
- Eureka
- Feign Client

##### Specific Details

For Each Service:
- Exposed REST endpoints
- Internal component structure (Controller → Service → Repository)
- Database schema representation
- Exception handling flow
- DTOs used for data transfer

##### Architecture Patterns to Highlight

- Microservices architecture
- Service discovery pattern
- Database per service pattern
- REST communication
- DTO pattern
- Repository pattern
- Exception handling pattern

##### Deployment Aspects

A section showing:
- Docker containers (reference docker-compose.yml)
- Network configuration
- Service ports
- Database connections

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef registry fill:#b3e0ff,stroke:#333
    classDef question fill:#b3ffb3,stroke:#333
    classDef quiz fill:#ffcc99,stroke:#333
    classDef database fill:#f9f9f9,stroke:#333
    classDef api fill:#e6e6e6,stroke:#333
    classDef component fill:#fff,stroke:#333

    %% Service Registry
    SR["Service Registry<br/>(Eureka Server)"]:::registry
    click SR "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/ServiceRegistryQuizApp/src/main/java/org/abhinavgpt/serviceregistryquizapp/ServiceRegistryQuizAppApplication.java"

    %% Question Service Components
    subgraph QS["Question Service"]
        QC["QuestionController"]
        QS_Service["QuestionService"]
        QS_Interface["IQuestionService"]
        QS_Repo["QuestionRepository"]
        QS_Model["Question Model"]
        QS_DTO["AddQuestionDTO"]
        QS_Exception["GlobalExceptionHandler"]
    end

    %% Quiz Service Components
    subgraph QuizS["Quiz Service"]
        QuizC["QuizController"]
        Quiz_Service["QuizService"]
        Quiz_Interface["IQuizService"]
        Quiz_Repo["QuizRepository"]
        Quiz_Models["Quiz, Question, Response Models"]
        Quiz_DTO["AddQuizDTO"]
        Quiz_Exception["GlobalExceptionHandler"]
        Quiz_QS_Integration["Question Service Integration"]
    end

    %% Databases
    QS_DB[(Question DB)]:::database
    Quiz_DB[(Quiz DB)]:::database

    %% Service Registry Connections
    QS --> |"Register"| SR
    QuizS --> |"Register"| SR

    %% Question Service Internal Flow
    QC --> QS_Service
    QS_Service --> QS_Interface
    QS_Service --> QS_Repo
    QS_Repo --> QS_DB
    QS_Service --> QS_Model
    QC --> QS_DTO
    QC --> QS_Exception

    %% Quiz Service Internal Flow
    QuizC --> Quiz_Service
    Quiz_Service --> Quiz_Interface
    Quiz_Service --> Quiz_Repo
    Quiz_Repo --> Quiz_DB
    Quiz_Service --> Quiz_Models
    QuizC --> Quiz_DTO
    QuizC --> Quiz_Exception
    Quiz_Service --> Quiz_QS_Integration
    Quiz_QS_Integration -.-> |"Feign Client"| QC

    %% Click Events
    click QC "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/questionService/src/main/java/org/abhinavgpt/questionservice/controllers/QuestionController.java"
    click QS_Interface "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/questionService/src/main/java/org/abhinavgpt/questionservice/servies/questionservice/IQuestionService.java"
    click QS_Service "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/questionService/src/main/java/org/abhinavgpt/questionservice/servies/questionservice/QuestionService.java"
    click QS_Repo "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/questionService/src/main/java/org/abhinavgpt/questionservice/repository/QuestionRepository.java"
    click QS_Model "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/questionService/src/main/java/org/abhinavgpt/questionservice/model/Question.java"
    click QS_DTO "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/questionService/src/main/java/org/abhinavgpt/questionservice/dtos/AddQuestionDTO.java"
    click QS_Exception "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/questionService/src/main/java/org/abhinavgpt/questionservice/exceptionhandlers/GlobalExceptionHandler.java"
    
    click QuizC "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/quizService/src/main/java/org/abhinavgpt/quizservice/controllers/QuizController.java"
    click Quiz_Interface "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/quizService/src/main/java/org/abhinavgpt/quizservice/servies/quizservice/IQuizService.java"
    click Quiz_Service "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/quizService/src/main/java/org/abhinavgpt/quizservice/servies/quizservice/QuizService.java"
    click Quiz_Repo "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/quizService/src/main/java/org/abhinavgpt/quizservice/repository/QuizRepository.java"
    click Quiz_Exception "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/quizService/src/main/java/org/abhinavgpt/quizservice/exceptionhandlers/GlobalExceptionHandler.java"
    click Quiz_QS_Integration "https://github.com/AbhinavGupta-de/microservices-quiz-app/blob/master/quizService/src/main/java/org/abhinavgpt/quizservice/servies/questionservice/IQuestionService.java"

    %% Legend
    subgraph Legend
        L1["Service Registry"]:::registry
        L2["Question Service Components"]:::question
        L3["Quiz Service Components"]:::quiz
        L4[(Database)]:::database
        L5["--- Register"]
        L6["... Feign Client"]
    end
```
