Skip to content

segfal/Quizify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

49 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Quizify - Interactive Learning Platform

A real-time collaborative learning platform built with Next.js, featuring interactive quizzes, collaborative whiteboarding, and live chat functionality.

๐Ÿš€ Features

Interactive Quiz System

  • Real-time Multiplayer

    • Synchronized quiz sessions across all participants
    • Live player status updates
    • Dynamic score adjustments
    • Real-time answer validation
  • Scoring System

    • Time-based point calculation (faster answers = more points)
    • Streak bonuses (up to 4x multiplier)
    • Power-up modifiers
    • Achievement points
  • Achievement System

    • First correct answer badge
    • Streak achievements (3, 5, 10 correct answers)
    • Speed demon (quick answers)
    • Perfect score recognition
  • Power-ups

    • Time freeze (pause timer)
    • Double points
    • 50/50 (remove two wrong answers)
    • Answer shield (prevent point loss)

Collaborative Whiteboard

  • Drawing Tools

    • Freehand pen with adjustable width
    • Shape tools (rectangle, circle, line)
    • Text insertion with font sizing
    • Smart eraser tool
    • Selection and move functionality
  • Real-time Features

    • Synchronized drawing across all users
    • Cursor position tracking
    • Layer management
    • Undo/Redo support

Live Chat

  • Message System
    • Real-time message delivery
    • Message history persistence
    • User typing indicators
    • Read receipts

๐Ÿ’ก System Architecture

Frontend Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  Next.js Frontend                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Pages      โ”‚    Components       โ”‚    Services      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ - App Routerโ”‚ - Quiz Components   โ”‚ - Socket Service โ”‚
โ”‚ - API Routesโ”‚ - Room Components   โ”‚ - Auth Service   โ”‚
โ”‚ - Layouts   โ”‚ - UI Components     โ”‚ - State Mgmt    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Data Flow

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Client  โ”‚โ—„โ”€โ”€โ–บโ”‚  Socket  โ”‚โ—„โ”€โ”€โ–บโ”‚  Server   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
     โ–ฒ               โ–ฒ               โ–ฒ
     โ”‚               โ”‚               โ”‚
     โ–ผ               โ–ผ               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Supabase โ”‚โ—„โ”€โ”€โ–บโ”‚  State   โ”‚โ—„โ”€โ”€โ–บโ”‚  Database โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ”ง Technical Stack

Frontend Technologies

  • Framework: Next.js 14 (App Router)
  • Language: TypeScript 5.x
  • Styling: Tailwind CSS 3.4
  • State Management: React Context + Hooks
  • Real-time: Socket.IO Client 4.8
  • UI Components:
    • Framer Motion (animations)
    • Lucide React (icons)
    • Sonner (toasts)
    • React-PDF (document viewing)

Backend Services

  • Authentication: Supabase Auth
  • Database: Supabase PostgreSQL
  • Real-time: Socket.IO Server
  • File Storage: Supabase Storage

Development Tools

  • Package Manager: npm
  • Linting: ESLint
  • Type Checking: TypeScript
  • Code Formatting: Prettier
  • Version Control: Git
  • CI/CD: Netlify

๐Ÿ— Project Structure

