0
stars
13
commits
TypeScript
primary language
Jun 19, 2026
updated
A gamified AI/ML learning platform. 62 in-depth lessons, 5 quizzes per lesson, an AI tutor powered by Groq, Firebase authentication, cross-device progress sync via MongoDB, a visual skill tree, ML project showcase, foundational research papers, interview prep hub, daily challenges, and a document RAG tutor — all in one dark-themed Next.js app.
https://ai-zen-tutor.vercel.app
Deployed on Vercel. All 11 pages, the AI Tutor (Groq Llama 3.3 70B), Firebase Auth, and the RAG Tutor are fully live and operational.
| Page | Description |
|---|---|
/ | Hero landing, feature grid, curriculum overview, platform explorer |
/learn | Sidebar + lesson view + AI tutor + notes + quiz modal |
/dashboard | XP stats, activity heatmap, skill radar chart, badges |
/roadmap | Visual node-based learning path |
/skill-tree | ML Engineer tree with per-node progress rings |
/projects | 9 end-to-end ML/DL/LLM project cards |
/research | 7 foundational AI papers with expandable summaries |
/interview | 25+ theory, coding, and system design Q&A |
/daily | Rotating daily challenge (ML + coding + interview) |
/rag-tutor | Upload a document, ask questions via RAG |
/about | Creator profile and portfolio |
/login | Sign in — email/password or Google |
/register | Create account — email/password or Google |
Cmd/Ctrl+S to savelocalStorage (instant, no latency) and synced to MongoDB (cross-device)| Page | URL |
|---|---|
| Home / Landing | / |
| Sign In | /login |
| Create Account | /register |
| Learn (62 lessons) | /learn |
| Progress Dashboard | /dashboard |
| Learning Roadmap | /roadmap |
| ML Engineer Skill Tree | /skill-tree |
| ML Projects Showcase | /projects |
| Research Papers | /research |
| Interview Hub | /interview |
| Daily Challenge | /daily |
| RAG Document Tutor | /rag-tutor |
| About | /about |
/projects)9 portfolio-ready projects with architecture, dataset, key results, skills, GitHub links, and live demo links:
| Project | Category | Difficulty |
|---|---|---|
| House Price Prediction | Machine Learning | Beginner |
| Customer Churn Prediction | Machine Learning | Intermediate |
| Movie Recommendation System | Machine Learning | Intermediate |
| Image Classifier (ResNet-50) | Deep Learning | Intermediate |
| Object Detection (YOLOv8) | Deep Learning | Advanced |
| Sentiment Analysis API | NLP | Intermediate |
| RAG Document Chatbot | LLM | Advanced |
| PDF Q&A with Citations | LLM | Advanced |
| AI Research Assistant | LLM | Expert |
/research)7 foundational papers with plain-English summaries, key ideas, applications, and ArXiv links:
/interview)25+ questions filterable by category (ML / DL / NLP / LLM / RAG / MLOps / System Design) and type (Theory / Coding / System Design). Coding answers include full Python implementations.
/daily)Three new questions every 24 hours (rotated from a bank using the day-of-year index):
/rag-tutor)Upload any .txt, .md, .py, .json, .ts, or .csv file — or paste text directly. The system:
/api/chat edge route/skill-tree)Visual ML Engineer tree with collapsible nodes. Each node shows:
Start learning → link that opens /learn filtered to that categoryTree path: Python & Math → Machine Learning → Deep Learning → NLP → LLMs → RAG → [CV | MLOps → Agents]
| Layer | Technology |
|---|---|
| Framework | Next.js 16.2.9 (App Router) |
| Language | TypeScript 5 (strict mode) |
| Styling | Tailwind CSS 3.4 + custom CSS variables |
| Animations | GSAP 3.15 + ScrollTrigger |
| AI / LLM | Groq SDK (groq-sdk) — Llama 3.3 70B Versatile |
| Authentication | Firebase Authentication (Email/Password + Google OAuth) |
| Database | MongoDB Atlas — progress persistence |
| Auth Token Verification | Firebase Admin SDK (server-side) |
| Rendering | Static generation for all pages + Edge runtime for /api/chat |
| State | React useState / useEffect — no external state library |
| Progress Cache | localStorage (primary, instant) + MongoDB (sync, cross-device) |
Ml Tutor/
└── frontend/
├── app/
│ ├── page.tsx # Home / landing page
│ ├── layout.tsx # Root layout (AuthProvider + ProgressSync)
│ ├── globals.css # CSS variables, animations, utilities
│ ├── login/
│ │ └── page.tsx # Sign in (email/password + Google)
│ ├── register/
│ │ └── page.tsx # Create account (email/password + Google)
│ ├── learn/
│ │ └── page.tsx # Main learning page (sidebar + lesson + panels)
│ ├── dashboard/
│ │ └── page.tsx # Progress dashboard
│ ├── roadmap/
│ │ └── page.tsx # Visual learning roadmap
│ ├── skill-tree/
│ │ └── page.tsx # ML Engineer skill tree
│ ├── projects/
│ │ └── page.tsx # ML projects showcase
│ ├── research/
│ │ └── page.tsx # Foundational papers
│ ├── interview/
│ │ └── page.tsx # Interview prep hub
│ ├── daily/
│ │ └── page.tsx # Daily challenge
│ ├── rag-tutor/
│ │ └── page.tsx # Document Q&A via RAG
│ ├── about/
│ │ └── page.tsx # Creator profile
│ └── api/
│ ├── chat/
│ │ └── route.ts # Groq streaming edge API
│ └── progress/
│ └── route.ts # MongoDB progress sync (GET + POST)
├── components/
│ ├── Nav.tsx # Shared sticky nav with auth state (avatar, sign out)
│ ├── AuthProvider.tsx # Firebase auth context + useAuth() hook
│ ├── ProgressSync.tsx # Auto-syncs localStorage → MongoDB on interval
│ ├── AiTutor.tsx # Streaming AI tutor panel
│ ├── QuizModal.tsx # Post-lesson quiz modal
│ ├── NotesPanel.tsx # Per-lesson notes panel
│ ├── LessonView.tsx # Lesson content renderer
│ ├── LearnSidebar.tsx # Left sidebar (search, categories, lessons)
│ └── LessonPage.tsx # Lesson layout wrapper
├── data/
│ ├── curriculum.ts # Lesson metadata (all 62 lessons)
│ ├── types.ts # Shared TypeScript types
│ ├── quizzes.ts # 186 MCQs (3 per lesson, original)
│ ├── quizzes-extra.ts # 124 additional MCQs (2 per lesson)
│ ├── quizzes-all.ts # Merged export (5 per lesson = 310 total)
│ └── lessons/ # Full lesson content per category
│ ├── ml.ts
│ ├── deep-learning.ts
│ ├── nlp.ts
│ ├── llms.ts
│ ├── rag.ts
│ ├── cv.ts
│ ├── mlops.ts
│ └── interview.ts
├── lib/
│ ├── progress.ts # XP, streaks, quizzes, bookmarks, notes + MongoDB sync
│ ├── firebase.ts # Firebase client SDK (auth)
│ ├── firebase-admin.ts # Firebase Admin SDK (server-side token verification)
│ └── mongodb.ts # MongoDB connection pooling
├── types/ # TypeScript declaration files
├── .env.local # API keys (gitignored)
├── package.json
├── tailwind.config.ts
└── tsconfig.json
| Category | Lessons | Key Topics |
|---|---|---|
| Machine Learning | 12 | Gradient Descent, Bias-Variance, SVMs, XGBoost, PCA, K-Means, Evaluation Metrics |
| Deep Learning | 10 | Backprop, CNNs, RNNs/LSTMs, Autoencoders, GANs, Diffusion Models |
| NLP & Transformers | 8 | Tokenization, Word2Vec, BERT, GPT, Fine-tuning, Attention, NER |
| LLMs & Prompting | 8 | Prompt Engineering, RLHF, Tool Use, AI Agents, LangChain, Multi-Agent |
| RAG Systems | 7 | Chunking, Vector DBs, Embedding Models, Hybrid Search, Reranking, Agentic RAG |
| Computer Vision | 6 | Transfer Learning, Object Detection, Segmentation, ViT, Data Augmentation |
| MLOps | 6 | Deployment, Monitoring, Feature Stores, CI/CD, Data Pipelines |
| Interview Prep | 5 | ML / DL / NLP-LLM / System Design / MLOps Interview Questions |
| Action | XP |
|---|---|
| Complete a lesson | +100 XP |
| Correct quiz answer | +25 XP |
| Retake quiz (already done) | No XP (prevents farming) |
| Level | Name | XP Required |
|---|---|---|
| 1 | 🌱 Newcomer | 0 |
| 2 | 📚 Learner | 100 |
| 3 | 🔭 Explorer | 500 |
| 4 | 💻 Developer | 1,500 |
| 5 | ⚙️ Engineer | 3,500 |
| 6 | 🎯 Expert | 7,000 |
| 7 | 🏆 Master | 13,000 |
Maximum XP possible: 62 × 100 + 310 × 25 = 13,950 XP (enough to reach Master)
| Badge | Category |
|---|---|
| 🤖 ML Scholar | Machine Learning |
| 🧠 Deep Thinker | Deep Learning |
| 💬 Language Master | NLP & Transformers |
| ✨ Prompt Engineer | LLMs & Prompting |
| 🔍 RAG Architect | RAG Systems |
| 👁️ Vision Expert | Computer Vision |
| 🚀 MLOps Pro | MLOps |
| 🎤 Job Ready | Interview Prep |
git clone <your-repo-url>
cd "Ml Tutor/frontend"
npm install
Create frontend/.env.local:
# AI
GROQ_API_KEY=your_groq_api_key_here
# Database
MONGODB_URI=mongodb+srv://<user>:<password>@cluster0.xxx.mongodb.net/AIZen?appName=Cluster0
# Firebase — Client (NEXT_PUBLIC = safe to expose in browser)
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=
# Firebase — Admin (server-side only, never exposed to browser)
FIREBASE_PROJECT_ID=
FIREBASE_CLIENT_EMAIL=
FIREBASE_PRIVATE_KEY=
</> → copy the firebaseConfig values into the NEXT_PUBLIC_* env varsproject_id, client_email, and private_key into the FIREBASE_* env varsnpm run dev
Open http://localhost:3000.
npm run build
npm run start
Firebase Authentication handles all identity on the client side. The server verifies tokens using the Firebase Admin SDK.
User signs in (email/password or Google)
↓
Firebase issues a signed JWT (ID token)
↓
Client attaches token in Authorization: Bearer <token> header
↓
/api/progress verifies token with Firebase Admin SDK
↓
Returns progress document keyed to Firebase UID
Guest mode: If the user is not signed in, progress uses an anonymous UUID stored in localStorage. Progress still syncs to MongoDB — under the UUID key instead of a Firebase UID. Signing in on a new device retrieves the Firebase-keyed progress.
Nav: When signed in, the Nav shows the user's avatar (photo or initials), name, and a dropdown with sign-out. When not signed in, "Sign In" and "Sign Up Free" buttons appear.
The AI Tutor is accessible from any lesson page via the lightbulb icon in the top bar.
Architecture:
User message
↓
/api/chat (Next.js Edge Route)
↓
Groq SDK → llama-3.3-70b-versatile
↓
ReadableStream (streaming)
↓
AiTutor.tsx (reads stream, updates UI incrementally)
System prompt is dynamically constructed with the current lesson title and category, so the model knows exactly what topic is being studied.
Suggestion buttons appear on first open — "Explain simpler", "Give a Python example", "What are the real-world uses?", "Explain the math behind it" — for quick one-click prompts.
The RAG Tutor (/rag-tutor) uses the same API route but passes a systemOverride with the document context, making the model answer only from the uploaded document.
POST /api/chatEdge runtime endpoint for streaming LLM responses.
Request body:
{
"messages": [{ "role": "user", "content": "Explain gradient descent" }],
"lessonTitle": "Gradient Descent",
"lessonCategory": "Machine Learning",
"systemOverride": "Optional: replaces the default system prompt (used by RAG Tutor)"
}
Response: text/plain streaming body. Chunks are plain text deltas.
Runtime: Edge (Vercel Edge Functions compatible)
Model: llama-3.3-70b-versatile via Groq (free tier, ~100 tokens/sec)
GET /api/progress?userId=xxxFetch a user's progress document from MongoDB.
Authorization: Bearer <firebase-token>, the Firebase UID is used (ignores userId param)userId query param (anonymous UUID)POST /api/progressUpsert a user's full progress document.
Request body:
{ "userId": "optional-uuid-for-guests", "data": { ...progressFields } }
userId in bodyProgress uses a hybrid localStorage + MongoDB architecture:
User action (complete lesson, quiz, bookmark, note)
↓
localStorage update (immediate)
↓ async, non-blocking
ProgressSync: syncs every 60s + on tab close
↓
POST /api/progress (with Firebase token if signed in)
↓
MongoDB AIZen.progress collection
On first page load, ProgressSync fetches from MongoDB and merges into localStorage — so returning users recover their full history automatically.
| Key | Data |
|---|---|
aizen_user_id | Anonymous UUID (used when not signed in) |
aizen_completed_v2 | Array of completed lesson IDs |
aizen_streak_v2 | Current streak count |
aizen_last_day_v2 | Last active day (for streak calculation) |
aizen_quiz_xp | Total quiz XP earned |
aizen_quiz_<lessonId> | Quiz result per lesson (score, correct, total) |
aizen_bookmarks | Array of bookmarked lesson IDs |
aizen_note_<lessonId> | Note text per lesson |
aizen_activity | Map of "YYYY-MM-DD" → activity count (heatmap) |
One document per user in the AIZen.progress collection:
{
_id: string, // Firebase UID (signed in) or anonymous UUID (guest)
completed: string[],
streak: number,
lastDay: string,
quizXP: number,
quizResults: Record<string, { score: number, correct: number, total: number }>,
bookmarks: string[],
notes: Record<string, string>,
activity: Record<string, number>, // "2026-06-17" → count
updatedAt: Date,
}
5 MCQs per lesson (310 total across 62 lessons).
Flow:
Grading:
| Score | Grade |
|---|---|
| 5/5 | S |
| 4/5 | A |
| 3/5 | B |
| ≤2/5 | C |
Every page is fully responsive with Tailwind CSS breakpoints:
| Component | Mobile | Desktop |
|---|---|---|
| Nav | Hamburger → 2-column grid drawer + auth row | Horizontal link bar + avatar dropdown |
| Learn sidebar | Hidden — opens as overlay | Fixed left panel (w-64) |
| AI Tutor | Bottom sheet (70vh) | Right panel (w-72/w-80) |
| Notes panel | Bottom sheet (h-96) | Right panel (w-64/w-72) |
| Dashboard rings | 2-col grid | 4-col grid |
| Projects grid | 1 col | 2 col |
| Interview filters | Wrap | Inline row |
| RAG Tutor | Stacked (input then chat) | Side-by-side grid |
The platform is fully live at https://ai-zen-tutor.vercel.app:
| Feature | Status |
|---|---|
| All 13 pages (incl. login + register) | ✅ Live |
| Firebase Auth (email/password + Google) | ✅ Live |
| AI Tutor (Groq Llama 3.3 70B) | ✅ Live |
| RAG Document Tutor | ✅ Live |
| MongoDB progress sync | ✅ Live |
| Quizzes, XP, Streaks, Badges | ✅ Live |
| Daily Challenge | ✅ Live |
npx vercel --prod
Environment variables to add in Vercel → Settings → Environment Variables:
| Variable | Description |
|---|---|
GROQ_API_KEY | Groq API key for AI Tutor |
MONGODB_URI | MongoDB Atlas connection string |
NEXT_PUBLIC_FIREBASE_API_KEY | Firebase client config |
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN | Firebase client config |
NEXT_PUBLIC_FIREBASE_PROJECT_ID | Firebase client config |
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET | Firebase client config |
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID | Firebase client config |
NEXT_PUBLIC_FIREBASE_APP_ID | Firebase client config |
FIREBASE_PROJECT_ID | Firebase Admin (server-side) |
FIREBASE_CLIENT_EMAIL | Firebase Admin service account email |
FIREBASE_PRIVATE_KEY | Firebase Admin private key (paste with quotes) |
After adding env vars, go to Deployments → Redeploy for them to take effect.
The /api/chat route uses export const runtime = "edge" — deployed as a Vercel Edge Function with global low latency. All other pages are statically generated.
data/curriculum.tsdata/lessons/*.ts filedata/quizzes.ts (3) and data/quizzes-extra.ts (2)import Nav from "@/components/Nav"
export default function YourPage() {
return (
<div className="min-h-screen" style={{ background: "var(--bg)" }}>
<Nav />
<main className="max-w-4xl mx-auto px-4 sm:px-6 py-10">
{/* content */}
</main>
</div>
)
}
The Groq client must be instantiated inside the request handler, not at module level — Edge runtime evaluates env vars lazily:
// ✅ Correct
export async function POST(req: NextRequest) {
const groq = new Groq({ apiKey: process.env.GROQ_API_KEY })
}
// ❌ Wrong — causes build failure on Edge runtime
const groq = new Groq({ apiKey: process.env.GROQ_API_KEY })
When adding FIREBASE_PRIVATE_KEY to Vercel, paste the full key including the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- lines, wrapped in double quotes. Vercel preserves newlines in multiline env vars correctly.
In app/api/chat/route.ts:
model: "llama-3.3-70b-versatile" // change to any Groq model
Other free Groq models: llama-3.1-8b-instant (faster), mixtral-8x7b-32768 (longer context).
In lib/progress.ts:
export const XP_PER_LESSON = 100
export const XP_PER_CORRECT = 25
CSS variables in app/globals.css:
:root {
--bg: #05050a;
--surface: #0c0c14;
--border: rgba(255,255,255,0.07);
}
MIT — free to use, modify, and distribute.
Built with Next.js, Firebase, MongoDB, Tailwind CSS, GSAP, and Groq.
11 commits
2 commits
TypeScript
99.7%
0
stars
13
commits
TypeScript
primary language
Jun 19, 2026
updated
A gamified AI/ML learning platform. 62 in-depth lessons, 5 quizzes per lesson, an AI tutor powered by Groq, Firebase authentication, cross-device progress sync via MongoDB, a visual skill tree, ML project showcase, foundational research papers, interview prep hub, daily challenges, and a document RAG tutor — all in one dark-themed Next.js app.
https://ai-zen-tutor.vercel.app
Deployed on Vercel. All 11 pages, the AI Tutor (Groq Llama 3.3 70B), Firebase Auth, and the RAG Tutor are fully live and operational.
| Page | Description |
|---|---|
/ | Hero landing, feature grid, curriculum overview, platform explorer |
/learn | Sidebar + lesson view + AI tutor + notes + quiz modal |
/dashboard | XP stats, activity heatmap, skill radar chart, badges |
/roadmap | Visual node-based learning path |
/skill-tree | ML Engineer tree with per-node progress rings |
/projects | 9 end-to-end ML/DL/LLM project cards |
/research | 7 foundational AI papers with expandable summaries |
/interview | 25+ theory, coding, and system design Q&A |
/daily | Rotating daily challenge (ML + coding + interview) |
/rag-tutor | Upload a document, ask questions via RAG |
/about | Creator profile and portfolio |
/login | Sign in — email/password or Google |
/register | Create account — email/password or Google |
Cmd/Ctrl+S to savelocalStorage (instant, no latency) and synced to MongoDB (cross-device)| Page | URL |
|---|---|
| Home / Landing | / |
| Sign In | /login |
| Create Account | /register |
| Learn (62 lessons) | /learn |
| Progress Dashboard | /dashboard |
| Learning Roadmap | /roadmap |
| ML Engineer Skill Tree | /skill-tree |
| ML Projects Showcase | /projects |
| Research Papers | /research |
| Interview Hub | /interview |
| Daily Challenge | /daily |
| RAG Document Tutor | /rag-tutor |
| About | /about |
/projects)9 portfolio-ready projects with architecture, dataset, key results, skills, GitHub links, and live demo links:
| Project | Category | Difficulty |
|---|---|---|
| House Price Prediction | Machine Learning | Beginner |
| Customer Churn Prediction | Machine Learning | Intermediate |
| Movie Recommendation System | Machine Learning | Intermediate |
| Image Classifier (ResNet-50) | Deep Learning | Intermediate |
| Object Detection (YOLOv8) | Deep Learning | Advanced |
| Sentiment Analysis API | NLP | Intermediate |
| RAG Document Chatbot | LLM | Advanced |
| PDF Q&A with Citations | LLM | Advanced |
| AI Research Assistant | LLM | Expert |
/research)7 foundational papers with plain-English summaries, key ideas, applications, and ArXiv links:
/interview)25+ questions filterable by category (ML / DL / NLP / LLM / RAG / MLOps / System Design) and type (Theory / Coding / System Design). Coding answers include full Python implementations.
/daily)Three new questions every 24 hours (rotated from a bank using the day-of-year index):
/rag-tutor)Upload any .txt, .md, .py, .json, .ts, or .csv file — or paste text directly. The system:
/api/chat edge route/skill-tree)Visual ML Engineer tree with collapsible nodes. Each node shows:
Start learning → link that opens /learn filtered to that categoryTree path: Python & Math → Machine Learning → Deep Learning → NLP → LLMs → RAG → [CV | MLOps → Agents]
| Layer | Technology |
|---|---|
| Framework | Next.js 16.2.9 (App Router) |
| Language | TypeScript 5 (strict mode) |
| Styling | Tailwind CSS 3.4 + custom CSS variables |
| Animations | GSAP 3.15 + ScrollTrigger |
| AI / LLM | Groq SDK (groq-sdk) — Llama 3.3 70B Versatile |
| Authentication | Firebase Authentication (Email/Password + Google OAuth) |
| Database | MongoDB Atlas — progress persistence |
| Auth Token Verification | Firebase Admin SDK (server-side) |
| Rendering | Static generation for all pages + Edge runtime for /api/chat |
| State | React useState / useEffect — no external state library |
| Progress Cache | localStorage (primary, instant) + MongoDB (sync, cross-device) |
Ml Tutor/
└── frontend/
├── app/
│ ├── page.tsx # Home / landing page
│ ├── layout.tsx # Root layout (AuthProvider + ProgressSync)
│ ├── globals.css # CSS variables, animations, utilities
│ ├── login/
│ │ └── page.tsx # Sign in (email/password + Google)
│ ├── register/
│ │ └── page.tsx # Create account (email/password + Google)
│ ├── learn/
│ │ └── page.tsx # Main learning page (sidebar + lesson + panels)
│ ├── dashboard/
│ │ └── page.tsx # Progress dashboard
│ ├── roadmap/
│ │ └── page.tsx # Visual learning roadmap
│ ├── skill-tree/
│ │ └── page.tsx # ML Engineer skill tree
│ ├── projects/
│ │ └── page.tsx # ML projects showcase
│ ├── research/
│ │ └── page.tsx # Foundational papers
│ ├── interview/
│ │ └── page.tsx # Interview prep hub
│ ├── daily/
│ │ └── page.tsx # Daily challenge
│ ├── rag-tutor/
│ │ └── page.tsx # Document Q&A via RAG
│ ├── about/
│ │ └── page.tsx # Creator profile
│ └── api/
│ ├── chat/
│ │ └── route.ts # Groq streaming edge API
│ └── progress/
│ └── route.ts # MongoDB progress sync (GET + POST)
├── components/
│ ├── Nav.tsx # Shared sticky nav with auth state (avatar, sign out)
│ ├── AuthProvider.tsx # Firebase auth context + useAuth() hook
│ ├── ProgressSync.tsx # Auto-syncs localStorage → MongoDB on interval
│ ├── AiTutor.tsx # Streaming AI tutor panel
│ ├── QuizModal.tsx # Post-lesson quiz modal
│ ├── NotesPanel.tsx # Per-lesson notes panel
│ ├── LessonView.tsx # Lesson content renderer
│ ├── LearnSidebar.tsx # Left sidebar (search, categories, lessons)
│ └── LessonPage.tsx # Lesson layout wrapper
├── data/
│ ├── curriculum.ts # Lesson metadata (all 62 lessons)
│ ├── types.ts # Shared TypeScript types
│ ├── quizzes.ts # 186 MCQs (3 per lesson, original)
│ ├── quizzes-extra.ts # 124 additional MCQs (2 per lesson)
│ ├── quizzes-all.ts # Merged export (5 per lesson = 310 total)
│ └── lessons/ # Full lesson content per category
│ ├── ml.ts
│ ├── deep-learning.ts
│ ├── nlp.ts
│ ├── llms.ts
│ ├── rag.ts
│ ├── cv.ts
│ ├── mlops.ts
│ └── interview.ts
├── lib/
│ ├── progress.ts # XP, streaks, quizzes, bookmarks, notes + MongoDB sync
│ ├── firebase.ts # Firebase client SDK (auth)
│ ├── firebase-admin.ts # Firebase Admin SDK (server-side token verification)
│ └── mongodb.ts # MongoDB connection pooling
├── types/ # TypeScript declaration files
├── .env.local # API keys (gitignored)
├── package.json
├── tailwind.config.ts
└── tsconfig.json
| Category | Lessons | Key Topics |
|---|---|---|
| Machine Learning | 12 | Gradient Descent, Bias-Variance, SVMs, XGBoost, PCA, K-Means, Evaluation Metrics |
| Deep Learning | 10 | Backprop, CNNs, RNNs/LSTMs, Autoencoders, GANs, Diffusion Models |
| NLP & Transformers | 8 | Tokenization, Word2Vec, BERT, GPT, Fine-tuning, Attention, NER |
| LLMs & Prompting | 8 | Prompt Engineering, RLHF, Tool Use, AI Agents, LangChain, Multi-Agent |
| RAG Systems | 7 | Chunking, Vector DBs, Embedding Models, Hybrid Search, Reranking, Agentic RAG |
| Computer Vision | 6 | Transfer Learning, Object Detection, Segmentation, ViT, Data Augmentation |
| MLOps | 6 | Deployment, Monitoring, Feature Stores, CI/CD, Data Pipelines |
| Interview Prep | 5 | ML / DL / NLP-LLM / System Design / MLOps Interview Questions |
| Action | XP |
|---|---|
| Complete a lesson | +100 XP |
| Correct quiz answer | +25 XP |
| Retake quiz (already done) | No XP (prevents farming) |
| Level | Name | XP Required |
|---|---|---|
| 1 | 🌱 Newcomer | 0 |
| 2 | 📚 Learner | 100 |
| 3 | 🔭 Explorer | 500 |
| 4 | 💻 Developer | 1,500 |
| 5 | ⚙️ Engineer | 3,500 |
| 6 | 🎯 Expert | 7,000 |
| 7 | 🏆 Master | 13,000 |
Maximum XP possible: 62 × 100 + 310 × 25 = 13,950 XP (enough to reach Master)
| Badge | Category |
|---|---|
| 🤖 ML Scholar | Machine Learning |
| 🧠 Deep Thinker | Deep Learning |
| 💬 Language Master | NLP & Transformers |
| ✨ Prompt Engineer | LLMs & Prompting |
| 🔍 RAG Architect | RAG Systems |
| 👁️ Vision Expert | Computer Vision |
| 🚀 MLOps Pro | MLOps |
| 🎤 Job Ready | Interview Prep |
git clone <your-repo-url>
cd "Ml Tutor/frontend"
npm install
Create frontend/.env.local:
# AI
GROQ_API_KEY=your_groq_api_key_here
# Database
MONGODB_URI=mongodb+srv://<user>:<password>@cluster0.xxx.mongodb.net/AIZen?appName=Cluster0
# Firebase — Client (NEXT_PUBLIC = safe to expose in browser)
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=
NEXT_PUBLIC_FIREBASE_APP_ID=
# Firebase — Admin (server-side only, never exposed to browser)
FIREBASE_PROJECT_ID=
FIREBASE_CLIENT_EMAIL=
FIREBASE_PRIVATE_KEY=
</> → copy the firebaseConfig values into the NEXT_PUBLIC_* env varsproject_id, client_email, and private_key into the FIREBASE_* env varsnpm run dev
Open http://localhost:3000.
npm run build
npm run start
Firebase Authentication handles all identity on the client side. The server verifies tokens using the Firebase Admin SDK.
User signs in (email/password or Google)
↓
Firebase issues a signed JWT (ID token)
↓
Client attaches token in Authorization: Bearer <token> header
↓
/api/progress verifies token with Firebase Admin SDK
↓
Returns progress document keyed to Firebase UID
Guest mode: If the user is not signed in, progress uses an anonymous UUID stored in localStorage. Progress still syncs to MongoDB — under the UUID key instead of a Firebase UID. Signing in on a new device retrieves the Firebase-keyed progress.
Nav: When signed in, the Nav shows the user's avatar (photo or initials), name, and a dropdown with sign-out. When not signed in, "Sign In" and "Sign Up Free" buttons appear.
The AI Tutor is accessible from any lesson page via the lightbulb icon in the top bar.
Architecture:
User message
↓
/api/chat (Next.js Edge Route)
↓
Groq SDK → llama-3.3-70b-versatile
↓
ReadableStream (streaming)
↓
AiTutor.tsx (reads stream, updates UI incrementally)
System prompt is dynamically constructed with the current lesson title and category, so the model knows exactly what topic is being studied.
Suggestion buttons appear on first open — "Explain simpler", "Give a Python example", "What are the real-world uses?", "Explain the math behind it" — for quick one-click prompts.
The RAG Tutor (/rag-tutor) uses the same API route but passes a systemOverride with the document context, making the model answer only from the uploaded document.
POST /api/chatEdge runtime endpoint for streaming LLM responses.
Request body:
{
"messages": [{ "role": "user", "content": "Explain gradient descent" }],
"lessonTitle": "Gradient Descent",
"lessonCategory": "Machine Learning",
"systemOverride": "Optional: replaces the default system prompt (used by RAG Tutor)"
}
Response: text/plain streaming body. Chunks are plain text deltas.
Runtime: Edge (Vercel Edge Functions compatible)
Model: llama-3.3-70b-versatile via Groq (free tier, ~100 tokens/sec)
GET /api/progress?userId=xxxFetch a user's progress document from MongoDB.
Authorization: Bearer <firebase-token>, the Firebase UID is used (ignores userId param)userId query param (anonymous UUID)POST /api/progressUpsert a user's full progress document.
Request body:
{ "userId": "optional-uuid-for-guests", "data": { ...progressFields } }
userId in bodyProgress uses a hybrid localStorage + MongoDB architecture:
User action (complete lesson, quiz, bookmark, note)
↓
localStorage update (immediate)
↓ async, non-blocking
ProgressSync: syncs every 60s + on tab close
↓
POST /api/progress (with Firebase token if signed in)
↓
MongoDB AIZen.progress collection
On first page load, ProgressSync fetches from MongoDB and merges into localStorage — so returning users recover their full history automatically.
| Key | Data |
|---|---|
aizen_user_id | Anonymous UUID (used when not signed in) |
aizen_completed_v2 | Array of completed lesson IDs |
aizen_streak_v2 | Current streak count |
aizen_last_day_v2 | Last active day (for streak calculation) |
aizen_quiz_xp | Total quiz XP earned |
aizen_quiz_<lessonId> | Quiz result per lesson (score, correct, total) |
aizen_bookmarks | Array of bookmarked lesson IDs |
aizen_note_<lessonId> | Note text per lesson |
aizen_activity | Map of "YYYY-MM-DD" → activity count (heatmap) |
One document per user in the AIZen.progress collection:
{
_id: string, // Firebase UID (signed in) or anonymous UUID (guest)
completed: string[],
streak: number,
lastDay: string,
quizXP: number,
quizResults: Record<string, { score: number, correct: number, total: number }>,
bookmarks: string[],
notes: Record<string, string>,
activity: Record<string, number>, // "2026-06-17" → count
updatedAt: Date,
}
5 MCQs per lesson (310 total across 62 lessons).
Flow:
Grading:
| Score | Grade |
|---|---|
| 5/5 | S |
| 4/5 | A |
| 3/5 | B |
| ≤2/5 | C |
Every page is fully responsive with Tailwind CSS breakpoints:
| Component | Mobile | Desktop |
|---|---|---|
| Nav | Hamburger → 2-column grid drawer + auth row | Horizontal link bar + avatar dropdown |
| Learn sidebar | Hidden — opens as overlay | Fixed left panel (w-64) |
| AI Tutor | Bottom sheet (70vh) | Right panel (w-72/w-80) |
| Notes panel | Bottom sheet (h-96) | Right panel (w-64/w-72) |
| Dashboard rings | 2-col grid | 4-col grid |
| Projects grid | 1 col | 2 col |
| Interview filters | Wrap | Inline row |
| RAG Tutor | Stacked (input then chat) | Side-by-side grid |
The platform is fully live at https://ai-zen-tutor.vercel.app:
| Feature | Status |
|---|---|
| All 13 pages (incl. login + register) | ✅ Live |
| Firebase Auth (email/password + Google) | ✅ Live |
| AI Tutor (Groq Llama 3.3 70B) | ✅ Live |
| RAG Document Tutor | ✅ Live |
| MongoDB progress sync | ✅ Live |
| Quizzes, XP, Streaks, Badges | ✅ Live |
| Daily Challenge | ✅ Live |
npx vercel --prod
Environment variables to add in Vercel → Settings → Environment Variables:
| Variable | Description |
|---|---|
GROQ_API_KEY | Groq API key for AI Tutor |
MONGODB_URI | MongoDB Atlas connection string |
NEXT_PUBLIC_FIREBASE_API_KEY | Firebase client config |
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN | Firebase client config |
NEXT_PUBLIC_FIREBASE_PROJECT_ID | Firebase client config |
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET | Firebase client config |
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID | Firebase client config |
NEXT_PUBLIC_FIREBASE_APP_ID | Firebase client config |
FIREBASE_PROJECT_ID | Firebase Admin (server-side) |
FIREBASE_CLIENT_EMAIL | Firebase Admin service account email |
FIREBASE_PRIVATE_KEY | Firebase Admin private key (paste with quotes) |
After adding env vars, go to Deployments → Redeploy for them to take effect.
The /api/chat route uses export const runtime = "edge" — deployed as a Vercel Edge Function with global low latency. All other pages are statically generated.
data/curriculum.tsdata/lessons/*.ts filedata/quizzes.ts (3) and data/quizzes-extra.ts (2)import Nav from "@/components/Nav"
export default function YourPage() {
return (
<div className="min-h-screen" style={{ background: "var(--bg)" }}>
<Nav />
<main className="max-w-4xl mx-auto px-4 sm:px-6 py-10">
{/* content */}
</main>
</div>
)
}
The Groq client must be instantiated inside the request handler, not at module level — Edge runtime evaluates env vars lazily:
// ✅ Correct
export async function POST(req: NextRequest) {
const groq = new Groq({ apiKey: process.env.GROQ_API_KEY })
}
// ❌ Wrong — causes build failure on Edge runtime
const groq = new Groq({ apiKey: process.env.GROQ_API_KEY })
When adding FIREBASE_PRIVATE_KEY to Vercel, paste the full key including the -----BEGIN PRIVATE KEY----- and -----END PRIVATE KEY----- lines, wrapped in double quotes. Vercel preserves newlines in multiline env vars correctly.
In app/api/chat/route.ts:
model: "llama-3.3-70b-versatile" // change to any Groq model
Other free Groq models: llama-3.1-8b-instant (faster), mixtral-8x7b-32768 (longer context).
In lib/progress.ts:
export const XP_PER_LESSON = 100
export const XP_PER_CORRECT = 25
CSS variables in app/globals.css:
:root {
--bg: #05050a;
--surface: #0c0c14;
--border: rgba(255,255,255,0.07);
}
MIT — free to use, modify, and distribute.
Built with Next.js, Firebase, MongoDB, Tailwind CSS, GSAP, and Groq.
11 commits
2 commits
TypeScript
99.7%