Master money management through gamified lessons, real-time quiz battles, and simulated stock trading.
An AI-powered, gamified financial literacy platform β built for young learners ages 5β25.
Financial literacy is rarely taught in schools, yet it's one of the most critical life skills. MoneyMaster bridges that gap by turning personal finance education into an engaging, game-like experience.
The Problem β Young learners lack access to structured, engaging financial education. Traditional resources are dry, disconnected from real-world scenarios, and fail to sustain motivation.
The Solution β A full-stack gamified learning platform that combines:
- Adaptive AI-driven lessons that personalize content based on individual performance
- Real-time 1v1 quiz battles with ELO-based matchmaking for competitive learning
- Simulated stock trading to practice investment strategies risk-free
- XP, achievements, and leaderboards to drive sustained engagement
- An AI companion mascot (Rupi) that guides learners through their journey
Why It Matters β MoneyMaster transforms passive learning into active mastery through gamification psychology, adaptive intelligence, and real-time social interaction.
![]() |
![]() |
![]() |
| Landing Page | Dashboard | Adaptive Lessons |
![]() |
![]() |
![]() |
| Real-Time Quiz Battles | Leaderboard | Virtual Wallet & Stocks |
Note: Replace placeholder paths with actual screenshots. Recommended size: 1280Γ720px.
| Audience | Use Case |
|---|---|
| Students (Ages 5β25) | Learn budgeting, saving, investing, and financial planning through gamified modules |
| Educators & Parents | Supplement curriculum with an interactive, self-paced financial literacy tool |
| EdTech Enthusiasts | Explore a production-grade reference architecture for gamified learning platforms |
| Developers | Study a full-stack TypeScript monorepo with real-time systems, adaptive AI, and ELO matchmaking |
Server-driven, step-based lessons (info cards + MCQs) that dynamically adapt based on user accuracy, response times, and topic-specific performance telemetry. The system recommends the next optimal lesson in real time.
WebSocket-powered competitive quiz system with three modes β Quick Match, Ranked, and Private Room. Features ELO-based skill matchmaking, adaptive question selection targeting each player's weak areas, and live score updates.
Standard ELO formula with dynamic K-factors (K=40 new, K=32 standard, K=16 elite). Redis sorted-set queue with composite scoring and skill-window relaxation for fair, fast matchmaking.
Redis-backed rate limiting (1 answer per 500ms), answer replay prevention via SETNX locks, tab-switch event recording, and bot-pattern heuristics through response-time variance analysis.
GPT-4o-mini generates financial literacy questions on demand when the question pool drops below threshold. Output is validated with Zod schemas before persisting to the question bank.
Virtual stock trading environment where learners practice buying, selling, and tracking portfolio performance β building real-world investment intuition without risk.
XP leveling system, login streaks, achievement unlocks, virtual wallet with coin rewards, and cross-platform leaderboards to sustain engagement.
An animated SVG companion with multiple emotional states (waving, celebrating, thinking, sad) that provides contextual guidance, celebrates achievements, and enhances the learning experience with sound effects.
OTP-based email verification (Brevo HTTP API), Google OAuth 2.0, JWT Bearer tokens, and password reset flows β all production-ready.
System-aware theme switching with polished glassmorphism UI, smooth gradients, and micro-animations across all pages.
graph TD
A[User Client - React SPA] --> B[REST API - Express 5]
A <-->|WebSocket| C[Socket.io Server]
B --> D[Authentication Middleware]
D --> E[Feature Modules]
E --> F[(MongoDB Atlas)]
C --> G[(Redis Cache)]
E --> H[Adaptive Engine]
H --> I[OpenAI GPT-4o-mini]
E --> J[Brevo Email API]
D --> K[Google OAuth 2.0]
graph TD
A[User Submits MCQ Answer] --> B[Record Telemetry]
B --> C{Performance Analysis}
C -->|Strong| D[Advance Difficulty]
C -->|Weak| E[Reinforce Topic]
D --> F[Adaptive Lesson Selection]
E --> F
F --> G[Serve Next Lesson]
H[Question Pool Low] --> I[GPT-4o-mini Generation]
I --> J[Zod Schema Validation]
J --> K[Persist to QuestionBank]
graph TD
A[Player Joins Queue] --> B[Redis Sorted Set - ELO Score]
B --> C{Skill Window Match}
C -->|Match Found| D[Create Battle Room]
C -->|No Match| E[Relax Skill Window]
E --> C
D --> F[Both Players Ready]
F --> G[Serve Adaptive Questions]
G --> H[Anti-Cheat Validation - Redis SETNX]
H --> I[Score Update via WebSocket]
I --> J{More Questions?}
J -->|Yes| G
J -->|No| K[Calculate ELO Changes]
K --> L[Battle Results + XP Awards]
graph TD
A[GitHub Repository] -->|Auto Deploy| B[Vercel - React SPA]
A -->|Auto Deploy| C[Render - Node.js API]
C --> D[(MongoDB Atlas)]
C --> E[(Redis Cloud)]
C --> F[Brevo Email API]
C --> G[OpenAI API]
B -->|HTTPS| C
| Layer | Technologies |
|---|---|
| Frontend | React 18, TypeScript, Vite 5, Tailwind CSS 3, shadcn/ui, Radix UI Primitives |
| State Management | React Context (Auth, Wallet, Progress, Battle, Socket, Mascot), TanStack React Query v5 |
| Routing & Forms | React Router v6, React Hook Form, Zod v3 validation |
| Charts & UI | Recharts, Lucide Icons, Sonner Toasts, Embla Carousel, next-themes |
| Backend | Node.js, Express 5, TypeScript, Zod v4 validation |
| Real-Time | Socket.io 4 (server + client), Redis Adapter for horizontal scaling |
| Database | MongoDB Atlas, Mongoose 8 ODM |
| Cache & Pub-Sub | Redis (ioredis) β matchmaking queue, anti-cheat, Socket.io adapter |
| AI/ML | OpenAI GPT-4o-mini β adaptive question generation, Zod-validated output |
| Authentication | JWT (jsonwebtoken), Passport.js (Google OAuth 2.0), OTP via Brevo |
| Brevo HTTP API (not SMTP β compatible with Render's port restrictions) | |
| Security | Helmet, CORS, bcryptjs, rate limiting, anti-cheat middleware |
| Logging | Pino + pino-pretty (structured JSON logging) |
| DevOps | Vercel (frontend), Render (backend), MongoDB Atlas, Redis Cloud |
MoneyMaster/
βββ client/ # React SPA (Vite + TypeScript)
β βββ src/
β β βββ components/
β β β βββ mascot/ # Rupi AI companion (SVG + states)
β β β βββ ui/ # shadcn/ui component library
β β βββ contexts/ # React Context providers
β β β βββ AuthContext.tsx # JWT auth state
β β β βββ BattleContext.tsx # Real-time battle state
β β β βββ MascotContext.tsx # Rupi companion logic
β β β βββ ProgressContext.tsx # Learning progress tracking
β β β βββ SocketContext.tsx # Socket.io connection
β β β βββ WalletContext.tsx # Virtual wallet state
β β βββ features/ # Feature-specific components
β β β βββ auth/ # Auth forms & flows
β β β βββ battle/ # Battle UI components
β β β βββ learning/ # Lesson & quiz components
β β β βββ wallet/ # Wallet & stock components
β β βββ hooks/ # Custom React hooks
β β βββ layouts/ # Dashboard layout + navigation
β β βββ lib/ # Utilities & sound engine
β β βββ pages/ # 21 route pages
β β βββ services/ # API client & socket service
β β βββ types/ # TypeScript type definitions
β βββ vercel.json # SPA routing config
β βββ package.json
β
βββ server/ # Express REST API + Socket.io
β βββ src/
β β βββ config/ # App configuration
β β β βββ database.ts # MongoDB connection
β β β βββ env.ts # Environment variables
β β β βββ passport.ts # Google OAuth strategy
β β β βββ redis.ts # Redis client setup
β β β βββ socket.ts # Socket.io + Redis adapter
β β βββ middleware/ # Express middleware
β β β βββ auth.ts # JWT authentication
β β β βββ errorHandler.ts # Global error handler
β β β βββ socketAuth.ts # Socket.io JWT auth
β β β βββ validate.ts # Zod schema validation
β β βββ models/ # Mongoose schemas (14 models)
β β βββ modules/ # Feature modules
β β β βββ adaptive/ # AI lesson engine + LLM
β β β βββ anticheat/ # Anti-cheat service
β β β βββ auth/ # Auth + OTP + OAuth
β β β βββ battle/ # Battle engine (27KB)
β β β βββ matchmaking/ # ELO-based matchmaking
β β β βββ presence/ # Online status tracking
β β β βββ rating/ # ELO rating system
β β β βββ room/ # Private battle rooms
β β β βββ stocks/ # Stock market simulation
β β β βββ wallet/ # Virtual wallet
β β β βββ ... # + learning, leaderboard, etc.
β β βββ scripts/ # Database seed scripts
β β βββ utils/ # Logger, email, helpers
β βββ docs/ # API & frontend contracts
β βββ package.json
β
βββ CLAUDE.md # Project guide & conventions
βββ LICENSE # MIT License
βββ README.md # β You are here
- Node.js β₯ 18.x
- npm β₯ 9.x
- MongoDB β Atlas free tier or local instance
- Redis β Required for battle system, matchmaking, and Socket.io
git clone https://github.com/AneeshaNigam/Gamified_Financial_Learning_Platform.git
cd Gamified_Financial_Learning_PlatformServer (server/.env):
PORT=5000
NODE_ENV=development
MONGODB_URI=mongodb+srv://<user>:<password>@cluster.mongodb.net/
JWT_SECRET=<your-jwt-secret>
JWT_EXPIRES_IN=7d
CLIENT_URL=http://localhost:5173
REDIS_URL=redis://localhost:6379
BREVO_API_KEY=<your-brevo-key>
OPENAI_API_KEY=<your-openai-key> # Optional β enables AI question generation
GOOGLE_CLIENT_ID=<your-google-client-id> # Optional β enables Google OAuth
GOOGLE_CLIENT_SECRET=<your-google-secret>
GOOGLE_CALLBACK_URL=http://localhost:5000/api/auth/google/callbackClient (client/.env):
VITE_API_URL=http://localhost:5000/api# Server
cd server
npm install
npm run seed:all # Seeds modules, lessons, quizzes, achievements, testimonials, question bank
# Client
cd ../client
npm install# Docker (recommended)
docker run -d -p 6379:6379 redis:alpine
# Or install locally via your package manager# Terminal 1 β Backend (port 5000)
cd server && npm run dev
# Terminal 2 β Frontend (port 5173)
cd client && npm run devOpen http://localhost:5173 in your browser.
Authentication
| Method | Endpoint | Auth | Description |
|---|---|---|---|
POST |
/api/auth/signup |
No | Start signup (sends OTP) |
POST |
/api/auth/login |
No | Start login (sends OTP) |
POST |
/api/auth/verify-otp |
No | Verify OTP β receive JWT |
POST |
/api/auth/resend-otp |
No | Resend OTP |
GET |
/api/auth/me |
Yes | Current user profile |
PATCH |
/api/auth/me |
Yes | Update profile |
POST |
/api/auth/forgot-password |
No | Send reset email |
POST |
/api/auth/reset-password/:token |
No | Reset password |
GET |
/api/auth/google |
No | Google OAuth initiation |
Learning Engine
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/api/learning/current |
Yes | Get next adaptive lesson |
POST |
/api/learning/submit |
Yes | Submit MCQ answer |
POST |
/api/learning/complete |
Yes | Complete lesson, get next |
GET |
/api/learning/modules |
Yes | List all modules with progress |
GET |
/api/learning/lessons/:moduleId/:lessonId |
Yes | Get lesson content |
Battle System
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/api/battle/history |
Yes | Battle history |
GET |
/api/battle/analytics/me |
Yes | Personal battle analytics |
GET |
/api/battle/leaderboard |
No | ELO leaderboard |
POST |
/api/battle/rooms |
Yes | Create private room |
POST |
/api/battle/rooms/join |
Yes | Join room by code |
GET |
/api/battle/rating/history |
Yes | ELO rating history |
Wallet & Stocks
| Method | Endpoint | Auth | Description |
|---|---|---|---|
* |
/api/wallet/* |
Yes | Virtual wallet operations |
* |
/api/stocks/* |
Yes | Stock market simulation |
Client β Server
| Event | Payload | Description |
|---|---|---|
queue_join |
{mode} |
Join matchmaking queue |
queue_leave |
β | Leave queue |
battle_ready |
{roomId} |
Signal ready |
answer_submit |
{roomId, questionIndex, selectedOption, responseTimeMs} |
Submit answer |
battle_forfeit |
{roomId} |
Forfeit battle |
visibility_change |
{battleId, hidden} |
Anti-cheat tab tracking |
heartbeat |
β | Presence ping |
Server β Client
| Event | Payload | Description |
|---|---|---|
match_found |
{roomId, battleId, opponent} |
Match created |
battle_start |
{roomId, question, questionIndex, totalQuestions} |
Battle begins |
score_update |
{scores, lastAnswer} |
Live score update |
battle_end |
{winner, scores, xpGained, eloChanges} |
Battle complete |
queue_status |
{position, estimatedWaitSeconds} |
Queue position |
opponent_disconnected |
β | Opponent left |
| Service | Platform | Notes |
|---|---|---|
| Frontend | Vercel | Auto-deploys from main. SPA routing via vercel.json. |
| Backend | Render | Node.js service. Build: npm run build β Start: npm run start. |
| Database | MongoDB Atlas | Free M0 cluster. |
| Cache | Redis Cloud | Required for matchmaking, anti-cheat, Socket.io adapter. |
| Brevo | HTTP API (Render blocks SMTP ports). |
Contributions are welcome. Please follow these guidelines:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Use Pino logger β never
console.log - Validate all inputs with Zod schemas
- Follow the module pattern (
controller β service β routes β schema) - Use
asyncHandlerwrapper for all async controllers - Throw
ApiError(statusCode, message)for error responses
This project is licensed under the MIT License β see the LICENSE file for details.
Built with β€οΈ for financial literacy





