You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CodeVerse is a full-stack AI-powered coding mentor built for absolute beginners. Instead of just answering questions, it teaches — using real-life analogies, code examples, interactive quizzes, and personalized code reviews.
A student types: "What is a variable?"
CodeVerse explains it like a labeled box 📦
Shows a code example 💻
Gives a "Try it yourself" challenge 🎯
Tracks their XP and progress 📊
Built as a Final Year Project demonstrating full-stack development, AI integration, database design, security implementation, and cloud deployment.
User submits form
│
▼
Input validation
(email regex, pw length)
│
▼
bcrypt.hash(password, 12)
│
▼
Save to MongoDB
│
▼
jwt.sign({ id, email }) ──► Returns JWT token
│
▼
Frontend stores token
in localStorage
│
▼
Every API request sends:
Authorization: Bearer <token>
AI Chat Flow
User sends message
│
▼
authRequired middleware
verifies JWT token
│
├── Invalid → 401 Unauthorized
│
▼ Valid
POST to Google Gemini API
(gemini-1.5-mini-latest)
with system prompt + message
│
▼
AI response received
│
├──► Send reply to frontend
│
└──► Save to MongoDB
(chat history)
Quiz Generation Flow
User picks topic
│
▼
Backend sends prompt to Gemini API:
"Generate 5 MCQ questions about [topic]
Return ONLY JSON array"
│
▼
safeParseJSON() extracts
clean JSON from response
│
▼
5 questions rendered
with A/B/C/D options
│
▼
User answers → score calculated
→ XP awarded → result saved
to MongoDB quiz history
🛠 Tech Stack
Layer
Technology
Purpose
Frontend
HTML5 + CSS3 + Vanilla JS
Single page app, no framework
Backend
Node.js + Express.js
REST API server
Database
MongoDB Atlas + Mongoose
User data, chat/quiz history
AI Engine
Google Gemini API (gemini-1.5-mini-latest)
Chat, quiz generation, code review
Auth
JWT + bcryptjs
Secure authentication
Hosting
Render.com
Free Node.js hosting
Version Control
GitHub
Source code management
Why these choices?
Decision
Reason
Vanilla JS (no React)
Simpler for FYP, shows core JS understanding
Gemini for AI tasks
Free tier with generous limits, multimodal capabilities, reliable API
MongoDB over SQL
Flexible schema for evolving user data, free Atlas tier
Render over Vercel
Vercel doesn't support Express app.listen(), Render does
bcrypt cost 12
Balance between security and performance
📊 API Reference
Authentication Routes
Method
Endpoint
Auth
Description
POST
/auth/register
❌
Register new user
POST
/auth/login
❌
Login, returns JWT
GET
/auth/me
✅ JWT
Get current user
AI Routes (all require JWT)
Method
Endpoint
Body
Description
POST
/api/chat
{systemPrompt, userMessage}
AI mentor response
POST
/api/quiz
{topic}
Generate 5 quiz questions
POST
/api/review
{code, lang, beginner, rewrite}
Code review
Progress Routes
Method
Endpoint
Auth
Description
PATCH
/user/progress
✅ JWT
Save XP, stats, progress
History Routes (all require JWT)
Method
Endpoint
Description
POST
/api/history/chat
Save chat message pair
GET
/api/history/chats
List all chat sessions
GET
/api/history/chat/:id
Get full conversation
DELETE
/api/history/chat/:id
Delete chat
POST
/api/history/quiz
Save quiz result
GET
/api/history/quizzes
List all quiz attempts
Example Response — /api/quiz
{
"questions": [
{
"q": "What is a variable in JavaScript?",
"options": [
"A) A fixed value that never changes",
"B) A named container that stores a value",
"C) A type of function",
"D) A loop structure"
],
"correct": 1,
"explain": "A variable is like a labeled box — you give it a name and store something inside it."
}
]
}