An intelligent coding practice platform that goes beyond pass/fail. Submit your code, get real-time AI feedback powered by Claude, and unlock progressively deeper hints as you learn β not just answers.
![]() |
![]() |
| Login with Google, GitHub, or Dev mode | 10 curated DSA problems with difficulty & topic tags |
![]() |
![]() |
| Monaco editor + live code execution + AI analysis | Knowledge radar chart, stats & recent activity |
- π€ AI Tutoring β Submit code and receive instant, Socratic-style feedback from Claude (claude-sonnet-4-5). The tutor nudges you towards the answer rather than giving it away.
- π‘ 4-Level Hint Escalation β Start with a directional nudge, escalate through approach β structure β full walkthrough at your own pace.
- π¬ Follow-up Chat β Ask follow-up questions in natural language and continue the tutoring conversation with full context.
- β‘ Real-time Streaming β AI responses stream token-by-token via SSE so you see feedback as it's generated.
- π₯οΈ Monaco Editor β VS Code's editor in the browser with syntax highlighting for Python, Java, and JavaScript.
βΆοΈ Code Execution β Solutions are run against test cases using the Piston code execution engine.- π Knowledge Dashboard β Radar chart visualising topic proficiency across Arrays, Strings, Hash Maps, Stack/Queue, Graphs, and more.
- π OAuth 2.0 Auth β Sign in with Google or GitHub; JWT access tokens with silent background refresh.
- βοΈ Assistance Levels β Four tutor personas from "Nudge me" (minimal hints) to "Full guidance".
- π οΈ Admin Panel β CRUD interface for managing the problem bank.
| Layer | Technology |
|---|---|
| Frontend | React 19, TypeScript, Vite, Tailwind CSS |
| Editor | Monaco Editor (@monaco-editor/react) |
| State | Zustand + persist middleware |
| Backend | FastAPI (Python 3.12), async/await throughout |
| Database | MongoDB 7 via Beanie ODM |
| Cache / Rate-limit | Redis 7.2 + SlowAPI |
| AI | Anthropic Claude (claude-sonnet-4-5) via SSE streaming |
| Code Execution | Piston API (self-hostable, multi-language) |
| Auth | OAuth 2.0 (Google + GitHub), JWT (access + refresh tokens) |
| Infrastructure | Docker Compose |
- Docker Desktop β for MongoDB, Redis
- Python 3.12+
- Node.js 18+
- An Anthropic API key
- (Optional) Google and/or GitHub OAuth credentials for social login
git clone https://github.com/sgkul2000/CodeTutor.git
cd CodeTutordocker compose up -dThis starts:
- MongoDB 7 on port
27017 - Redis 7.2 on port
6379
cd ai-tutor-backend
cp .env.example .env # or create .env manually (see below)Minimum required .env:
# MongoDB
MONGODB_URL=mongodb://localhost:27017
MONGODB_DB_NAME=ai_tutor
# Redis
REDIS_URL=redis://localhost:6379
# JWT
JWT_SECRET_KEY=your-super-secret-key-change-in-production
JWT_ACCESS_TOKEN_EXPIRE_MINUTES=15
JWT_REFRESH_TOKEN_EXPIRE_DAYS=30
# Anthropic
ANTHROPIC_API_KEY=sk-ant-...
# App
ENVIRONMENT=development
BACKEND_URL=http://localhost:8000
FRONTEND_URL=http://localhost:5173
# OAuth (optional β dev login works without these)
# GOOGLE_CLIENT_ID=...
# GOOGLE_CLIENT_SECRET=...
# GITHUB_CLIENT_ID=...
# GITHUB_CLIENT_SECRET=...# In ai-tutor-backend/
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
# Seed 10 DSA problems
python -m scripts.seed_problemsuvicorn app.main:app --reload --port 8000API docs available at http://localhost:8000/docs
cd ../ai-tutor-frontend
npm install
npm run devOpen http://localhost:5173 in your browser.
Click β‘ Sign in (Dev Mode only) on the login page β no OAuth credentials required in development.
CodeTutor/
βββ docker-compose.yml # MongoDB + Redis
βββ ai-tutor-backend/
β βββ app/
β β βββ main.py # FastAPI entry-point
β β βββ config.py # Settings (pydantic-settings)
β β βββ models/ # Beanie ODM models (User, Problem, Submissionβ¦)
β β βββ routers/ # auth, problems, submissions, tutor
β β βββ services/
β β βββ auth_service.py # JWT helpers, OAuth client
β β βββ judge_service.py # Piston API integration
β β βββ tutor_service.py # Claude streaming, hint escalation
β βββ scripts/
β β βββ seed_problems.py # Seeds 10 starter DSA problems
β βββ requirements.txt
βββ ai-tutor-frontend/
βββ src/
β βββ api/ # Axios client (silent refresh) + SSE helpers
β βββ components/ # Shared UI components
β βββ hooks/ # useAuth, useTutor, useProblemsβ¦
β βββ pages/ # Login, Problems, ProblemSolve, Dashboard
β βββ stores/ # Zustand app store
β βββ types/ # Shared TypeScript types
βββ package.json
- Submit β Your code is sent to the Piston execution engine and run against test cases.
- Analyse β Regardless of pass/fail, the code and test results are sent to Claude with a Socratic prompt tailored to your chosen assistance level (1β4).
- Stream β Claude's response streams back token-by-token via SSE and appears in real time.
- Hint escalation β If you need more help, click Deeper hint β to escalate from Direction β Approach β Structure β Full Walkthrough.
- Follow-up β Ask questions in the chat input; the full conversation history is maintained so Claude has context.
| Directory | Command | Description |
|---|---|---|
| root | docker compose up -d |
Start MongoDB + Redis |
ai-tutor-backend |
uvicorn app.main:app --reload |
Start API server (port 8000) |
ai-tutor-backend |
python -m scripts.seed_problems |
Seed 10 DSA problems |
ai-tutor-frontend |
npm run dev |
Start Vite dev server (port 5173) |
ai-tutor-frontend |
npm run build |
Production build |
ai-tutor-frontend |
npm run lint |
ESLint check |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/auth/dev-login |
Dev-only instant login |
GET |
/api/auth/{provider} |
OAuth redirect (google/github) |
POST |
/api/auth/refresh |
Silent token refresh |
GET |
/api/problems |
List problems (filter by difficulty/topic) |
POST |
/api/submissions |
Submit code for execution |
POST |
/api/tutor/analyze |
Stream AI analysis of a submission |
POST |
/api/tutor/hint |
Stream next hint level |
POST |
/api/tutor/ask |
Stream follow-up chat response |
GET |
/api/users/dashboard |
User stats + topic proficiency |
Full interactive docs: http://localhost:8000/docs
MIT



