Backend project for managing quizzes through a REST API.
It supports user registration, quiz creation, solving quizzes, and paginated quiz retrieval.
This repository is meant to be a clean, practical Spring Boot project that can be extended over time.
- User registration
- Authentication
- Quiz creation
- Paginated quiz listing
- Quiz retrieval by ID
- Quiz solving with immediate feedback
- Database persistence
- Java
- Spring Boot
- Spring Web
- Spring Data JPA
- Spring Security
- Bean Validation
- H2 / PostgreSQL (depending on configuration)
- Gradle or Maven
- Java 17+
- Git
- Gradle or Maven
git clone https://github.com/San-43/Web-Quiz-Engine-with-Java-and-Spring-Boot.git
cd Web-Quiz-Engine-with-Java-and-Spring-BootEdit src/main/resources/application.properties.
Example using H2:
spring.datasource.url=jdbc:h2:file:./quizdb
spring.datasource.driverClassName=org.h2.Driver
spring.datasource.username=sa
spring.datasource.password=
spring.jpa.hibernate.ddl-auto=update
spring.h2.console.enabled=trueExample using PostgreSQL:
spring.datasource.url=jdbc:postgresql://localhost:5432/quizdb
spring.datasource.username=postgres
spring.datasource.password=your_password
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialectWith Gradle:
./gradlew bootRunWith Maven:
./mvnw spring-boot:runDefault address:
http://localhost:8889
POST /api/register
{
"email": "user@example.com",
"password": "strongPassword123"
}POST /api/quizzes
Create a quiz
{
"title": "The Java Logo",
"text": "What is depicted on the Java logo?",
"options": ["Robot", "Tea leaf", "Cup of coffee", "Bug"],
"answer": [2]
}GET /api/quizzes?page={number}
Get paginated quizzes
GET /api/quizzes/{id}
Get quiz details by ID
GET /api/quizzes/completed?page={number}
Get paginated completed quizzes by the authenticated user
POST /api/quizzes/{id}/solve
Submit an answer
{
"answer": [2]
}Correct answer response:
{
"success": true,
"feedback": "Congratulations, you're right!"
}Wrong answer response:
{
"success": false,
"feedback": "Wrong answer! Please, try again."
}DELETE /api/quizzes/{id}
Delete a quiz by its id. The authenticated user must be the author of the target quiz.
titleandtext: must not be blankoptions: at least 2 optionsanswer: optional (can default to an empty list)email: valid formatpassword: minimum length defined in the project
With Gradle:
./gradlew testWith Maven:
./mvnw testThanks to Hyperskill for the learning path and project structure that inspired this implementation.
Project page: https://hyperskill.org/projects/91
Contributions are welcome.
- Fork the repository
- Create a feature branch
- Commit your changes
- Open a pull request
If this project helped you, consider leaving a ⭐.