This GitHub Classroom lab uses:
- Spring Boot 3.5.14 for the game server
- Spring Boot 3 web client for the browser interface
- gRPC + Protobuf between the web client module and the game server module
- Spring Data JPA for persistence
- File-based H2 database for saved matches
This version does not use JavaFX or FXML.
The browser talks to the game-client Spring Boot app using normal HTTP/JSON. The game-client then calls the game-server through gRPC. The game-server persists matches with JPA/H2.
Browser
↓ HTTP/JSON
game-client Spring Boot web app
↓ gRPC/Protobuf
game-server Spring Boot gRPC service
↓ Spring Data JPA
file-based H2 database
| Module | Purpose |
|---|---|
game-server |
Spring Boot 3 app hosting the gRPC service and persisting matches |
game-client |
Spring Boot 3 web app serving HTML/CSS/JS and proxying calls to gRPC |
From the project root:
mvn clean installThis generates Java classes from:
game-server/src/main/proto/game_service.proto
game-client/src/main/proto/game_service.proto
Terminal 1:
cd game-server
mvn spring-boot:runExpected output:
Spring Boot 3 gRPC Game Server started on port 50051
Terminal 2:
cd game-client
mvn spring-boot:runOpen:
http://localhost:9091
The server persists matches using Spring Data JPA and H2.
| File | Purpose |
|---|---|
MatchEntity.java |
JPA entity stored in the database |
MatchRepository.java |
Spring Data repository for saved matches |
game-server/src/main/resources/application.properties |
Configures file-based H2 |
.gitignore |
Prevents local database files from being committed |
The database URL is:
spring.datasource.url=jdbc:h2:file:./data/game-server-dbLocal database files are created under:
game-server/data/
These files should not be committed.
| Removed Feature | Replacement |
|---|---|
| JavaFX/FXML desktop UI | Spring Boot web client with HTML/CSS/JS |
| Direct browser-to-server REST API | Browser calls web client; web client calls gRPC server |
| JSON between modules | gRPC/protobuf between modules |
| Player roles | Difficulty only |
| HP tracking | Server returns winner and loser |
| In-memory-only match storage | Spring Data JPA with file-based H2 |
- Verify the browser UI sends requests to the
game-clientREST facade. - Verify the
game-clientcalls thegame-serverusing gRPC. - Verify completed matches are saved through Spring Data JPA.
- Verify match history loads from persisted JPA records.
- Add one small web UI improvement.
- Complete a Pull Request peer review.
- What does the browser client do?
- What does the
game-clientSpring Boot app do? - What does the
game-serverSpring Boot app do? - Why does this project still use gRPC if the UI is web-based?
- What data is sent in
JoinMatchRequest? - What data is returned in
MatchResultResponse? - What is the purpose of
MatchEntity? - What is the purpose of
MatchRepository? - Why are H2 database files ignored by Git?
- What did your peer reviewer suggest?
- What did you change after peer review?