This is a Next.js project bootstrapped with create-next-app, designed as a Gamified Learning Management System.
Before running the development server, ensure you have installed all necessary dependencies and UI components used in this project.
Run this command to install state management, utility libraries, icons, and visualization tools:
npm install zustand clsx tailwind-merge lucide-react class-variance-authority reactflow
If you haven't initialized Shadcn UI yet, run:
npx shadcn@latest init
This project relies on specific Shadcn UI components. Install them using the following command:
npx shadcn@latest add button card input label progress separator
This project uses Neon (Serverless PostgreSQL) as the database and Drizzle ORM for type-safe database interactions.
Install the ORM, Neon driver, and development tools for migrations:
npm install drizzle-orm @neondatabase/serverless dotenv
npm install -D drizzle-kitCreate a .env file in the root directory. You need to add your Neon connection string here.
Important: Use the "Pooled" connection string from your Neon Dashboard. Ensure there are no psql prefixes or single quotes '.
Cuplikan kode
DATABASE_URL="postgresql://neondb_owner:YOUR_PASSWORD@ep-your-endpoint.aws.neon.tech/neondb?sslmode=require"Whenever you make changes to db/schema.ts, you must push the changes to the Neon database:
npx drizzle-kit pushTo view, edit, or add dummy data to your database using a GUI (similar to phpMyAdmin):
npx drizzle-kit studioThis will open a local web interface to interact with your live Neon database.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.
This project uses next/font to automatically optimize and load Geist, a new font family for Vercel.
Release Date: 4 Januari 2026
โ Live Leaderboard Updates
- Real-time synchronization via WebSocket (Socket.io)
- Zero database polling - event-driven architecture
- In-memory cache for instant updates
- 99.5% bandwidth reduction vs polling approach
โ Connection Status Indicator
- Live indicator badge (green "Live" / red "Offline")
- Auto-reconnection up to 5 attempts
- Visual feedback untuk connection state
- Graceful degradation pada network issues
โ Custom Next.js Server
- Custom server dengan Socket.io integration
- Event handlers:
leaderboard:initial,leaderboard:update,leaderboard:add-user - In-memory cache management
- Broadcast system untuk multi-client sync
Before:
- Rank #1: 300 XP
- Rank #2-10: 62-95 XP (gap terlalu besar โ)
After:
- Rank #1: 300 XP
- Rank #2-10: 120-280 XP (progression lebih realistic โ )
โ Duplicate User Bug
- Fixed: Current user muncul 2x di leaderboard
- Solution: Filter existing user before re-adding
- Impact: Clean leaderboard display
โ State Synchronization
- Fixed: User entry sync between client & server
- Proper cleanup on component unmount
- No memory leaks
Network Efficiency:
- Before: 720 requests/hour (polling every 5s)
- After: Event-driven (only on changes)
- Bandwidth saved: ~10MB โ ~50KB per hour
Responsiveness:
- WebSocket connection: ~200ms
- Update broadcast: <50ms
- UI update latency: <100ms
New Files:
server.js- Custom Next.js server with WebSocketlib/websocket-client.ts- Client wrapper dengan auto-reconnectlib/leaderboard-cache.ts- In-memory cache managerlib/websocket-server.ts- Server-side Socket.io setup
Modified Files:
app/(dashboard)/leaderboard/page.tsx- WebSocket integration + live indicatorlib/evaluation-data.ts- Balanced mock data (120-280 range)package.json- Added Socket.io dependencies
Dependencies Added:
{
"socket.io": "^4.8.3",
"socket.io-client": "^4.8.3"
}Client Browser โโ Socket.io โโ Custom Server โโ In-Memory Cache
โ
Database (event-driven only)
- Visual Feedback: Instant rank updates tanpa refresh
- Live Badge: Shows when connected to real-time server
- Offline Mode: Graceful fallback saat disconnected
- Auto-sync: Multiple tabs auto-update simultaneously
Release Date: 28 Desember 2025
- โ Simplified navigation (removed redundant Profile/More menu)
- โ Scrollable navigation dengan custom scrollbar
- โ Cleaner interface tanpa bottom profile section
- โ Optimized menu items (essential only)
- โ "Remember Me" checkbox functionality restored
- โ Better UX positioning (antara password & login button)
- โ Consistent styling dengan design system
Quiz State Bug (Major):
- โ Fixed: Selecting answer di Q1 mempengaruhi semua soal
- โ Independent state per question
- โ Proper state persistence untuk answered questions
- โ Fresh state untuk unanswered questions
Quiz Answer Visibility:
- โ No spoilers: Correct answer tidak ter-highlight before submit
- โ Proper feedback flow (hanya after submission)
- โ Conditional hover effects
- โ Fixed bottom navbar overlap (pb-24 md:pb-8)
- โ Sticky navigation properly positioned
- โ All content accessible & scrollable di mobile
- โ Removed unnecessary tips sections (Leaderboard, Evaluation)
- โ Cleaner layout tanpa distraction
- โ Focus on core functionality
- โ VSCode settings.json untuk Tailwind CSS
- โ Suppressed CSS lint warnings untuk Tailwind directives
- โ Enhanced IntelliSense & autocomplete
Release Date: November 2025
- โ Login sebagai Mahasiswa atau Dosen
- โ Auto-redirect berdasarkan role
- โ Route protection untuk admin pages
- โ Role persistence di localStorage
Dashboard Features:
- Stats overview (Total Mahasiswa, Aktif, Avg Akurasi, Evaluasi Aktif)
- Recent activity feed dengan real-time updates
- Active evaluations list
- Quick action cards
Course Management:
- Create, edit, delete courses
- Search functionality
- Course stats & difficulty badges
- Lesson management per course
Student Monitoring:
- 20 mock students dengan realistic data
- Search & sort (by XP, accuracy, name)
- Progress tracking & streak monitoring
- Last active timestamps
Evaluations Management:
- List active & completed evaluations
- Stats cards (submissions, avg score)
- Create & edit evaluations
- Close/archive functionality
Analytics & Reports:
- Activity trend charts (7 days)
- Score distribution graphs
- Course popularity metrics
- Top 5 performers list
- Export functionality (CSV/PDF)
- Unified Blue/Cyan color scheme
- Role-based menus
- Gradient active states
- Animated indicators
- Profile section dengan role badge
- 20 realistic mock students
- Linked evaluation results
- Activity logs
- Charts data untuk visualization
New Pages:
/admin- Dashboard home/admin/courses- Course management/admin/students- Student monitoring/admin/evaluations- Evaluations management/admin/analytics- Analytics & reports
Release Date: Oktober 2025
- โ 3 Question Types: Multiple choice, Short answer, True/False
- โ Instant Feedback: Visual response <500ms
- โ Real-time Progress: Score, accuracy, timer
- โ Question Navigation: Next/Previous dengan indicators
- โ Results Page: Comprehensive review
- โ Real-time updates (3-second intervals)
- โ Rank animations dengan smooth transitions
- โ Social comparison (top performers + nearby ranks)
- โ Current user highlight (blue glow + "YOU" badge)
- โ Live indicator dengan pulsing dot
- โ Medal system ๐ฅ๐ฅ๐ฅ untuk top 3
- โ Top 3 podium dengan gradient colors
- โ Stats overview cards
- โ Full rankings dengan scroll
- โ User progress tracking
- โ Quick action shortcuts
New Pages:
/evaluation- Evaluations list/evaluation/[id]- Active evaluation/evaluation/[id]/results- Results review/leaderboard- Standalone leaderboard
New Components:
components/leaderboard/live-leaderboard.tsxcomponents/leaderboard/leaderboard-entry.tsxcomponents/evaluation/question-card.tsx
Release Date: September 2025
- โ Learning path dengan skill tree visualization
- โ Course management (Frontend, React, Backend)
- โ Daily goals dengan XP rewards
- โ Basic gamification (XP, levels, streak)
- โ Profile page dengan stats
- โ Static leaderboard preview
Pages:
/learn- Main learning page/courses- Course list/courses/[id]- Course detail/goals- Daily goals/profile- User profile
Limitations:
- โ No evaluation/quiz system
- โ Static leaderboard only
- โ No real-time updates
- โ No instant feedback
- โ No competitive elements
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!
The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.
Check out our Next.js deployment documentation for more details.