Skip to content

Latest commit

Β 

History

20 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

QuizCraft Client 🌟

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.

Live Demo

πŸ”— QuizCraft Live Demo

πŸš€ Features

🎨 Modern UI/UX

  • 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

πŸ” Authentication System

  • 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

🧠 AI-Powered Quiz Creation

  • Intelligent quiz generation using AI
  • Topic-based question creation with custom categories
  • Automatic scoring calculation for fair assessment

πŸ“Š Quiz Management

  • 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

πŸ“± Responsive Design

  • Mobile-first approach with progressive enhancement
  • Touch-friendly interactions for mobile devices
  • Adaptive layouts for tablets and desktops

🎯 User Experience

  • 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

πŸ› οΈ Tech Stack

  • 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

πŸ“ Project Structure

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

🚦 Getting Started

Prerequisites

Make sure you have the following installed:

  • Node.js (v18 or higher)
  • npm or yarn
  • Git
  • QuizCraft Server running (see backend README)

πŸ“₯ Installation

  1. Clone the repository:

    git clone https://github.com/jonayeds/QuizCraft-Client.git
    cd QuizCraft-Client
  2. Install dependencies:

    npm install
    # or
    yarn install
  3. Set up environment variables:

    Create a .env file 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
  4. 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 .env file
  5. Generate NextAuth Secret:

    openssl rand -base64 32
    # Copy the output to AUTH_SECRET in your .env file

πŸƒβ€β™‚οΈ Running the Application

Development mode with hot reload:

npm run dev
# or
yarn dev

Production build:

# Build the project
npm run build
# or
yarn build

# Start production server
npm start
# or
yarn start

Linting:

npm run lint
# or
yarn lint

The application will start on http://localhost:3000 by default.

πŸ”§ Configuration

Environment Variables

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 -

Tailwind Configuration

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

TypeScript Configuration

  • 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

🎨 Styling Guide

Design System

  • 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

πŸ§ͺ Testing

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

πŸš€ Deployment

Vercel Deployment (Recommended)

  1. Connect your GitHub repository to Vercel

  2. Set environment variables in Vercel dashboard:

    • SERVER_URL β†’ Your production backend URL
    • AUTH_SECRET β†’ Your NextAuth secret
    • AUTH_GOOGLE_ID β†’ Google OAuth Client ID
    • AUTH_GOOGLE_SECRET β†’ Google OAuth Secret
    • NEXTAUTH_URL β†’ Your Vercel app URL
  3. Update Google OAuth redirect URIs:

    • Add your Vercel domain to authorized redirect URIs
    • Format: https://your-app.vercel.app/api/auth/callback/google
  4. Deploy automatically on push

Manual Vercel Deployment

# Install Vercel CLI
npm install -g vercel

# Login to Vercel
vercel login

# Deploy
vercel

πŸ” Troubleshooting

Common Issues

Build 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

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/amazing-feature
  3. Make your changes with proper TypeScript types
  4. Test your changes thoroughly
  5. Commit your changes:
    git commit -m 'Add some amazing feature'
  6. Push to the branch:
    git push origin feature/amazing-feature
  7. Open a Pull Request

Code Style Guidelines

  • 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! πŸŽ“

About

AI based Quiz generation and participation platform

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages