This project is built using Spring Boot + Spring Cloud and follows the Microservices Architecture pattern.
It consists of multiple independent services communicating through Eureka Server and API Gateway.
- Java 21
- Spring Boot 3.5.5
- Spring Cloud Gateway
- Netflix Eureka (Service Discovery)
- PostgreSQL (Database for Quiz Service)
- Maven
+--------------------+
| API Gateway |
| (port: 8765) |
+---------+----------+
|
-----------------------------------------------
| |
+---------------+ +-----------------+
| QuestionService| | QuizService |
| (port: 8081) | | (port: 8090) |
+----------------+ +-----------------+
| |
| |
+-------------+ +--------------+
|questiondb(PostgreSQL)| |quizdb(PostgreSQL)|
+-------------+ +--------------+
+--------------------+
| Eureka Server |
| (Service Registry)|
+--------------------+
- Entry point for all client requests.
- Routes requests to the appropriate microservices using Eureka Service Discovery.
- Auto routing enabled via Discovery Locator.
- Example request:
http://localhost:8765/quiz-service/quiz/get/3
- Service registry for all microservices.
- Displays the registered instances and their status via UI.
- Manages questions.
- Endpoints:
GET /question/allQuestions GET /question/category/{category} POST /question/add GET /question/generate POST /question/getQuestions POST /question/getScore
- Responsible for quiz creation, retrieval, and submission.
- Connected to PostgreSQL database.
- Endpoints:
POST /quiz/create GET /quiz/get/{id} POST /quiz/submit/{id}
POST http://localhost:8765/quiz-service/quiz/create
{
"categoryName": "java",
"numQuestions": 5,
"title": "Java Basics Quiz"
}GET http://localhost:8765/quiz-service/quiz/get/1
Response Example:
[
{
"id": 10,
"questionTitle": "What is JVM?",
"option1": "Java Virtual Machine",
"option2": "Java Vendor Machine",
"option3": "Just Virtual Machine",
"option4": "None",
"rightAnswer": null
},
{
"id": 11,
"questionTitle": "Which keyword is used to inherit a class?",
"option1": "implement",
"option2": "this",
"option3": "extends",
"option4": "super",
"rightAnswer": null
}
]POST http://localhost:8765/quiz-service/quiz/submit/1
[
{ "id": 10, "response": "Java Virtual Machine" },
{ "id": 11, "response": "extends" }
]Response Example:
2GET http://localhost:8765/question-service/question/category/java
Response Example:
[
{
"id": 1,
"questionTitle": "What is Polymorphism?",
"option1": "Overloading & Overriding",
"option2": "Encapsulation",
"option3": "Inheritance",
"option4": "Abstraction",
"rightAnswer": "Overloading & Overriding",
"difficultyLevel": "Medium",
"category": "java"
}
]