How syedwasif1234/quizmaster works
QuizMaster is a role-aware quiz authoring and play application with a separate real-time 1v1 battle mode. Users authenticate, browse categories and quizzes, answer questions, and submit quiz attempts; faculty/admin capabilities cover content management. In the battle flow, a player creates or joins a room, the server loads a quiz, stores transient room state in Redis, validates answers, and broadcasts progress and results. The tree and README establish the major subsystems; unsampled page and controller wiring is represented only where documented or visible in sampled source.
Main entry points: index.js HTTP and socket server · App.jsx App routing · quiz.controller.js Quiz management · socketHandler.js Battle event handler
Components 21
Web client
- App routing
frontend/src/App.jsx - Auth state
frontend/src/store/useAuthStore.js - Category state
frontend/src/store/useCategoryStore.js - Quiz state
frontend/src/store/useQuiz_QuesStore.js - Battle state
frontend/src/store/useSocketStore.js - Login and signup
frontend/src/pages/LoginPage.jsx - Quiz pages
frontend/src/pages/HomePage.jsx - Battle pages
frontend/src/pages/BattleMode.jsx - HTTP client
frontend/src/lib/axios.js
Identity and access
- Auth routes
backend/src/auth/auth.router.js - Auth operations
backend/src/auth/auth.controller.js - Session guard
backend/src/middleware/auth.middleware.js - Role checks
backend/src/middleware/admin&faculty.middleware.js
Quiz content
- Category management
backend/src/category/category.controller.js - Quiz management
backend/src/quiz/quiz.controller.js - Question and scoring
backend/src/questions/questions.controller.js - PostgreSQL via Prisma
backend/src/lib/db.js
Live battles
- Battle event handler
backend/src/socket/socketHandler.js - Redis room state
backend/src/lib/redis.js
Other components
- User
- HTTP and socket server
backend/src/index.js
Connections 28
- User → App routing: uses
- App routing → Login and signup: routes to
- App routing → Quiz pages: routes to
- App routing → Battle pages: routes to
- App routing → Auth state: checks session
- Login and signup → Auth state: updates auth
- Auth state → HTTP client: sends requests
- HTTP client → HTTP and socket server: HTTP requests
- HTTP and socket server → Auth routes: mounts routes
- Auth routes → Session guard: guards routes
- Auth routes → Auth operations: dispatches
- Auth operations → PostgreSQL via Prisma: reads and writes
- HTTP and socket server → Category management: mounts category API
- HTTP and socket server → Quiz management: mounts quiz API
- HTTP and socket server → Question and scoring: mounts question API
- Category management → PostgreSQL via Prisma: reads and writes
- Quiz management → PostgreSQL via Prisma: reads and writes
- Question and scoring → PostgreSQL via Prisma: reads and writes
- Quiz management → Question and scoring: loads quiz data
- HTTP and socket server → Battle event handler: initializes sockets
- Battle event handler → Quiz management: fetches quiz
- Battle event handler → Redis room state: stores room state
- Battle state → Battle event handler: socket events
- Battle pages → Battle state: uses battle state
- Quiz pages → Category state: browses categories
- Quiz pages → Quiz state: uses quiz state
- Role checks → Category management: restricts actions
- Role checks → Quiz management: restricts actions