How sahmhoot/sahmhoot-backend works
SahmHoot is documented as a minimal backend skeleton, but the supplied source index and excerpts also show an implemented quiz-run and answer workflow. The map highlights that code: hosts start and control quiz runs; participants submit answers; the backend stores run snapshots and answers, then aggregates results. The README says authentication, Room/QuestionSet APIs, and live WebSocket/STOMP connections are not yet implemented. Several workflow links are directly evidenced by excerpts; other quiz-service calls are supported by the source index, while unsampled runtime integrations are omitted.
Main entry points: QuizCoreTxService.java Quiz transactions · QuizResultService.java Result aggregation · AnswerTxService.java Answer transactions · RunQuestionRepository.java Question repository
Components 25
Quiz endpoints
- Run controller
src/main/java/com/sahmhoot/quiz/controller/QuizRunController.java - Answer handler
src/main/java/com/sahmhoot/quiz/controller/QuizAnswerMessageController.java
Quiz workflow
- Quiz coordinator
src/main/java/com/sahmhoot/quiz/service/QuizCoreService.java - Quiz transactions
src/main/java/com/sahmhoot/quiz/service/QuizCoreTxService.java - Answer service
src/main/java/com/sahmhoot/quiz/service/AnswerService.java - Answer transactions
src/main/java/com/sahmhoot/quiz/service/AnswerTxService.java - Result aggregation
src/main/java/com/sahmhoot/quiz/service/QuizResultService.java - Room lock
src/main/java/com/sahmhoot/quiz/lock/RoomLockManager.java - Question-set port
src/main/java/com/sahmhoot/quiz/service/port/QuestionSetPort.java - JDBC question sets
src/main/java/com/sahmhoot/quiz/service/port/JdbcQuestionSetPort.java - Room port
src/main/java/com/sahmhoot/quiz/service/port/RoomPort.java
Quiz state
- Run and question state
src/main/java/com/sahmhoot/quiz/entity/QuizRun.java - Answer state
src/main/java/com/sahmhoot/quiz/entity/Answer.java - Question snapshots
src/main/java/com/sahmhoot/quiz/entity/RunQuestion.java - Choice snapshots
src/main/java/com/sahmhoot/quiz/entity/RunChoice.java - Run repository
src/main/java/com/sahmhoot/quiz/repository/QuizRunRepository.java - Question repository
src/main/java/com/sahmhoot/quiz/repository/RunQuestionRepository.java - Choice repository
src/main/java/com/sahmhoot/quiz/repository/RunChoiceRepository.java - Answer repository
src/main/java/com/sahmhoot/quiz/repository/AnswerRepository.java - Quiz database
Application basics
- Spring application
src/main/java/com/sahmhoot/SahmhootApplication.java - Health endpoint
src/main/java/com/sahmhoot/common/health/HealthController.java - Security config
src/main/java/com/sahmhoot/config/SecurityConfig.java
Other components
- Host
- Participant
Connections 29
- Host → Run controller: starts or controls
src/main/java/com/sahmhoot/quiz/controller/QuizRunController.java - Run controller → Quiz coordinator: delegates to
src/main/java/com/sahmhoot/quiz/controller/QuizRunController.java - Quiz coordinator → Room lock: locks room
src/main/java/com/sahmhoot/quiz/service/QuizCoreService.java - Quiz coordinator → Quiz transactions: runs transaction
src/main/java/com/sahmhoot/quiz/service/QuizCoreService.java - Quiz transactions → Room port: reads or updates room
src/main/java/com/sahmhoot/quiz/service/QuizCoreTxService.java - Quiz transactions → Question-set port: validates and copies set
src/main/java/com/sahmhoot/quiz/service/QuizCoreTxService.java - JDBC question sets → Question-set port: implements port
src/main/java/com/sahmhoot/quiz/service/port/JdbcQuestionSetPort.java - Quiz transactions → Run repository: persists run
src/main/java/com/sahmhoot/quiz/service/QuizCoreTxService.java - Quiz transactions → Question repository: creates and advances questions
src/main/java/com/sahmhoot/quiz/service/QuizCoreTxService.java - Quiz transactions → Choice repository: loads correct choice
src/main/java/com/sahmhoot/quiz/service/QuizCoreTxService.java - Quiz transactions → Result aggregation: requests aggregation
src/main/java/com/sahmhoot/quiz/service/QuizCoreTxService.java - Participant → Answer handler: submits answer
src/main/java/com/sahmhoot/quiz/controller/QuizAnswerMessageController.java - Answer handler → Room port: checks room participant
src/main/java/com/sahmhoot/quiz/controller/QuizAnswerMessageController.java - Answer handler → Answer service: submits answer
src/main/java/com/sahmhoot/quiz/controller/QuizAnswerMessageController.java - Answer service → Room lock: locks room
src/main/java/com/sahmhoot/quiz/service/AnswerService.java - Answer service → Answer transactions: runs transaction
src/main/java/com/sahmhoot/quiz/service/AnswerService.java - Answer transactions → Question repository: checks question
src/main/java/com/sahmhoot/quiz/service/AnswerTxService.java - Answer transactions → Choice repository: validates choice
src/main/java/com/sahmhoot/quiz/service/AnswerTxService.java - Answer transactions → Answer repository: saves and counts answers
src/main/java/com/sahmhoot/quiz/service/AnswerTxService.java - Result aggregation → Run repository: loads run
src/main/java/com/sahmhoot/quiz/service/QuizResultService.java - Result aggregation → Question repository: loads questions
src/main/java/com/sahmhoot/quiz/service/QuizResultService.java - Result aggregation → Choice repository: loads choices
src/main/java/com/sahmhoot/quiz/service/QuizResultService.java - Result aggregation → Answer repository: loads answers
src/main/java/com/sahmhoot/quiz/service/QuizResultService.java - Run repository → Quiz database: reads and writes
- Question repository → Quiz database: reads and writes
- Choice repository → Quiz database: reads and writes
- Answer repository → Quiz database: reads and writes
- Spring application → Health endpoint: serves endpoint
src/main/java/com/sahmhoot/SahmhootApplication.java - Spring application → Security config: loads configuration