DEV Community

Cover image for Study-Mate: AI Powered Study Success Platform.
Anshu Mandal
Anshu Mandal Subscriber

Posted on • Edited on

Study-Mate: AI Powered Study Success Platform.

This is a submission for the Heroku "Back to School" AI Challenge

What I Built (And How I Survived Mid-Sems While Building It!)

Picture this: It's 2 AM, I have a mid-semester exam in 6 hours, and instead of cramming notes, I'm debugging SSE response parsing for Heroku's MCP endpoints. Sounds crazy? Maybe. But building StudyMate during my mid-sems taught me more about time management than any productivity app ever could! 😅

StudyMate is an intelligent study management platform I built to solve a problem I face every day – managing study time effectively while juggling multiple responsibilities. Beyond traditional features like session tracking, group collaboration, and performance analytics, StudyMate AI introduces “MentorMind” – a built-in AI-powered study assistant that learns from each student’s unique learning patterns. Think of it as the study buddy I wish I had during my exams (ironically, while building the study buddy itself!).

Features

  • 🕒 Study Timer

    • Customizable Pomodoro-style study sessions
    • Session tracking and statistics
  • 📈 Performance Analytics

    • Visual progress tracking
    • Monthly study hour analysis
    • Performance trends and insights
  • 🤖 AI Study Assistant

    • Personalized study advice
    • Context-aware recommendations
    • Real-time study habit analysis
    • Interactive chat interface
    • Study technique suggestions based on performance
    • MCP (Model Context Protocol) tool integration for external resource access
    • Automatic URL processing and content extraction from study materials
  • 👥 Study Groups

    • Create and join study groups
    • Group chat functionality
    • Collaborative study sessions

Building this during mid-sems was both challenging and meta – I was creating a tool to help students study better while trying to study better myself. The irony wasn't lost on me when MentorMind's first advice to me was "Take breaks more often" – advice I clearly wasn't following! 😄

Category

primary: Student Success
secondary: Crazy Creative

Demo

Study-Mate

StudyMate AI 🎓

An intelligent study management platform with AI-powered personalized assistance

StudyMate AI helps students track, optimize, and transform their study habits through real-time analytics, collaborative features, and MentorMind - an AI assistant that learns from your unique learning patterns.

✨ Features

  • 🕒 Smart Study Timer - Customizable Pomodoro sessions with progress tracking
  • 🤖 MentorMind AI Assistant - Personalized study advice using RAG-like architecture
  • 📈 Performance Analytics - Visual progress tracking and insights
  • 👥 Study Groups - Collaborative spaces with real-time messaging
  • ✅ Task Management - Drag-and-drop todo board with priorities
  • 🏆 Leaderboards - Global and group-specific study rankings
  • 📅 Calendar Integration - Study session scheduling and planning

🚀 Quick Start

Prerequisites

  • Node.js 18+ and pnpm
  • Convex account (convex.dev)
  • Vercel account (for deployment)
  • Heroku Inference API access for AI features

1. Clone & Install

git clone https://github.com/prime399/study-mate.git
cd study-mate
pnpm install
Enter fullscreen mode Exit fullscreen mode

2. Environment Setup

Create .env.local for…

  • Dashboard:

Dashboard

  • Study-Timer:

Study Timer

  • MentorMind:

MentorMind

MentorMind2

The Journey: Building with Heroku's Managed Inference

Let me tell you – working with Heroku's Managed Inference was an absolute blast! Even while balancing study schedules, I genuinely enjoyed piecing everything together. Here's how I leveraged Heroku's infrastructure to create an intelligent, adaptive study companion:

1. Multi-Agent Architecture

I implemented a sophisticated three-agent system, each optimized for specific use cases:

  • GPT-OSS Agent: Handles general study advice, learning strategies, and educational content generation. This agent provides comprehensive explanations and study methodology recommendations.

  • Nova Lite Agent: Optimized for real-time interactions and quick responses. Powers the interactive chat interface where students need immediate feedback and guidance during study sessions.

  • Claude Agent: Specializes in deep analysis of study patterns, performance metrics, and behavioral insights. Processes complex data to generate personalized long-term study plans and identifies learning bottlenecks.

Heroku Agents

2. Intelligent Agent Orchestration

The agents work in coordination through a custom routing system:

  • User queries are analyzed and routed to the most appropriate agent based on complexity, urgency, and context
  • Agents share context about the student's profile, including study history, performance trends, and learning preferences
  • Session continuity is maintained across agent switches for seamless conversations

3. Context-Aware Personalization

Heroku's Managed Inference enables MentorMind to:

  • Analyze students' study session data (duration, subjects, time of day) to identify optimal learning windows
  • Process performance metrics to detect struggling areas and recommend targeted interventions
  • Track conversation history to provide increasingly personalized advice over time
  • Adapt recommendations based on real-time feedback and study outcomes

4. The MCP Adventure: My Biggest Challenge (and Victory!)

MCP Dashboard

Okay, so implementing Model Context Protocol (MCP) support was... intense. I'm talking multiple cups of coffee, countless "why isn't this working?!" moments, and a lot of late nights. But honestly? It was also the most fun I had building this project!

The Struggle Was Real:

When I first dove into MCP integration, I thought "How hard could it be?" (Famous last words, right? 😅). Here's what I was dealing with:

  • Different Endpoints Everywhere: Heroku's MCP needed /v1/agents/heroku instead of the standard chat completions endpoint I was using. Had to completely rethink my routing logic.
  • SSE Parsing Headaches: Server-Sent Events format was new territory for me. Unlike the clean JSON responses from OpenAI's client, I had to manually parse streaming data line by line. At 3 AM, those data: prefixes all started looking the same 😴
  • Dynamic Tools = Dynamic Problems: I couldn't hardcode tools because MCP servers could change anytime. Everything had to be fetched and configured on the fly.
  • UI/UX Puzzle: How do you show users that tools are available without making them think they must select one? Spent days on this alone!

Shoutout to Heroku's Documentation:

This is where I need to give MAJOR props to Heroku's team! 🙌

Their GitHub documentation for MCP servers was an absolute lifesaver. Seriously, when I was stuck trying to understand how to structure my MCP server requests, those GitHub docs came in clutch! Clear examples, good structure, and exactly what I needed when I needed it. I probably had that tab open 24/7 during the build week.

The Managed Inference docs were also solid and helped me understand the architecture. Though, I'll be honest – I wish there were more library suggestions and code examples early on. I spent a good chunk of time hunting down the right Node.js libraries and patterns for SSE parsing. Would've saved me a few late nights if those were front and center! But hey, the learning journey made the victory sweeter 😊

The Breakthrough:

After what felt like a hundred iterations (probably was more like ten, but who's counting?), I cracked it with a hybrid approach:

  1. Dynamic Tool Discovery: Every request fetches the latest tools from /v1/mcp/servers – always fresh, always up to date
  2. Give the AI Everything: Instead of limiting tools based on user selection, I send ALL available tools to the agent and let the AI decide what to use. Smart agents deserve smart tooling!
  3. Custom SSE Parser: Built my own parser that handles Heroku's streaming format gracefully (took me a while to get this right!)
  4. Graceful Fallback: No tools available? No problem – falls back to standard chat completions seamlessly

Why This Makes MentorMind Actually Useful:

Here's the magic moment – when all this technical complexity comes together into something simple and powerful for students:

  • Just Drop a URL: Students don't need to know about MCP, tools, or anything technical. Just paste a URL to their study material and ask a question. Done. ✨
  • Automatic Everything: MentorMind fetches the content, reads it, understands it, and answers in context of their study goals
  • Real-time Learning Support: Studying from an online article? PDF lecture notes? Research paper? MentorMind can now actually READ them with you!
  • Zero Friction: No "click here to enable tool" nonsense. It just works.

Real example: A student types "Summarize this lecture PDF: [URL] and tell me which topics I should focus on based on my weak areas." MentorMind fetches the PDF, analyzes it against the student's performance data, and gives targeted advice. That's when I knew all those late nights were worth it! 🎯

The best part? I used MentorMind to help me study for my mid-sems by feeding it my lecture notes. Meta? Absolutely. Helpful? You bet! Got a B+ on that exam I was supposed to fail 😄

Technical Implementation (The Nerdy Details!)

For those who love diving into the code (like me at 2 AM apparently 😅), here's how everything fits together:

Frontend Architecture

  • Framework: Next.js 14 with TypeScript and App Router (type safety saved me from so many bugs during exam stress!)
  • UI Components: Shadcn/ui with Tailwind CSS styling (made it look professional even when I was running on 3 hours of sleep)
  • Real-time Data: Convex React hooks for reactive queries (watching data update in real-time never gets old!)

MentorMind Architecture (RAG + MCP Magic ✨)

This is where things get fun! MentorMind uses a RAG (Retrieval-Augmented Generation) architecture supercharged with MCP tools:

  • Multi-Model Support: Dynamic routing between GPT-OSS 120B, Nova Lite/Pro, and Claude 3.5 Haiku
  • Real-time Chat: Streaming responses that feel snappy and responsive
  • Context-Aware: Pulls in user study data, group info, and performance metrics automatically
  • MCP Tool Integration: This is the secret sauce – automatic external resource access!

Here's the Chat Flow I Pieced Together:

export async function POST(req: Request) {
  try {
    const { messages, userName, studyStats, groupInfo, modelId } = await req.json()

    const config = validateOpenAIConfig(modelId)
    const systemPrompt = buildSystemPrompt({ userName, studyStats, groupInfo })

    // Fetch all available MCP tools dynamically
    const availableMcpTools = await fetchAvailableMcpTools()

    // Enhance system prompt with tool descriptions
    if (availableMcpTools.length > 0) {
      const toolsList = availableMcpTools
        .map(tool => `- ${tool.name}: ${tool.description}`)
        .join('\n')

      systemPrompt += `\n\nYou have access to the following MCP tools:
${toolsList}

Use these tools proactively when they can help provide better answers.`
    }

    const chatMessages = [
      { role: "system", content: systemPrompt },
      ...sanitizeMessages(messages),
    ]

    let completion

    // Route to appropriate endpoint based on tool availability
    if (availableMcpTools.length > 0) {
      completion = await callHerokuAgentsEndpoint(
        config,
        chatMessages,
        availableMcpTools
      )
    } else {
      const client = createOpenAIClient(config)
      completion = await client.chat.completions.create({
        model: config.herokuModelId,
        messages: chatMessages,
      })
    }

    return Response.json({ ...completion })
  } catch (error) {
    // Error handling
  }
}
Enter fullscreen mode Exit fullscreen mode

The MCP Endpoint Handler (My Pride and Joy!):

This function took me DAYS to get right. The SSE parsing especially gave me grief, but seeing it work for the first time was pure joy!

async function callHerokuAgentsEndpoint(
  config: HerokuConfig,
  messages: ChatMessage[],
  mcpTools: McpTool[]
) {
  const agentsUrl = `${config.herokuBaseUrl}/v1/agents/heroku`

  // Transform tools to Heroku's MCP format
  const toolsArray = mcpTools.map(tool => ({
    type: "mcp",
    name: tool.id,  // e.g., "fetch/read_url"
  }))

  const response = await fetch(agentsUrl, {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${config.herokuApiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: config.herokuModelId,
      messages,
      tools: toolsArray,  // All tools available to AI
    }),
  })

  // Parse SSE response format
  const text = await response.text()
  const lines = text.split('\n')
  let lastCompletion = null

  for (const line of lines) {
    if (line.startsWith('data:')) {
      const data = line.slice(5).trim()
      if (data === '[DONE]') break

      const parsed = JSON.parse(data)
      if (parsed.object === 'chat.completion') {
        lastCompletion = parsed
      }
    }
  }

  return lastCompletion
}
Enter fullscreen mode Exit fullscreen mode

Backend Architecture (The Foundation)

  • Database: Convex with real-time subscriptions and optimistic updates (seriously amazing for building fast!)
  • Authentication: Convex Auth with secure session management
  • API Routes: Next.js API routes handling all the Heroku Inference magic
  • Data Models: Clean, structured schemas for everything – future me thanks past me for this!

Real Problems I'm Solving (Because I Face Them Too!)

Building StudyMate wasn't just an academic exercise – these are problems I deal with as a student every single day:

