A modern, responsive React Next.js frontend application for QuizCraft - an intelligent quiz creation and management platform with beautiful UI/UX and AI-powered features.
π QuizCraft Live Demo
- Fully responsive design for all device sizes
- Tailwind CSS with custom styling and animations
- ShadCN UI components for consistent, accessible interface
- Dark theme optimized for better user experience
- NextAuth.js integration with Google OAuth
- JWT token management with secure cookie storage
- Social login with Google Sign-In
- Session management and protected routes
- User profile management with authentication state
- Intelligent quiz generation using AI
- Topic-based question creation with custom categories
- Automatic scoring calculation for fair assessment
- Create quizzes with intuitive interface
- Join quizzes with codes for easy participation
- ** quiz taking** with progress tracking
- Answer review and analytics with detailed insights
- Leaderboard and scoring system for competitive learning
- Mobile-first approach with progressive enhancement
- Touch-friendly interactions for mobile devices
- Adaptive layouts for tablets and desktops
- Interactive dashboard with quiz statistics
- Real-time notifications using React Hot Toast
- Form validation with React Hook Form
- Loading states and error handling for better UX
- Next.js 15 - React framework with App Router
- React 19 - Modern React with latest features
- TypeScript - Type-safe development experience
- Tailwind CSS - Utility-first CSS framework
- NextAuth.js - Complete authentication solution
- ShadCN UI - UI component Library
- React Hook Form - Performant forms with validation
- React Hot Toast - Beautiful notifications
- Moment.js - Date and time manipulation
- React icons - Beautiful icon library
quizcraft-client/
βββ src/
β βββ app/ # Next.js App Router
β β βββ (withCommonLayout)/ # Layout group
β β β βββ about/ # About page
β β β βββ create-quiz/ # Quiz creation
β β β βββ join-quiz/ # Quiz joining
β β β βββ my-quizzes/ # User's quizzes
β β β β βββ created/ # Created quizzes
β β β β βββ joined/ # Joined quizzes
β β β βββ topics/ # Available topics
β β βββ auth/ # Authentication pages
β β βββ api/ # API routes
β β βββ globals.css # Global styles
β β βββ layout.tsx # Root layout
β βββ components/ # React components
β β βββ auth/ # Authentication components
β β βββ forms/ # Form components
β β βββ quiz/ # Quiz-related components
β β βββ question/ # Question components
β β βββ ui/ # Reusable UI components
β β βββ providers/ # Context providers
β βββ services/ # API service functions
β β βββ auth/ # Authentication services
β β βββ quiz/ # Quiz services
β β βββ topic/ # Topic services
β β βββ user/ # User services
β βββ types/ # TypeScript type definitions
β βββ config/ # Configuration files
β βββ auth.ts # NextAuth configuration
βββ public/ # Static assets
βββ .env # Environment variables
βββ package.json # Dependencies and scripts
βββ tailwind.config.js # Tailwind configuration
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
Make sure you have the following installed:
- Node.js (v18 or higher)
- npm or yarn
- Git
- QuizCraft Server running (see backend README)
-
Clone the repository:
git clone https://github.com/jonayeds/QuizCraft-Client.git cd QuizCraft-Client -
Install dependencies:
npm install # or yarn install -
Set up environment variables:
Create a
.envfile in the root directory:# Server Configuration SERVER_URL=http://localhost:8000/api/v1 LOCAL_SERVER_URL=http://localhost:8000/api/v1 ENVIRONMENT=development # NextAuth Configuration AUTH_SECRET=your-super-secret-nextauth-key-here NEXTAUTH_URL=http://localhost:3000 # Google OAuth Configuration AUTH_GOOGLE_ID=your-google-oauth-client-id AUTH_GOOGLE_SECRET=your-google-oauth-client-secret
-
Set up Google OAuth:
Create Google OAuth Credentials:
- Go to Google Cloud Console
- Create a new project or select existing one
- Enable Google+ API
- Go to Credentials β Create Credentials β OAuth 2.0 Client ID
- Set authorized redirect URIs:
http://localhost:3000/api/auth/callback/google(development)https://your-domain.vercel.app/api/auth/callback/google(production)
- Copy Client ID and Client Secret to your
.envfile
-
Generate NextAuth Secret:
openssl rand -base64 32 # Copy the output to AUTH_SECRET in your .env file
Development mode with hot reload:
npm run dev
# or
yarn devProduction build:
# Build the project
npm run build
# or
yarn build
# Start production server
npm start
# or
yarn startLinting:
npm run lint
# or
yarn lintThe application will start on http://localhost:3000 by default.
| Variable | Description | Required | Default |
|---|---|---|---|
SERVER_URL |
Backend API URL | β Yes | - |
LOCAL_SERVER_URL |
Local backend URL | β No | - |
ENVIRONMENT |
Environment mode | β No | development |
AUTH_SECRET |
NextAuth secret key | β Yes | - |
NEXTAUTH_URL |
Application base URL | β Yes | - |
AUTH_GOOGLE_ID |
Google OAuth Client ID | β Yes | - |
AUTH_GOOGLE_SECRET |
Google OAuth Secret | β Yes | - |
The project uses Tailwind CSS v4 with custom configuration:
- Custom color palette with gradient themes
- Responsive breakpoints for all device sizes
- Custom animations for smooth interactions
- Glassmorphism utilities for modern design effects
- Strict mode enabled for better type safety
- Path aliases configured for clean imports
- Custom type definitions for API responses
- Component prop types for better development experience
- Primary Gradient:
from-[#907CD3] to-[#4d438b] - Glass Effects:
bg-white/10 backdrop-blur-md - Border Styles:
border border-white/20 - Text Hierarchy: White primary, white/80 secondary, white/60 tertiary
Manual testing checklist:
- Authentication flow (login/logout)
- Quiz creation and editing
- Quiz taking and submission
- Responsive design on different devices
- Error handling and loading states
-
Connect your GitHub repository to Vercel
-
Set environment variables in Vercel dashboard:
SERVER_URLβ Your production backend URLAUTH_SECRETβ Your NextAuth secretAUTH_GOOGLE_IDβ Google OAuth Client IDAUTH_GOOGLE_SECRETβ Google OAuth SecretNEXTAUTH_URLβ Your Vercel app URL
-
Update Google OAuth redirect URIs:
- Add your Vercel domain to authorized redirect URIs
- Format:
https://your-app.vercel.app/api/auth/callback/google
-
Deploy automatically on push
# Install Vercel CLI
npm install -g vercel
# Login to Vercel
vercel login
# Deploy
vercelBuild Failures:
- Check all environment variables are set
- Ensure backend server is accessible
- Verify TypeScript types are correct
Authentication Issues:
- Verify Google OAuth credentials
- Check redirect URIs are correctly configured
- Ensure AUTH_SECRET is properly set
API Connection Issues:
- Verify SERVER_URL is correct
- Check CORS configuration on backend
- Ensure backend server is running
Styling Issues:
- Clear Tailwind CSS cache:
npm run build - Check for conflicting CSS classes
- Verify responsive breakpoints
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes with proper TypeScript types
- Test your changes thoroughly
- Commit your changes:
git commit -m 'Add some amazing feature' - Push to the branch:
git push origin feature/amazing-feature
- Open a Pull Request
- Use TypeScript for all new code
- Follow React best practices and hooks patterns
- Use Tailwind CSS for styling (no custom CSS unless necessary)
- Implement proper error handling and loading states
- Write meaningful commit messages
- Add comments for complex logic
Built with β€οΈ for better learning experiences! π