client/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ app/                          # Next.js app router pages
โ”‚   โ”‚   โ”œโ”€โ”€ dashboard/               # Dashboard related pages
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ page.tsx            # Dashboard main page
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ room/              # Room-specific components
โ”‚   โ”‚   โ”‚       โ”œโ”€โ”€ [roomId]/      # Dynamic room routes
โ”‚   โ”‚   โ”‚       โ”‚   โ””โ”€โ”€ page.tsx   # Individual room page
โ”‚   โ”‚   โ”‚       โ””โ”€โ”€ page.tsx       # Room list page
โ”‚   โ”‚   โ”œโ”€โ”€ login/                 # Authentication pages
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ page.tsx          # Login page
โ”‚   โ”‚   โ””โ”€โ”€ layout.tsx            # Root layout
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ quiz/                  # Quiz-related components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ QuizRoom.tsx      # Main quiz interface
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ QuizTimer.tsx     # Timer component
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ScoreBoard.tsx    # Leaderboard component
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Achievements.tsx  # Achievement display
โ”‚   โ”‚   โ”œโ”€โ”€ room/                 # Room-related components
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Whiteboard.tsx    # Collaborative whiteboard
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Chat.tsx         # Live chat component
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ RoomHeader.tsx   # Room header with controls
โ”‚   โ”‚   โ””โ”€โ”€ ui/                  # Shared UI components
โ”‚   โ”‚       โ”œโ”€โ”€ Button.tsx       # Custom button component
โ”‚   โ”‚       โ”œโ”€โ”€ Input.tsx        # Form input component
โ”‚   โ”‚       โ””โ”€โ”€ Modal.tsx        # Modal dialog component
โ”‚   โ”œโ”€โ”€ contexts/                # React contexts
โ”‚   โ”‚   โ”œโ”€โ”€ SupabaseContext.tsx  # Supabase auth context
โ”‚   โ”‚   โ””โ”€โ”€ SocketContext.tsx    # Socket.IO context
โ”‚   โ”œโ”€โ”€ hooks/                   # Custom React hooks
โ”‚   โ”‚   โ”œโ”€โ”€ useSocket.ts        # Socket.io connection hook
โ”‚   โ”‚   โ”œโ”€โ”€ useAuth.ts          # Authentication hook
โ”‚   โ”‚   โ””โ”€โ”€ useRoom.ts          # Room management hook
โ”‚   โ”œโ”€โ”€ types/                  # TypeScript type definitions
โ”‚   โ”‚   โ”œโ”€โ”€ quiz.ts            # Quiz-related types
โ”‚   โ”‚   โ”œโ”€โ”€ room.ts           # Room-related types
โ”‚   โ”‚   โ””โ”€โ”€ user.ts          # User-related types
โ”‚   โ”œโ”€โ”€ utils/                # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ api.ts           # API helper functions
โ”‚   โ”‚   โ”œโ”€โ”€ socket.ts        # Socket helper functions
โ”‚   โ”‚   โ””โ”€โ”€ validation.ts    # Form validation
โ”‚   โ””โ”€โ”€ styles/              # Global styles
โ””โ”€โ”€ public/                  # Static assets
    โ”œโ”€โ”€ images/             # Image assets
    โ””โ”€โ”€ sounds/            # Sound effects

๐Ÿ”Œ Socket Events

Quiz Events

interface QuizEvents {
  // Emitted when starting a new quiz
  'start_quiz': (data: { roomId: string }) => void;
  
  // Emitted when submitting an answer
  'quiz_answer': (data: {
    roomId: string;
    questionId: number;
    answer: number;
    timeLeft: number;
    points: number;
    multiplier: number;
  }) => void;
  
  // Received when scores are updated
  'score_update': (players: Player[]) => void;
  
  // Received when achievement is unlocked
  'achievement_unlocked': (achievement: Achievement) => void;
  
  // Received when power-up is activated
  'powerup_received': (powerUp: PowerUp) => void;
}

๐Ÿ” Authentication Flow

sequenceDiagram
    participant User
    participant Client
    participant Supabase
    participant Database

    User->>Client: Enter credentials
    Client->>Supabase: Sign in request
    Supabase-->>Database: Validate user
    Database-->>Supabase: User data
    Supabase-->>Client: JWT token
    Client->>Client: Store session
    Client-->>User: Redirect to dashboard
Loading

๐ŸŽฎ Game Mechanics

Quiz System

  • Points calculation based on answer speed and accuracy
  • Streak multipliers (up to 4x)
  • Achievement tracking
  • Power-up system
  • Real-time leaderboard updates

Whiteboard Tools

  • Freehand drawing
  • Shape tools (rectangle, circle)
  • Text tool
  • Eraser
  • Color picker
  • Clear canvas

๐Ÿš€ Deployment

The application can be deployed on Netlify:

  1. Connect your repository to Netlify
  2. Configure build settings:
    • Build command: npm run build
    • Publish directory: .next
  3. Set environment variables in Netlify dashboard
  4. Enable automatic deployments

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Open a Pull Request

๐Ÿ“ License

MIT License

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages