Socratic method-based math tutoring powered by Claude AI. Never gives direct answers - guides students through problems with questioning and encouragement.
- Text & Image Input - Type problems or upload screenshots with automatic OCR
- Socratic Dialogue - AI asks guiding questions instead of giving solutions
- Math Rendering - Beautiful LaTeX formatting via KaTeX
- Conversation History - Save and resume tutoring sessions
- Arithmetic Verification - Validates student calculations while staying encouraging
- Frontend: Next.js 16 + React 19 + TypeScript
- Backend: Convex (real-time database)
- AI: Claude Sonnet 4.5 via Anthropic API
- Auth: Clerk
- Styling: Tailwind CSS v4
# Install dependencies
bun install
# Set up environment variables
cp .env.example .env.localCreate .env.local:
# Clerk Authentication
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_test_...
CLERK_SECRET_KEY=sk_test_...
CLERK_JWT_ISSUER_DOMAIN=your-domain.clerk.accounts.dev
# Convex Database
NEXT_PUBLIC_CONVEX_URL=https://...convex.cloud
# Anthropic API
ANTHROPIC_API_KEY=sk-ant-...Important: Add CLERK_JWT_ISSUER_DOMAIN to your Convex dashboard environment variables as well.
bun run devThis runs both Convex backend and Next.js frontend in parallel.
Separate commands:
bun run convex-dev # Convex only
bun run next-dev # Next.js onlybun run build # Deploys Convex then builds Next.js
bun run start # Start production serverStudent: "Help me solve 2x + 5 = 13" AI: "What are we trying to find?" Student: "x" AI: "Right! To get x alone, we need to undo the +5 and ×2. Which should we undo first?"
Student: [uploads screenshot of "x² + 5x + 6 = 0"] AI: "I can see the equation x² + 5x + 6 = 0. What methods do you know for solving quadratic equations?" Student: "Factoring?" AI: "Great choice! Can you find two numbers that multiply to 6 and add to 5?"
Student: "A train travels 120 miles in 2 hours. What's its speed?" AI: "Let's break this down. What information do we have?" Student: "120 miles and 2 hours" AI: "Perfect! And what's the relationship between distance, time, and speed?"
Student: "Find area of circle with radius 5" AI: "What's the formula for the area of a circle?" Student: "πr²" AI: "Exactly! So what would we substitute for r?"
Student: "What's the derivative of x²?" AI: "Do you remember the power rule for derivatives?" Student: "Bring down the exponent?" AI: "Good start! Can you write out the full power rule formula?"
- Student submits problem (text or image)
- AI identifies concepts and asks clarifying questions
- Student responds with their thinking
- AI guides next step without giving answers
- Validates arithmetic while staying encouraging
- Repeats until solution is reached
The AI maintains context of the last 15 messages in each conversation.
app/
├── api/chat/route.ts # Claude API streaming endpoint
├── chat/[id]/page.tsx # Individual conversation view
├── chats/page.tsx # All conversations list
└── page.tsx # Home page with new chat input
components/
├── ChatInterface.tsx # Main chat component
├── MessageInput.tsx # Text input + image upload
├── MessageList.tsx # Message display with KaTeX
└── ConversationSidebar.tsx # History navigation
convex/
├── schema.ts # Database schema
├── conversations.ts # CRUD operations
├── messages.ts # Message queries/mutations
└── files.ts # Image storage
lib/
└── prompts.ts # Socratic tutoring system prompt
Enter- Send messageShift+Enter- New lineCmd+.- Toggle sidebarCmd+V- Paste image from clipboard
- Message Context: Sliding window of last 15 messages per conversation
- Streaming: Real-time AI responses using Vercel AI SDK
- Image Storage: Files stored in Convex with signed URLs
- Auth Flow: Clerk JWT tokens validated by Convex backend
The system prompt enforces:
- Never giving direct answers
- Breaking problems into small steps
- Asking guiding questions first
- Providing hints after 2-3 struggles
- Verifying arithmetic rigorously
- Distinguishing method correctness from calculation accuracy
MIT