LeetCode-style prep for agentic coding interviews: broken repo in a timed cloud sandbox, solve it in a browser-hosted IDE (Monaco editor + file tree + terminal + built-in Claude agent chat), and pytest is the grader. No SSH, no external tools — everything runs in one page.
- Next.js (App Router) + TypeScript + Tailwind v4
- Supabase Cloud (Postgres + Auth + RLS) — no Docker required
- E2B sandboxes (
e2bJS SDK)
-
Create a project at supabase.com/dashboard (or use
supabase projects list/supabase projects createafter CLI login). -
Log in and link the CLI (from this repo root):
supabase login npm run db:link
When prompted, paste your project ref (Settings → General → Reference ID).
Non-interactive CI: set
SUPABASE_ACCESS_TOKENand run
supabase link --project-ref <ref>. -
Apply the database schema (runs
supabase/migrations/*on the linked project):npm run db:push
-
Load the 10 curated problems — pick one:
- SQL Editor (Dashboard → SQL): paste the contents of
supabase/seed.sqland run once (idempotent upserts; safe to re-run). - Or after the Next app is configured, call
POST /api/problems/ingestwithx-admin-secret(uses the service role).
- SQL Editor (Dashboard → SQL): paste the contents of
-
GitHub OAuth (Dashboard → Authentication → Providers → GitHub):
- Add your GitHub OAuth App’s client ID and secret.
- Redirect URL in GitHub’s app settings must include Supabase’s callback, e.g.
https://<project-ref>.supabase.co/auth/v1/callback(see Auth URL on the provider page). - Under URL configuration, set Site URL to your deployed app (e.g.
https://your-app.vercel.app) and add Redirect URLs for
http://localhost:3000/**,http://127.0.0.1:3000/**, and your production/auth/callbackas needed.
-
Next.js env — Project Settings → API: copy Project URL, anon public, and service_role into
.env.local(see.env.example).
| Script | Purpose |
|---|---|
npm run db:link |
Link this folder to your Supabase project (supabase link) |
npm run db:push |
Push migrations to the linked cloud database |
npm run db:generate-seed |
Regenerate supabase/seed.sql from data/curated-problems.json |
npm run db:types |
Generate lib/database.types.ts from the linked DB (optional) |
npm run dev— local devnpm run build/npm run start— production
- Set
E2B_API_KEYin.env.local. - From the repo root run
npm run e2b:templateonce (builds theagentprep-sandboximage: Python 3, pip, compilers, common-devlibs). Then setE2B_SANDBOX_TEMPLATE=agentprep-sandboxin.env.local.
Grading: submit applies test_patch_diff with git apply, then python3 -m pytest <test_patch> …. The diff is not applied during the session.
The in-browser chat is powered by the Anthropic SDK. Set ANTHROPIC_API_KEY in .env.local (the key stays server-side). This is open-source — self-host and bring your own key.
| Method | Path | Purpose |
|---|---|---|
| POST | /api/sessions/start |
Start sandbox session |
| POST | /api/sessions/submit |
Grade and tear down sandbox |
| GET | /api/sessions/[id]/status |
Session status |
| POST | /api/sandbox/files/tree |
List files in the session sandbox |
| POST | /api/sandbox/files/read |
Read a file from the sandbox |
| POST | /api/sandbox/files/write |
Write a file in the sandbox |
| POST | /api/sandbox/exec |
Stream stdout/stderr from a command in the sandbox |
| POST | /api/agent/chat |
Stream an Anthropic tool-use agent wired to the sandbox |
| POST | /api/problems/ingest |
Upsert curated problems (admin secret) |
That file is mainly for the Supabase CLI (migrations path, optional local tools). Hosted Auth is configured in the Supabase Dashboard, not by committing secrets into config.toml.