/quizapp

Take a Quiz

Primary LanguageJava

Quiz App

Build and Test Build and Push Docker image Deploy to ec2 Website Status

Introduction

This Spring Boot application provides a comprehensive set of APIs for managing quizzes. Users can create quizzes, take quizzes, and evaluate their performance. Additionally, the application offers functionality to add new questions and categories. It also integrates AI capabilities, allowing users to generate entire quizzes by simply providing a prompt, making quiz creation more efficient and intelligent. This solution is designed to handle dynamic user inputs and offers a seamless experience for both quiz makers and participants.

System Architecture Overview

The architecture of this application is designed for scalability, security, and efficient processing. Nginx is employed to terminate TLS/HTTPS, ensuring secure communication between clients and the server. The core of the application is built on a Spring Boot app server, handling business logic and API requests, while PostgreSQL is used for reliable data storage. Additionally, the system integrates with GROQ AI to enhance AI-driven capabilities, making it a powerful solution for dynamic and interactive experiences.

image

Prerequisite

Before running the Quiz App, ensure that the following are installed:

  • Java-17
  • Docker
  • Maven
  • IntelliJ

DB setup

#TODO : write about .env file

Following command to run postgres and import required data into it

docker-compose up db -d

Installation

Run the below command to build maven project

mvn clean install -DskipTests

Running the Application

To run the application locally with the dev profile, follow these steps:

  1. Ensure the following program argument is passed: --spring.profiles.active=dev
  2. Add the environment variable GROQ_API_KEY to integrate with AI services.
  3. To start the application:
    • Open QuizappApplication.java.
    • Right-click on the file and select Run.

Swagger API Documentation and Execution

Once the QuizApp backend server is up and running, you can access the Swagger API documentation at the following URL: http://localhost:8080/swagger-ui/index.html

Running the Application

make sure dev profile is configured while running on local, below program argument is passed --spring.profiles.active=dev make sure to add "GROQ_API_KEY" with value to integrate with AI groq url to create API key - https://console.groq.com/keys To run the application, open QuizappApplication, right-click, and select "Run."

Swagger API documentation and Execution

Once quizapp backend server is up and running, API documentation will be accessible using below url

http://localhost:8080/swagger-ui/index.html

Verification

Verify the setup by executing the following command:

% curl localhost:8080/questions/all

You should receive a proper response with questions (sample response)

[
	{
		"id": 1,
		"questionTitle": "What is a class in Java?",
		"option1": "A function",
		"option2": "An object",
		"option3": "A data structure",
		"option4": "A loop",
		"rightAnswer": null
	}
]