How push-pray/quizzer works
1. Overall shape
- This is a single monorepo with two main runtime pieces: a Spring Boot backend in src/main/java and a React + TypeScript frontend under src/main/resources/Quizz.
- In development, the frontend runs as a separate Vite app; in deployment, it is packaged alongside the backend and served from the same codebase.
2. Backend boundary
- The backend exposes the application’s core quiz functionality through REST controllers in com.example.quizzer.RESTController.
- Main API areas are categories, quizzes, questions, and reviews. The README also documents answer submission endpoints used by the quiz-taking flow.
3. Layered backend architecture
- The backend follows a standard Spring layering:
- model/: JPA entities such as Category, Quizz, Question, Review, User
- repository/: Spring Data JPA persistence interfaces
- service/: business logic and transaction orchestration
- RESTController/: HTTP entry points
- DTO/ and mapper/: API payload shaping and entity-to-DTO conversion via MapStruct
4. Core data flow
- Requests come from the frontend to a REST controller.
- The controller delegates to a service.
- The service reads/writes entities through repositories.
- Responses are usually returned as DTOs rather than raw entities, which keeps the API contract separate from persistence structure.
5. Domain model
- The central business object is the quiz (Quizz in code), which belongs to a category, contains questions, and can have reviews.
- User exists as a model, though the repo tree does not show a dedicated auth subsystem.
- The README’s ER diagram matches this: Category -> Quizz -> Question/Review.
6. Question and quiz composition
- Question is a key entity for both quiz creation and quiz-taking.
- The DTO set includes QuestionDTO, QuestionInfoDTO, QuestionResultDTO, AnswerResultDTO, OptionDTO, and quiz/teacher info DTOs, which suggests the system distinguishes:
- edit-time quiz/question representations
- student-facing quiz delivery
- result and grading views
- Mappers (QuestionMapper, QuizzMapper) bridge these representations.
7. Frontend structure
- The frontend is organized by role:
- TeacherDashboard/ for creating and editing quizzes, questions, and categories
- StudentDashboard/ for browsing published quizzes, answering questions, and reviewing results
- The app entry points are main.tsx and App.tsx, with shared API helper files such as quizzapi.ts, questionapi.ts, reviewapi.ts, and categoryapi.ts.
8. Frontend-to-backend interaction
- The React app does not appear to own business logic; it is primarily a presentation layer that calls backend REST APIs.
- Separate API helper modules encapsulate HTTP access, which keeps components focused on UI state and navigation.
- The frontend routes described in the README map directly to quiz management and quiz-taking screens.
9. Seed data and startup behavior
- SampleDataService initializes sample quizzes/questions at startup, which is important for local development and demo usage.
- This means the backend has a built-in bootstrap path for initial content rather than depending on manual database seeding.
10. Persistence and environments
- Local development uses H2 in-memory database.
- Production is configured for PostgreSQL and there is a separate application-rahti.properties, indicating deployment-specific configuration.
- The repository also includes a Dockerfile, so containerized deployment is part of the architecture.
11. Testing boundary
- Tests are focused on REST behavior and run against H2 in src/test/resources.
- The test suite includes controller tests for categories, questions, quizzes, and answer flow, which suggests the primary verification strategy is API-level integration testing rather than isolated unit tests.
12. Diagramming takeaway
- If you draw the architecture, the clearest boundaries are:
- React UI on top
- REST API layer in the Spring Boot app
- service + repository + JPA entity layers in the backend
- H2/PostgreSQL as persistence
- sample data bootstrapping as a startup-only path
- tests as a separate verification track against the API and in-memory DB
Main entry points: RESTController REST API · repository Repositories · main.tsx React app · quizzer API tests
Components 16
Backend
Spring Boot API, domain, and persistence layers
- Quizzer app · Main backend application bootstrap
src/main/java/com/example/quizzer/QuizzerApplication.java - REST API · Quiz, category, question, and review endpoints
src/main/java/com/example/quizzer/RESTController - Services · Transaction and orchestration logic
src/main/java/com/example/quizzer/service - Repositories · Spring Data repositories for domain entities
src/main/java/com/example/quizzer/repository - Domain model · Category, Quizz, Question, Review, User
src/main/java/com/example/quizzer/model - DTOs · Request and response shapes for quiz flows
src/main/java/com/example/quizzer/DTO - Mappers · Entity-to-DTO conversion for quizzes and questions
src/main/java/com/example/quizzer/mapper - Sample data · Bootstraps demo quizzes and questions on startup
src/main/java/com/example/quizzer/SampleDataService.java
Frontend
React + TypeScript quiz UI
- React app · Frontend entry and application shell
src/main/resources/Quizz/src/main.tsx - Teacher UI · Quiz, question, and category management views
src/main/resources/Quizz/src/components/TeacherDashboard - Student UI · Browsing, answering, and review views
src/main/resources/Quizz/src/components/StudentDashboard - API clients · Frontend modules for category, quiz, question, and review requests
src/main/resources/Quizz/src
Runtime
Packaging and deployment configuration
- Packaging · Container and environment-specific Spring configuration
Dockerfile - App config · Local and deployment property sets
src/main/resources
Tests
API-level verification against in-memory DB
- API tests · Controller tests for categories, quizzes, questions, and answers
src/test/java/com/example/quizzer - Test config · Test-only application properties for in-memory execution
src/test/resources/application.properties
Connections 18
- Quizzer app → REST API: exposes · Application wires REST entry points
- REST API → Services: delegates · Controllers call service methods
- Services → Repositories: reads/writes · Business logic persists via repositories
- Repositories → Domain model: maps · Repositories manage entity state
- Services → DTOs: returns · Services shape API data through DTOs
- Mappers → Domain model: converts · Maps entities into transfer objects
- Mappers → DTOs: converts · Produces API payload shapes
- REST API → Mappers: uses · Controllers rely on mapping for responses
- Sample data → Repositories: initializes · Loads starter content at startup
- Sample data → Domain model: creates · Seeds demo domain records
- React app → API clients: calls · UI uses request helpers for backend access
- API clients → REST API: requests · Frontend talks to REST endpoints
- React app → Teacher UI: renders · Teacher dashboard screens
- React app → Student UI: renders · Student dashboard screens
- Packaging → App config: packages · Containerized deployment uses Spring config
- API tests → REST API: verifies · Tests exercise REST behavior
- API tests → Test config: runs with · Tests use in-memory database config
- API tests → Repositories: covers · API tests implicitly validate persistence flows