An AI-powered coding review trainer that dynamically generates programming challenges using the Anthropic API (Claude). Each session produces fresh challenges across 5 structured learning blocks and 5 programming languages.
Phase 1 — FastAPI + Railway/Render deployment (this repo)
Phase 2 — AWS Lambda + API Gateway + S3 rebuild (coming after Phase 1 is live)
Select a programming language, pick a learning block, and Claude generates a tailored challenge on demand. Every session is different — same learning objectives, fresh scenario each time — so the app has genuine replay value.
5 Learning Blocks
| # | Block | What You Practice |
|---|---|---|
| 1 | Language Fundamentals | Core syntax and idiomatic patterns |
| 2 | Code Review | Spot bugs, security flaws, and inefficiencies |
| 3 | Algorithm Patterns | Hashmaps, stacks, sliding window, recursion |
| 4 | Edge Cases & Error Handling | Defensive coding and robust error handling |
| 5 | Full Module Review | Correctness, efficiency, security, readability |
5 Languages: Python, JavaScript, C#, Java, Go
┌────────────────────────────────────────────────────────────┐
│ Presentation Tier │
│ HTML / JS / CSS — single-page frontend │
│ Language selector → block nav → challenge → hint/answer │
└────────────────────────────┬───────────────────────────────┘
│ POST /generate
▼
┌────────────────────────────────────────────────────────────┐
│ Application Tier │
│ FastAPI (Python) — main.py │
│ • Validates request (language, block, difficulty) │
│ • Builds structured prompt for each block type │
│ • Calls Anthropic API via anthropic Python SDK │
│ • Returns structured JSON challenge │
└────────────────────────────┬───────────────────────────────┘
│ External API call
▼
┌──────────────────────┐
│ Anthropic API │
│ (external service) │
│ claude-haiku-4-5 │
└──────────────────────┘
No data tier — there is no database or file store. The Anthropic API is a third-party external service, not an owned data layer. A true data tier would be added in a future version (e.g., storing user session history).
API endpoint: POST /generate
Request:
{ "language": "python", "block_number": 1 }Response:
{
"challenge": "...",
"context": "...",
"hint": "...",
"answer": "...",
"tags": ["list-comprehension", "iteration"],
"difficulty": "beginner"
}Valid languages: python, javascript, csharp, java, go
Valid block numbers: 1 through 5
Prerequisites: Python 3.11+ and an Anthropic API key
# 1. Clone the repo
git clone https://github.com/your-username/coding-trainer.git
cd coding-trainer
# 2. Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh # macOS/Linux
# or: winget install astral-sh.uv # Windows
# 3. Install dependencies and create virtual environment
uv sync
# 4. Set up your API key
copy .env.example .env # Windows
cp .env.example .env # macOS / Linux
# Then open .env and replace "your_key_here" with your actual key
# 5. Run the server
uv run uvicorn main:app --reload --port 8000Open http://localhost:8000 in your browser.
Note: Use
uvicorndirectly for local development — not the Procfile (which uses$PORT, a Unix env var).
- Push this repo to GitHub
- Create a new project at railway.app → Deploy from GitHub repo
- In the Railway project settings → Variables → add:
ANTHROPIC_API_KEY = sk-ant-your-key-here - Railway auto-detects the
Procfileand deploys. Your app will be live at a*.up.railway.appURL.
- Push this repo to GitHub
- Create a new Web Service at render.com
- Connect your GitHub repo
- Settings:
- Build Command:
pip install -r requirements.txt - Start Command:
uvicorn main:app --host 0.0.0.0 --port $PORT
- Build Command:
- In Environment → add:
ANTHROPIC_API_KEY = sk-ant-your-key-here - Deploy. Render provides a
*.onrender.comURL.
Cold starts: Free-tier instances on both platforms sleep after inactivity. The first request after idle may take 10–15 seconds — the frontend shows a "Server warming up" message automatically.
This project is designed to be self-hosted. Every fork requires its own Anthropic API key — no shared keys, no shared costs.
- Fork this repo on GitHub
- Deploy to Railway or Render (steps above)
- Add your own
ANTHROPIC_API_KEYin the platform's environment settings - Done — your own private instance, your own costs
Add a new language:
- Add it to
LANGUAGE_DISPLAYinmain.py - Update the
validate_languageallowed set - Add a
<button>to the language selector instatic/index.html
Add a new block:
- Add a prompt to the
promptsdict inbuild_prompt()inmain.py - Update the block selector in
static/index.html - Update
BLOCK_NAMESin the JavaScript
Switch to a more capable model:
In main.py, change model="claude-haiku-4-5-20251001" to "claude-sonnet-4-6" for higher quality challenges at higher cost.
Coming soon — add screenshots of the challenge card, hint reveal, and answer reveal here.
After Phase 1 is live, this project will be rebuilt on AWS infrastructure to demonstrate cloud architecture skills:
- AWS Lambda — Python function handling challenge generation
- API Gateway — HTTP endpoint in front of Lambda
- S3 — Static frontend hosting
- Secrets Manager / SSM — API key storage (no
.envfiles)
Both versions will remain available as separate branches/repos. The two-phase story (fast deployment → cloud-native rebuild) demonstrates both product delivery and AWS cert knowledge.
MIT — see LICENSE