XP engine
handleGamificationEvent() integrated in 7 routes (lesson complete, quiz, chat tutor, forum post/reply, live class join, assignment submit).
Default rules:
- lessonComplete: 50, quizPass: 30, quizPassFirstTry: 50
- assignmentSubmit: 40, forumPostCreate: 10, forumReplyCreate: 5
- chatTutorMessage: 2, liveClassJoin: 20, dailyLogin: 5
- Streak bonus: 7d=+100, 30d=+500
Levels
Configurable thresholds (default: level N = 100 × N²). Level up triggers the level_up automation event + push notification (mobile). The badge_earned event is emitted when a badge is awarded.
Badges — 11 criterion types
lesson_count, module_count, course_count, xp_threshold, streak_days, mastery_avg, quiz_perfect_count, forum_post_count, study_minutes, badge_collection, compound.
Compound (AND/OR, max depth 3) supported.
Manual badges use criteriaType=manual and can be awarded by authorized teachers/admins; manual is not an automatic criterion type.
Open Badges 3.0
Public page /badges/verify/[userBadgeId] (no auth). Open Badges 3.0-compatible JSON-LD (W3C VC data model) at /api/badges/verify/[userBadgeId], with schema.org EducationalOccupationalCredential. Authenticity is verified via the public URL/API + platform registry — cryptographic proof/signature is not issued yet (roadmap). LinkedIn sharing is manual via the public URL (no native 1-click button yet).
Leaderboards
Redis ZSET. Scopes: course, class_group. Windows: alltime, weekly, monthly. Anonymous mode available.
Contests
Lifecycle draft → active → ended (cron auto-start/end). 7 metrics. Scope course/class/tenant.
Rewards shop
certificate_template, profile_customization, badge_special, virtual_item. Atomic redemption (anti-race). Refund on admin denial.
Gamification AI agent
Admin creates/manages gamification via chat. 19 tools. Loop tool_use max 15 iterations.
Parent reports
Integrated in advanced-reports.ts. Parent portal shows badge grid + streak counter. LLM report cites: "Maria completed 3 courses and earned 5 badges this month".