Inspiration
While preparing for competitive exams, I hit a wall: I knew my weak spots—fixed prepositions, specific historical events—but couldn't find targeted practice. Mock tests wasted hours on topics I'd already mastered.
Worse, when I finally found relevant questions, there was no feedback explaining why answers were wrong or how to improve.
I realized students everywhere face this inefficiency: generic practice materials that don't adapt to individual knowledge gaps. This led me to build an AI-powered study companion that generates personalized quizzes from any text and provides instant, contextual feedback—deployed as a scalable serverless application on Google Cloud Run.
What it does
AI Study Coach transforms any study material into personalized, adaptive quizzes powered by Google Gemini 2.5 Flash Thinking:
Smart Quiz Generation - Paste text from textbooks, notes, or articles → get targeted questions across 4 types:
- Multiple choice
- True/false
- Fill-in-the-blank
- Short answer
AI-Powered Evaluation - Goes beyond right/wrong grading with contextual understanding:
- Identifies what was correct and what was missing
- Provides detailed, encouraging feedback
- Suggests specific improvements
Story Mode - Struggles with a concept? Get ELI5 explanations using analogies and simple language
Performance Analytics - After each quiz:
- Identifies weak topics and strong areas
- Detects misconceptions
- Delivers personalized study recommendations
Serverless Architecture - Responsive web interface with frontend and backend scaling independently based on demand
How we built it
Architecture: Microservices on Google Cloud Run
Frontend Service
- React single-page application built with Vite
- Served via Nginx container
- 512MB memory, 1 vCPU
- Quiz state managed client-side using localStorage
Backend Service
- Flask application with Gunicorn WSGI server
- 2GB memory, 2 vCPUs (optimized for AI processing)
- REST API with proper CORS configuration
- Request-based autoscaling
Cost Optimization: Minimum instances set to zero for both services → zero idle costs while maintaining instant availability
AI Integration: Google Gemini 2.5 Flash Thinking
Designed 4 specialized prompts in AI Studio for different tasks:
- Quiz generation from text
- Subjective answer evaluation
- Story mode explanations
- Overall feedback generation
Prompt Engineering Best Practices:
- JSON schema enforcement for structured output
- Few-shot examples for consistent behavior
- System instructions for quality standards
- Saved in AI Studio with shareable links for transparency
Deployment Pipeline
- Cloud Build automatically containerizes both services from Dockerfiles
- Multi-stage builds for optimized frontend image size
- Proper timeout configuration for AI processing
- Environment variable management via Vite's
import.meta.env
What we learned
Serverless architecture requires different thinking - Cloud Run's request-based autoscaling fundamentally changes design patterns compared to always-on servers. Splitting services by resource requirements (lightweight frontend vs. compute-heavy backend) optimizes both performance and cost.
Prompt engineering is a discipline - Production AI requires systematic iteration in AI Studio, not ad-hoc code tweaking. Structured prompts with JSON schemas, few-shot examples, and quality guidelines produce far more reliable outputs than natural language instructions alone.
Container runtime contracts matter - Cloud Run applications must:
- Listen on the PORT environment variable
- Respond to health checks within startup timeout
- Handle graceful shutdown signals
- Use production servers (gunicorn) not development servers
Microservices need careful integration - Communication across services requires attention to CORS, environment variables, and error propagation. Network failures must be handled gracefully with appropriate timeouts and user-facing messages.
What's next for AI Study Coach
Cross-device sync - Firestore integration for quiz history and progress tracking across devices using anonymous user IDs (no authentication required)
Analytics dashboard - Aggregate anonymized data to identify commonly missed topics and difficult question types, helping students discover areas others struggle with
Adaptive difficulty - Automatically adjust question complexity based on performance. Consistent success → harder questions; struggling → foundational review
Social features - Shareable quiz links, friend group leaderboards, and custom quiz challenges for increased engagement
Cloud Run Jobs - Batch processing for uploaded PDF textbooks and pre-generated quiz banks, demonstrating job execution model alongside current service architecture
Cost optimization - Intelligent caching for common question patterns, use lower-tier Gemini models for simple tasks while reserving Flash Thinking for complex evaluations
Built With
- css
- flask
- gemini
- gunicorn
- html
- javascript
- react
- typescript
- vite

Log in or sign up for Devpost to join the conversation.