Skip to content

A distributed Quiz application built with Spring Boot microservices. Users can browse a catalog of quizzes, answer questions, receive grades, and even create their own quizzes — all through a resilient, Eureka‑backed microservices architecture.

jorgepiconjr/spring-quiz-microservices

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microservices Java Spring - Full Stack Project

A distributed Quiz application built with Java Spring Boot microservices, PostgreSQL data base and HTML. Users can browse a catalog of quizzes, answer questions, receive grades, and even create their own quizzes. Implementation of Create, read, update and delete (CRUD) — all through a resilient, Eureka‑backed microservices architecture.

Table of Contents


About the Project

This project demonstrates a Spring Boot microservices ecosystem powering a dynamic Quiz App. It integrates multiple independent services—questions service, quiz service, service registry, and API gateway—to handle all quiz operations, data persistence in two postgreSQL databases “Questions DB” and “Quizzes DB”, and inter‑service communication.

Technologies Used

  • Java
  • Spring Boot
  • Spring Data JPA
  • Spring Cloud Netflix Eureka (Server/Client)
  • Spring Cloud OpenFeign
  • Spring Cloud Gateway
  • Thymeleaf for server‑side HTML rendering
  • HTML & CSS
  • Apache Tomcat
  • Data base: PostgreSQL

Architecture Overview

                            ┌────────────────────┐
                            │    Client / UI     │
                            └─────────┬──────────┘
                                      │
                                      ▼
                         ┌────────────────────────────┐
                         │        API Gateway         │
                         │ (spring-cloud-gateway)     │
                         └────────────┬───────────────┘
                                      │        
                   Service Discovery  ▼        
                            ┌───────────────────┐
                            │       Eureka      │
                            │ (service-registry)│
                            └────────┬──┬───────┘
                                     │  │
                                     ▼  ▼
                            ┌────────┴──┴─────────────┐
                            │                         │
                  ┌─────────▼────────┐       ┌────────▼─────────┐
                  │   Quiz Service   │ ──▶  │ Question Service │
                  │ (quiz-service)   │ Feign │(question-service)│
                  └────────┬─────────┘       └────────┬─────────┘
                           │                          │
                           ▼                          ▼
                   ┌──────────────┐           ┌─────────────────┐
                   │PostgreSQL DB │           │  PostgreSQL DB  │
                   │   (Quiz)     │           │  (Questions)    │
                   └──────────────┘           └─────────────────┘

Microservice Details

  1. Question-service
  • Manages all quiz questions: CREATE, READ, UPDATE, DELETE (CRUD) operations for questions, categories, difficulty levels, possible answers, correct answer.
  • Persists data to a PostgreSQL “questions” database.
  1. Quiz-service
  • Orchestrates quizzes: CREATE, READ, UPDATE, DELETE (CRUD) operations for quizzes, creates new quizzes, retrieves quiz metadata and questions via Feign client from question-service.
  • Provides quiz catalog and grading logic.
  1. service-registry
  • Runs a Eureka server for dynamic discovery of quiz-service and question-service.
  1. api-gateway
  • Uses Spring Cloud Gateway to route and load‑balance incoming requests across microservices.
  • Manages ports and handles CORS, security, and rate limiting (if extended).

Key Features

  1. Quiz Catalog
  • Browse all available quizzes along with metadata (respective questions).
  1. Dynamic Quiz Taking
  • Fetch quizzes, load and answer questions, and receive instant grading.
  1. Quiz Creation
  • Build and persist your own quizzes (questions, options, correct answers).
  1. Resilient Microservices
  • Discovery via Eureka; centralized routing via API Gateway.

Example

Flow of a Typical Request (e.g., Creating a Quiz)

  1. A user (via an app) sends a request to create a quiz to the API-GATEWAY.
  2. The API-GATEWAY sees the request's URL (e.g., /quiz/create) and knows it must forward it to the QUIZ-SERVICE.
  3. The QUIZ-SERVICE receives the request. To create the quiz, it needs 10 questions from the "Java" category.
  4. The QUIZ-SERVICE asks the EUREKA-SERVER: "Where is the QUESTION-SERVICE?"
  5. Eureka responds with the address.
  6. The QUIZ-SERVICE makes a call (using OpenFeign) to the QUESTION-SERVICE to request the questions.
  7. The QUESTION-SERVICE queries its database (PostgreSQL), retrieves the questions, and returns them to the QUIZ-SERVICE.
  8. The QUIZ-SERVICE creates the quiz with the received questions and returns the final response to the API-GATEWAY.
  9. The API-GATEWAY finally sends the response back to the user.

Screenshots

  • Simple user interfaces to be able to interact with the system at web level and not through Tomcat with manual GET and POST messages.
  • The content of the Webseite is dynamic, the HTML is in charge of representing the data obtained from the database..

Home

image_alt

Execute a Quiz

image_alt

Quiz Catalog

image_alt

About

A distributed Quiz application built with Spring Boot microservices. Users can browse a catalog of quizzes, answer questions, receive grades, and even create their own quizzes — all through a resilient, Eureka‑backed microservices architecture.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published