This is a starter kit for building an AI-powered math problem generator application. The goal is to create a standalone prototype that uses AI to generate math word problems suitable for Primary 5 students, saves the problems and user submissions to a database, and provides personalized feedback.
- Frontend Framework: Next.js 14 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS
- Database: Supabase
- AI Integration: Google Generative AI (Gemini)
git clone <your-repo-url>
cd math-problem-generator- Go to https://supabase.com and create a free account
- Create a new project
- Go to Settings → API to find your:
- Project URL (starts with
https://) - Anon/Public Key
- Project URL (starts with
- In your Supabase dashboard, go to SQL Editor
- Copy and paste the contents of
database.sql - Click "Run" to create the tables and policies
- Go to Google AI Studio
- Create a new API key for Gemini
- Copy
.env.local.exampleto.env.local:cp .env.local.example .env.local
- Edit
.env.localand add your actual keys:NEXT_PUBLIC_SUPABASE_URL=your_actual_supabase_url NEXT_PUBLIC_SUPABASE_ANON_KEY=your_actual_supabase_anon_key GOOGLE_API_KEY=your_actual_google_api_key
npm installnpm run devOpen http://localhost:3000 in your browser.
Complete the TODO sections in the main page component:
- generateProblem: Call your API route to generate a new math problem
- submitAnswer: Submit the user's answer and get feedback
Create a new API route that handles:
- Use Google's Gemini AI to generate a math word problem
- The AI should return JSON with:
{ "problem_text": "A bakery sold 45 cupcakes...", "final_answer": 15 } - Save the problem to
math_problem_sessionstable - Return the problem and session ID to the frontend
- Receive the session ID and user's answer
- Check if the answer is correct
- Use AI to generate personalized feedback based on:
- The original problem
- The correct answer
- The user's answer
- Whether they got it right or wrong
- Save the submission to
math_problem_submissionstable - Return the feedback and correctness to the frontend
- AI generates appropriate Primary 5 level math problems
- Problems and answers are saved to Supabase
- User submissions are saved with feedback
- AI generates helpful, personalized feedback
- UI is clean and mobile-responsive
- Error handling for API failures
- Loading states during API calls
- Push your code to GitHub
- Go to Vercel and import your repository
- Add your environment variables in Vercel's project settings
- Deploy!
When submitting your assessment, provide:
- GitHub Repository URL: Make sure it's public
- Live Demo URL: Your Vercel deployment
- Supabase Credentials: Add these to your README for testing:
SUPABASE_URL: [Your Supabase Project URL] SUPABASE_ANON_KEY: [Your Supabase Anon Key]
Please fill in this section with any important notes about your implementation, design decisions, challenges faced, or features you're particularly proud of.
If you have time, consider adding:
- Difficulty levels (Easy/Medium/Hard)
- Problem history view
- Score tracking
- Different problem types (addition, subtraction, multiplication, division)
- Hints system
- Step-by-step solution explanations
Good luck with your assessment! 🎯