This is a full-stack Quiz Platform with:
- Frontend: React with Vite (running on port 5173)
- Backend: Spring Boot microservices (running on port 8080)
- Auth Service (authentication)
- Quiz Service (quiz management)
- Attempt Service (quiz attempts and results)
- Discovery Service (service discovery)
- Gateway Service (API gateway)
cd quiz-platform
docker-compose up -dThis will start all backend services automatically.
cd quiz-platform/quiz-frontend
npm install
npm run dev# Terminal 1 - Auth Service
cd quiz-platform/auth-service
mvn spring-boot:run
# Terminal 2 - Quiz Service
cd quiz-platform/quiz-service
mvn spring-boot:run
# Terminal 3 - Attempt Service
cd quiz-platform/attempt-service
mvn spring-boot:run
# Terminal 4 - Discovery Service (Optional)
cd quiz-platform/discovery-service
mvn spring-boot:run
# Terminal 5 - Gateway Service (Optional)
cd quiz-platform/gateway-service
mvn spring-boot:run| Service | URL |
|---|---|
| Frontend | http://localhost:5173 |
| Backend | http://localhost:8080 |
💡 Tip: All backend services are accessible via the Gateway at port 8080.
quiz-platform/
├── quiz-frontend/ # React frontend
│ ├── src/
│ │ ├── api/ # API service layer
│ │ ├── components/ # Reusable components
│ │ ├── context/ # React context (auth)
│ │ ├── pages/ # Page components
│ │ ├── App.jsx # Main app with routes
│ │ └── main.jsx # Entry point
│ ├── QUICK_START.md
│ └── package.json
│
├── auth-service/ # Spring Boot auth service
│ └── src/main/java/com/aryan/
│
├── quiz-service/ # Spring Boot quiz service
│ └── src/main/java/com/aryan/
│
├── attempt-service/ # Spring Boot attempt service
│ └── src/main/java/com/aryan/
│
├── discovery-service/ # Service discovery (Eureka)
│ └── src/main/java/com/aryan/
│
├── gateway-service/ # API Gateway
│ └── src/main/java/com/aryan/
│
├── TESTING_GUIDE.md # Detailed testing guide
└── docker-compose.yml # Docker configuration
-
Authentication
- User registration with email and password
- User login with JWT token
- Persistent login (token stored in localStorage)
- Logout with token cleanup
-
Authorization
- Protected routes (require authentication)
- Public routes (accessible to all)
- Route redirects based on auth status
- Automatic redirect to login on 401
-
Quiz Functionality
- Browse all available quizzes
- View quiz cards with details (title, description, question count, difficulty)
- Take quizzes one question at a time
- Select answers with radio buttons
- Navigate between questions (Previous/Next buttons)
- Jump to specific questions
- Submit quiz answers
- View immediate results
-
Results
- Display score percentage with color-coded status
- Show correct/incorrect answer counts
- Display time taken
- Review all questions with correct answers
- Navigate back to quizzes
-
User Dashboard
- View attempt history in a professional table
- See quiz name, date, score, status, and time taken
- Access detailed results for any attempt
-
UI/UX
- Responsive navigation bar with mobile menu
- Mobile-friendly design (works on phones/tablets)
- Professional styling with gradients and animations
- Loading indicators
- Error handling and messages
- Form validation
POST /auth/register
Body: { email, password }
Response: { token, user }
POST /auth/login
Body: { email, password }
Response: { token, user }
GET /quiz
Response: [{ id, title, description, questionCount, difficulty, ... }]
GET /quiz/:id
Response: { id, title, questions: [{ id, text, options: [...] }] }
GET /attempt
Response: [{ id, quizId, quizTitle, correctAnswers, totalQuestions, createdAt, ... }]
POST /attempt
Body: { quizId, answers: [{ questionId, selectedOptionId }] }
Response: { attemptId, id, ... }
GET /attempt/:attemptId
Response: { correctAnswers, totalQuestions, reviewAnswers, ... }
/- Home page/login- Login (redirects to /quizzes if already logged in)/register- Register (redirects to /quizzes if already logged in)*- 404 Not Found
/quizzes- Browse all quizzes/quiz/:id- Take a quiz/result/:attemptId- View quiz results/attempts- View attempt history
- Open browser: http://localhost:5173
- Register: Create new account
- Login: Login with your account
- Browse: View available quizzes
- Take Quiz: Answer all questions and submit
- View Result: See your score and review answers
- History: View all your attempts
- Logout: Logout and verify redirect to login
User fills form → POST /auth/register → Token received → Redirect to /login
User enters credentials → POST /auth/login → Token stored in localStorage
→ JWT added to axios headers → Redirect to /quizzes
User accesses /quizzes → Check AuthContext.isAuthenticated
→ True: Show page | False: Redirect to /login
User clicks logout → Remove token from localStorage → Update AuthContext
→ Clear axios Authorization header → Redirect to /login
Protected API call returns 401 → Remove token → Redirect to /login
- React 18 - UI framework
- Vite - Build tool
- React Router v6 - Client-side routing
- Axios - HTTP client
- CSS3 - Styling (no external CSS framework)
- Spring Boot - Framework
- Spring Security - Authentication
- JWT - Token-based auth
- Spring Data JPA - Database ORM
- MySQL/PostgreSQL - Database
- Docker - Containerization
- Docker Compose - Multi-container orchestration
- Frontend Setup: See
quiz-frontend/QUICK_START.md - Testing Guide: See
TESTING_GUIDE.md - Backend Setup: See respective service README files
# Check if port is in use
lsof -i :5173
# Kill process on that port
kill -9 <PID>
# Restart
npm run dev# Check if backend is running
curl http://localhost:8080/quiz
# Check service logs for errors
# In backend terminal, look for exception messages// In browser console:
localStorage.getItem('token') // Should return JWT
localStorage.clear() // Clear auth data
location.reload() // Refresh page- Ensure backend has CORS configuration
- Check browser console for specific errors
- Verify backend URL in axiosInstance
- Verify quiz data exists in backend database
- Check network tab in DevTools for failed requests
- Look at backend logs for database errors
- Frontend running on http://localhost:5173
- Backend services running on http://localhost:8080
- No errors in browser console
- Navbar visible at top of page
- Can register new account
- Can login with credentials
- Token stored in localStorage after login
- User email shows in navbar
- Can logout and return to login
- Unauthenticated users redirected to /login
- Authenticated users redirected from /login to /quizzes
- Can access /quizzes when logged in
- Cannot access /quizzes when logged out
- Quizzes load and display as cards
- Can click quiz card to start quiz
- Questions display one at a time
- Can navigate between questions
- Can select answers
- Cannot submit without answering all
- Results page shows score percentage
- Results page shows correct/total count
- Can see review of answers
- Can return to quizzes from result page
- Can access history page
- Attempts show in table format
- Can view result from history
- Works on desktop (1920px+)
- Works on tablet (768px-1024px)
- Works on mobile (320px-480px)
- Hamburger menu appears on small screens
// In main.jsx:
import { AuthProvider } from './context/AuthContext'
import React from 'react'
// Add React.StrictMode to catch issues- Open DevTools (F12)
- Go to Network tab
- Perform action
- Check request/response
// In browser console:
// Check what's being sent
// Check response status
// Check Authorization header- Look for error messages in backend terminal
- Check database connectivity
- Verify JWT signing key configuration
- React Router: https://reactrouter.com/
- Axios: https://axios-http.com/
- Spring Boot: https://spring.io/projects/spring-boot
- JWT: https://jwt.io/
- Vite: https://vitejs.dev/
- Passwords should be hashed on backend (never store plaintext)
- JWT tokens should have expiration time
- Implement refresh token mechanism for production
- Add rate limiting to authentication endpoints
- Validate all inputs on both frontend and backend
- Use HTTPS in production (not HTTP)
- Store sensitive data in environment variables
Once everything is running and you can:
- Register and login
- Browse quizzes
- Take a quiz
- See results
- View attempt history
Congratulations! Your Quiz Platform is fully functional! 🚀
Last Updated: January 25, 2026 Version: 1.0.1