1. "I Have No Study Structure" (Been there, done that!)

  • Built customizable Pomodoro sessions because traditional 25-minute blocks don't work for everyone
  • Session tracking helped me realize I was most productive at 9 PM (who knew?!)

2. "Am I Actually Making Progress?" (The eternal student question)

  • Visual analytics that actually make sense – no PhD in data science required
  • Monthly trends that showed me exactly when I was slacking (looking at you, August 😅)

3. "I Need Personalized Help, Not Generic Advice" (The reason MentorMind exists)

  • Context-aware recommendations based on YOUR data, not some average student
  • Real-time analysis that learns from your patterns – tested extensively on myself during mid-sems!

4. "Studying Alone is Boring" (Let's be real)

  • Global rankings for friendly competition (I'm currently ranked #3, coming for that first Position! 🎯)
  • Study group leaderboards that make group study actually engaging
  • Personal best tracking – sometimes competing with yourself is the best motivation

What I Actually Pulled Off (Despite Mid-Sems!)

Honestly, I'm pretty proud of what got built here:

  • Full MCP Integration: Real-time external data retrieval actually WORKS (and it's beautiful!)
  • Dynamic Tool Discovery: Tools update automatically – no hardcoding, no manual config
  • Smart Routing: Seamlessly switches between regular chat and MCP-enhanced responses
  • Multi-Model Architecture: Three different AI models working together harmoniously
  • Built During Exams: Somehow managed to code, study, and sleep (occasionally) 😴

What's Next? (When I'm Not Studying!)

The journey doesn't stop here! Future plans include:

  • Voice Interaction: Hands-free studying for when you're pacing around trying to memorize things
  • Code Execution Environment: For my fellow CS students who need to test code snippets quickly
  • Calendar Integration: Auto-schedule study sessions (because manual planning is so 2024)
  • Mobile App: Study tracking on the go – because we're always on the go!

A Quick Note to Fellow Students

If you're reading this thinking "I could never build something like this" – trust me, I thought the same thing at the start! Building StudyMate taught me that the best way to learn is to build something you actually need. Plus, there's something special about using a tool you built yourself to help you study for the exams you should've been studying for instead of coding 😄

Many students are already using StudyMate and seeing real improvements. The Pomodoro sessions especially seem to click with people – breaking studying into focused chunks really does help you get more done (even worked for me while building this!).

Want to Try It? Here's a Pro Tip!

Hey judges (and curious students!) – I've got a little feature I'm excited about!

When you first onboard, you'll see an "Add sample data" button. It's totally optional, but here's why you might want to click it:

It populates your dashboard with realistic study session data, so you can immediately see how MentorMind gives personalized advice based on actual patterns. Without sample data, MentorMind doesn't have much context about you yet (it's smart, but it's not psychic! 😉).

Pro move: Import the sample data, then ask MentorMind something like "What subjects should I focus on?" or "When am I most productive?" You'll see how it analyzes the data and gives targeted recommendations. It's way cooler than starting with an empty dashboard!

Plus, it'll save you from having to run actual study sessions just to test the AI features. Though if you want to do that too, be my guest – maybe it'll inspire you to actually study 😄

On boarding sample data

Top comments (5)

Collapse
 
malets_diana_2034330c8212 profile image
Malets Diana • Edited

Hi! I’d love to share my experience with mysupergeek. The tutors never just gave me the answers, but they did provide helpful explanations and actionable tips that made it easier for me to spot my weak points and work on them with greater confidence. If you’re curious, you can check out more feedback here: trustpilot.com/review/mysupergeek.com. That kind of guidance is truly valuable.

Collapse
 
victor_lakra_e1910abe17fc profile image
VICTOR LAKRA

Hey Anshu, let's connect on discord. Here is my username: lkraxvict0r

Collapse
 
n3nad profile image
Nenad Mitrovic

"Building StudyMate taught me that the best way to learn is to build something you actually need." You just learned and expressed one of the most important lessons for a fulfilling and long-lasting career! And the fact that you’ve grasped this during your academic years is awesome. 🙌

I really enjoyed it. Just keep coding and building!

Collapse
 
julianduque profile image
Julián Duque

This is great, thank you so much for sharing your experience!

Collapse
 
prime_299792 profile image
Anshu Mandal

Thank you for giving us this amazing opportunity ❤️