A sample fullstack application built for education purpose using AI (IntelliJ Junie) to try out it's newest AI capabilities and power.
A pub quiz is a quiz held in a pub or bar. These quizzes are popular social events that combine knowledge testing with a fun, relaxed atmosphere. This document outlines the basic rules for running and participating in a pub quiz.
- Participants: Individual players participate in the quiz
- No Cheating: The Online research or asking people not part of the participant group is not allowed.
- Quiet During Questions: Participants should remain quiet while questions are being read.
- Time Limit: Each round typically has a set time limit for answering questions.
- Choose a unique player name.
- Register with the quiz master before the quiz begins.
- Each correct answer is typically worth one point.
- Some questions may be worth more points if they are particularly difficult.
- The player with the highest total score at the end of all rounds wins.
- In case of a tie, a tie-breaker question will be used to determine the winner.
A typical pub quiz consists of several rounds, which may include:
- General Knowledge: Questions covering a wide range of topics.
- Music: Identifying songs, artists, or lyrics.
- Picture Round: Identifying images, celebrities, landmarks, etc.
- Sports: Questions related to various sports and sporting events.
- History: Questions about historical events, figures, and periods.
- Science and Nature: Questions about scientific facts, discoveries, and natural phenomena.
- Entertainment: Questions about movies, TV shows, books, etc.
- Be respectful to the quiz master and other participants.
- Keep your answers and discussions quiet to avoid giving away answers to other players.
- Accept the quiz master's decision as final.
- Have fun! The primary purpose of a pub quiz is entertainment.
Remember, the main goal of a pub quiz is to have fun while testing your knowledge in a social setting!
- Java 21 or higher
- Node.js and npm
- Angular CLI (
npm install -g @angular/cli
)
- Navigate to the project root directory
- Run the Spring Boot application:
./gradlew bootRun
- The backend will start on http://localhost:8080
- Access the API documentation at http://localhost:8080/swagger-ui.html
- Navigate to the frontend directory:
cd frontend
- Install dependencies (first time only):
npm install
- Start the Angular development server:
npm start
- A browser window will automatically open to the application
- The frontend will be available at http://localhost:4200
The frontend is configured with a proxy to the backend, so API calls will be automatically forwarded to the backend server.
The KwiZ application uses Swagger UI for API documentation. Swagger UI provides an interactive interface to explore and test the API endpoints.
- Start the backend application as described in the "Starting the Backend" section
- Open your browser and navigate to: http://localhost:8080/swagger-ui.html
- Interactive Documentation: Explore API endpoints with an interactive UI
- Request Testing: Test API requests directly from the browser
- Response Visualization: See the structure of API responses
- Parameter Information: Understand required and optional parameters for each endpoint
This is particularly useful for both backend and frontend developers to understand the available services and how to interact with them.
Spring Boot Actuator provides production-ready features to help monitor and manage the application. The KwiZ application has the following actuator endpoints enabled:
All actuator endpoints are available under the base path: http://localhost:8080/actuator
-
Health: http://localhost:8080/actuator/health
- Provides information about the application's health
- Shows detailed health information including disk space, database status, etc.
- Useful for monitoring systems to check if the application is running properly
-
Info: http://localhost:8080/actuator/info
- Provides general information about the application
- Shows application metadata like version, description, etc.
-
Game State: http://localhost:8080/actuator/gamestate
- Custom endpoint that provides comprehensive information about the game state
- Shows all quizzes, rounds, questions, and players in the system
- Useful for debugging and monitoring the application state
Actuator endpoints return JSON responses that can be viewed in a browser or consumed by monitoring tools. For example:
# Get application health information
curl http://localhost:8080/actuator/health
# Get application information
curl http://localhost:8080/actuator/info
# Get game state information
curl http://localhost:8080/actuator/gamestate
These endpoints are particularly useful for operations teams to monitor the application's health and state in production environments.
The KwiZ application follows a streamlined release and deployment process that ensures consistent delivery from development to production.
- The frontend is built and served by the Spring Boot JAR as a static resource
- During the build process, the Angular frontend is compiled and then copied into the Spring Boot static resources directory
- This integration is handled by Gradle tasks:
buildFrontend
: Builds the Angular applicationcopyFrontendToBuild
: Copies the built frontend intobuild/resources/main/web
- These tasks run automatically as part of the main build process
- A GitHub Action automatically deploys the application to Azure Cloud on every commit to the main branch
- The workflow is defined in
.github/workflows/main_kwiz.yml
- The deployment process:
- Builds the application using Gradle
- Copies the JAR file to
build/release/kwiz.jar
(without version number) - Uploads the JAR as an artifact
- Deploys the JAR to Azure Web App in the Production slot
- The "Test Release Jar" run configuration can be used to test the release JAR locally
- This configuration:
- Uses the JAR file from
build/release/kwiz.jar
- Sets the working directory to the project root
- Uses Azul JDK 21 as the runtime environment
- Uses the JAR file from
- To use this configuration:
- Build the project with
./gradlew build
to generate the release JAR - Run the "Test Release Jar" configuration from your IDE
- Build the project with
- The application is deployed and accessible at: https://kwiz-brgkdec7cphbcbb2.westeurope-01.azurewebsites.net/home
- This URL is the production environment where users can access the application
- The deployment is automatically updated whenever changes are pushed to the main branch
- The application is hosted on Azure Web App service in the West Europe region
- Somehow the pure URL without any trailing path seems not to work yet - which is a bug in current WebConfig that our most valued developer IntelliJ Junie was not yet able to fix.