This is a full-stack Trivia Game application built with a SpringBoot backend and React frontend. The application allows users to register, login and participate in a trivia quiz. It also includes a leaderboard to track users' scores.
- User Authentication (Signup/Login)
- Trivia Game with multiple-choice questions
- Leaderboard to display top scores
- RESTful API integration for user and game management
- Dynamic question fetching from the Open Trivia Database
- Responsive design
- Java
- Spring Boot
- JPA/Hibernate
- H2 Database (for development)
- REST API
- ExpressJS
- Sequelize
- Socket.io
- PostgreSQL
- SwaggerUI
- React (ViteJS)
- JavaScript (ES6+)
- ChakraUI
- Controllers: Handles incoming requests and routes them to appropriate services
HelloController.java: Basic greeting endpointScoresController.java: Manages scores for the trivia gameUserController.java: Handles user authentication and management
- Models: Entity classes that represent the data
Game.java: Represents a trivia game sessionGameQuestion.java: Represents a trivia questionUser.java: Represents a user of the application
- Repositories: Interfaces for database access
GameRepository.java: Handles CRUD operations for theGamemodelGameQuestionRepository.java: Handles CRUD operations forGameQuestionUserRepository.java: Handles user-related database operations
- Security: Basic authentication and security setup in
TriviaApplication.java - Database Migration:
- SQL schema defined in
V1__initial_db_schema.sql
- SQL schema defined in
- Pages:
Game.jsx: Handles the trivia game logic and UIHome.jsx: Homepage of the applicationLeaderboard.jsx: Displays top scoresLogin.jsx: User login formSignup.jsx: User registration formUsers.jsx: Displays a list of users (Admin functionality)
- Services:
GameService.js: Fetches trivia questions from an external API:contentReference[oaicite:0]{index=0}UserService.js: Handles user-related requests (login, signup, fetching users):contentReference[oaicite:1]{index=1}
- CSS:
App.css: General styles for the app including layout and animations:contentReference[oaicite:2]{index=2}index.css: Global styling and theme:contentReference[oaicite:3]{index=3}
-
Clone the repository:
git clone https://github.com/your-repo/trivia-game-backend.git cd trivia-game-backend -
Build and run the Spring Boot application:
./gradlew bootRun- Navigate to the frontend folder:
cd trivia-frontend- Install dependencies:
npm install- Start the development server:
npm startOpen http://localhost:3000 in your browser to view the application.