A full-stack quiz application built with Spring Boot, React, and PostgreSQL.
The application allows users to browse questions, create quizzes, attempt quizzes, and calculate quiz results through a REST API connected to a React frontend.
- Java
- Spring Boot
- Spring Data JPA
- Hibernate
- PostgreSQL
- Maven
- REST APIs
- React
- Vite
- JavaScript
- HTML
- CSS
- Create quizzes using questions from the database
- Fetch all available questions
- Fetch questions by ID
- Fetch questions by category
- Create quizzes with selected questions
- Retrieve quizzes
- Attempt quizzes through the frontend
- Calculate quiz scores
- REST API based backend
- PostgreSQL database integration
- React-based user interface
java-quiz-app/
│
├── frontend/
│ ├── src/
│ │ ├── components/
│ │ ├── App.jsx
│ │ ├── api.js
│ │ ├── index.css
│ │ └── main.jsx
│ ├── index.html
│ ├── package.json
│ ├── package-lock.json
│ └── vite.config.js
│
├── src/
│ ├── main/
│ │ ├── java/
│ │ │ └── com/project/quizapp/
│ │ │ ├── Controller/
│ │ │ ├── Service/
│ │ │ ├── dao/
│ │ │ └── model/
│ │ └── resources/
│ │
│ └── test/
│
├── pom.xml
├── mvnw
├── mvnw.cmd
└── README.md
The backend follows a layered architecture:
Controller
↓
Service
↓
DAO / Repository
↓
Database
- Controller — Handles HTTP requests and exposes REST endpoints.
- Service — Contains application and business logic.
- DAO / Repository — Handles database operations using Spring Data JPA.
- Model — Contains JPA entities and request/response models.
- PostgreSQL — Stores questions, quizzes, and related data.
The backend exposes REST endpoints for operations such as:
GET /question/allQuestions
GET /question/{id}
GET /question/category/{category}
POST /quiz/create
GET /quiz/get/{id}
POST /quiz/submit/{id}
The exact endpoints may evolve as the application is developed.
git clone https://github.com/surbhibadhe/java-quiz-app.git
cd java-quiz-appCreate a PostgreSQL database and update the database configuration in:
src/main/resources/application.properties
Configure your PostgreSQL URL, username, and password according to your local setup.
On Windows:
.\mvnw.cmd spring-boot:runOr run QuizappApplication directly from IntelliJ IDEA.
The backend runs by default on:
http://localhost:8080
Open another terminal:
cd frontendInstall dependencies:
npm installStart the Vite development server:
npm run devThe frontend will normally be available at:
http://localhost:5173
Make sure the Spring Boot backend is running before using functionality that requires API access.
The application uses PostgreSQL as its relational database.
Spring Data JPA and Hibernate are used to map Java entities to database tables and perform database operations.
This project is being developed as a full-stack application with a separate frontend and backend:
React / Vite
│
│ HTTP / REST API
↓
Spring Boot
│
│ JPA / Hibernate
↓
PostgreSQL
Planned improvements include:
- Authentication and authorization
- Improved quiz creation interface
- Better quiz-taking experience
- Score and result history
- Improved validation and error handling
- Responsive UI
- Deployment of frontend and backend
- Automated testing
- API documentation
Surbhi Badhe
GitHub: https://github.com/surbhibadhe