A real-time collaborative learning platform built with Next.js, featuring interactive quizzes, collaborative whiteboarding, and live chat functionality.
-
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)
-
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
- Message System
- Real-time message delivery
- Message history persistence
- User typing indicators
- Read receipts
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Next.js Frontend โ
โโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโค
โ Pages โ Components โ Services โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโค
โ - App Routerโ - Quiz Components โ - Socket Service โ
โ - API Routesโ - Room Components โ - Auth Service โ
โ - Layouts โ - UI Components โ - State Mgmt โ
โโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโ
โ Client โโโโโบโ Socket โโโโโบโ Server โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโ
โฒ โฒ โฒ
โ โ โ
โผ โผ โผ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโ
โ Supabase โโโโโบโ State โโโโโบโ Database โ
โโโโโโโโโโโโ โโโโโโโโโโโโ โโโโโโโโโโโโโ
- 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)
- Authentication: Supabase Auth
- Database: Supabase PostgreSQL
- Real-time: Socket.IO Server
- File Storage: Supabase Storage
- Package Manager: npm
- Linting: ESLint
- Type Checking: TypeScript
- Code Formatting: Prettier
- Version Control: Git
- CI/CD: Netlify
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
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;
}
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
- Points calculation based on answer speed and accuracy
- Streak multipliers (up to 4x)
- Achievement tracking
- Power-up system
- Real-time leaderboard updates
- Freehand drawing
- Shape tools (rectangle, circle)
- Text tool
- Eraser
- Color picker
- Clear canvas
The application can be deployed on Netlify:
- Connect your repository to Netlify
- Configure build settings:
- Build command:
npm run build
- Publish directory:
.next
- Build command:
- Set environment variables in Netlify dashboard
- Enable automatic deployments
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
MIT License