Aplikasi web modern untuk belajar bahasa Inggris melalui latihan terjemahan yang dinilai oleh AI.
- π― Generate Kalimat AI - Kalimat otomatis dengan 3 tingkat kesulitan (Mudah, Sedang, Sulit)
- π Latihan Terjemahan - Terjemahkan kalimat Inggris ke Indonesia
- π€ Evaluasi AI - Score 0-100 dengan feedback konstruktif
- π₯ Quiz & Kuis - Sistem kuis dengan pertanyaan pilihan ganda
- π¬ Komentar & Reaksi Real-Time - Diskusi di blog dengan WebSocket
- π Blog & Artikel - Baca artikel pembelajaran
- π€ User Profile - Simpan progress belajar Anda
- π¨ Modern UI - Desain clean dengan Shadcn/UI
# Clone repository
git clone <repo-url>
cd learnlang
# Install dependencies
npm install# Setup Prisma
npm run db:generate
npm run db:migrate
# Seed sample data (includes 50+ A1 vocabulary items)
npm run db:seedSeed Data Included:
- 50+ A1 vocabulary questions across categories: numbers, colors, body parts, furniture, family, animals, food, professions, transport, clothing, weather, rooms, nature
- All questions optimized for true beginner (A1) level learning
# Download & jalankan Ollama
ollama pull gemma2:2b
ollama serveBuat file .env.local:
# NextAuth
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your-secret-key-here
# Database
DATABASE_URL=mysql://user:password@localhost:3306/learnlang
# Ollama (optional, untuk AI)
OLLAMA_API_URL=http://localhost:11434npm run devThe learning system now uses persistent session architecture for better tracking and scoring:
- Methods Available: Vocabulary, Listening, Grammar
- Session Persistence: Each session stores selected questions and user answers
- Progressive Feedback: Real-time correctness indicators after each answer
- Score Tracking: Final results page with percentage score and detailed review
- History Integration: Completed sessions saved to learning history for progress tracking
Starting a Learning Session:
- Navigate to
/learn - Select a learning method (vocabulary, listening, grammar)
- Choose difficulty level (A1, A2, B1, B2, C1, C2)
- Set number of questions
- Answer each question with instant feedback
- Submit all answers to see results
- Review detailed answer breakdown
Session Flow:
- Session creation:
POST /api/learn/sessionwith{ method, level, limit } - Answer submission:
POST /api/learn/session/[id]with{ answers: { sessionQuestionId: userAnswer } } - Results include: percentage score, total correct, detailed answer review
- Generate kalimat dari AI
- Latihan terjemahan dengan feedback
- Lihat riwayat pembelajaran
- Statistik progress
- Create & manage quiz (admin)
- Solve quiz dengan pilihan ganda
- Auto-scoring & detailed results
- Track quiz progress
- Read articles
- Real-time comments
- Reactions (π β€οΈ π π π€ π)
- Comment & reaction notifications
- Register & login
- Edit profile
- View activity history
- Admin dashboard
- Framework: Next.js 16
- Database: MySQL + Prisma
- Auth: NextAuth.js
- Real-Time: Socket.IO
- AI Model: Gemma2:2b (Ollama)
- UI: Shadcn/UI + Tailwind CSS
- Animation: Framer Motion
npm run dev # Start development server
npm run build # Build for production
npm start # Start production server
npm run lint # Run ESLint
npm run test # Run Jest tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Generate coverage report
npm run db:generate # Generate Prisma client
npm run db:migrate # Run migrations
npm run db:studio # Open Prisma Studio
npm run db:reset # Reset database (dev only)
npm run db:seed # Seed sample dataPOST /api/learn/session
Content-Type: application/json
Body:
{
"method": "vocabulary|listening|grammar",
"level": "A1|A2|B1|B2|C1|C2",
"limit": 5
}
Response (200):
{
"success": true,
"data": {
"session": {
"id": "string",
"userId": "string",
"method": "string",
"level": "string",
"total": 5,
"score": 0,
"status": "IN_PROGRESS",
"createdAt": "ISO datetime"
},
"questions": [
{
"sessionQuestionId": "string",
"question": "string",
"options": { "A": "...", "B": "...", "C": "...", "D": "..." },
"userAnswer": null,
"isCorrect": null
}
]
}
}
POST /api/learn/session/[id]
Content-Type: application/json
Body:
{
"answers": {
"sessionQuestionId1": "A",
"sessionQuestionId2": "B",
"sessionQuestionId3": "C"
}
}
Response (200):
{
"success": true,
"data": {
"session": {
"status": "COMPLETED",
"score": 3,
"total": 5,
"completedAt": "ISO datetime"
},
"results": {
"totalCorrect": 3,
"total": 5,
"percentage": 60,
"details": [
{
"question": "...",
"userAnswer": "A",
"correctAnswer": "B",
"isCorrect": false
}
]
}
}
}
GET /api/learn/session?sessionId=[id]
Response (200):
{
"success": true,
"data": {
"session": { ... },
"questions": [ ... ]
}
}
GET /api/learn/session/[id]
Response (200):
{
"success": true,
"data": {
"session": { ... },
"questions": [ ... ]
}
}
For listening exercises, use the <AudioPlayer /> component:
import AudioPlayer from "@/components/AudioPlayer";
<AudioPlayer audioUrl="/path/to/audio.mp3" title="Listening Exercise 1" />;Features:
- Play/pause with loading indicator
- Progress bar with seek functionality
- Time display and duration
- Buffered progress visualization
- Error handling with fallback UI
- Volume control ready for extension
Email: admin@example.com
Password: admin123
npm test # Run all tests
npm run test:watch # Run in watch mode
npm run test:coverage # Generate coverage reportlib/__tests__/- Unit tests for utilities and APIsapp/api/__tests__/- API endpoint integration tests- Coverage includes: auth, validation, rate limiting, socket events, and learning APIs
Tests for the session-based learning system:
- Session creation with valid/invalid methods
- Question fetching by method
- Answer submission and scoring (100%, 50%, 0%)
- Session completion and history creation
- Edge cases (no questions, already completed, non-existent sessions)
learnlang/
βββ app/ # Next.js app directory
β βββ api/
β β βββ learn/ # Learning API endpoints
β β β βββ [method]/ # GET questions by method
β β β βββ session/ # POST/GET create & fetch sessions
β β β βββ session/[id]/ # GET details, POST submit answers
β β βββ admin/ # Admin endpoints
β β βββ quiz/ # Quiz endpoints
β β βββ ...
β βββ admin/ # Admin pages
β βββ learn/ # Learning module pages
β βββ quiz/ # Quiz pages
β βββ blogs/ # Blog pages
β βββ chats/ # Direct messaging (real-time)
β βββ diskusi/ # Discussion rooms
β βββ friends/ # Friend management
β βββ layout.js # Root layout
β βββ page.js # Home page
βββ components/
β βββ MethodPracticeClient.jsx # Main learning session UI
β βββ AudioPlayer.jsx # Audio player for listening exercises
β βββ ChatWindow.jsx # Chat component
β βββ BlogComments.jsx # Blog comments
β βββ ...
βββ lib/ # Utilities & helpers
β βββ api-response.js # Centralized API response format
β βββ auth.js # NextAuth configuration
β βββ notifications.js # Real-time notifications
β βββ socket.js # Socket.IO helpers
β βββ __tests__/ # Unit tests
βββ prisma/
β βββ schema.prisma # Database models
β βββ seed.js # Seed orchestrator
β βββ seed/
β βββ questions.js # 50+ A1 vocabulary questions
βββ public/ # Static assets
- Login ke aplikasi
- Explore fitur Learning untuk belajar
- Coba Quiz System
- Baca articles di Blog section
- Join komunitas di comments & reactions
LernLang Β© 2026 - Learn English with AI