LeetRun
A SaaS-grade, gamified DSA placement platform built for scale — curated sheets (Blind 75, NeetCode 150, Striver SDE & A2Z, Love Babbar 450, company sets), Deep LeetCode Sync that auto-marks every sheet, interview patterns ranked by weightage, adaptive quests, savage AI mentor, real-time multiplayer lobbies, and full observability. Guest-preview routes let anyone explore the product before signing up.
Client / Type
SaaS · EdTech · Personal Product
Stack / Services
Next.js 16, Prisma, PostgreSQL, Supabase Auth, Sentry, PostHog, Gemini/Groq AI, Multi-layer caching, LeetCode GraphQL

Deep LeetCode Sync & Analytics
One-time Deep Sync imports the user's entire LeetCode solve history via authenticated GraphQL — every accepted problem, not just recent submissions. Solved slugs are indexed against 1,500+ curated sheet problems and auto-checked off across Blind 75, NeetCode 150, Striver SDE/A2Z, Love Babbar 450, and company sets. Analytics surfaces solve breakdowns, topic mastery, language stats, a 12-week activity heatmap, streaks, XP, and contest ratings — all fan-out in parallel from PostgreSQL via Prisma. API responses ship with Cache-Control stale-while-revalidate headers; the client layer uses a localStorage SWR cache so pages paint instantly on reload.

Curated Sheets with Auto-Progress
Eight curated and company-wise sheets ship as structured JSON corpora, indexed into a flat slug map at boot. When Deep Sync runs, a single pass marks matching problems solved on every sheet the user follows — no manual checkboxes. Focus sheets pin to the dashboard; progress bars, difficulty breakdowns, and section-level completion update in real time. Guests can browse the full sheet library with sample progress to see the product before signing up.

Savage AI Mentor with RAG Grounding
The AI coach pulls a rich context snapshot — LeetCode stats, weakest topics, streak state, active quests, and sheet progress — then grounds replies with lightweight retrieval over 1,500+ sheet problems, 21 interview pattern families, and system-design notes. Lexical scoring over a pre-built corpus keeps answers citable without hallucinating; the chunk format is embedding-ready for a future pgvector upgrade. Personality modes range from supportive to savage; proactive nudges fire when streaks break or solve counts stall.

Leaderboards, Lobbies & Gamification
Global and friends-only leaderboards rank by XP, level, streak, solve counts, or LeetCode contest rating. Server-side unstable_cache pre-fetches the top 200 candidates and re-sorts per axis without extra DB round-trips — 60s revalidation keeps rankings fresh under load. Multiplayer coding rooms generate unique 6-char codes, track live solve progress, and power mock-contest study sessions. XP (Easy 15 / Medium 40 / Hard 120), coins, badges, and adaptive daily/weekly/revision quests auto-verify against real LeetCode solves.

Production Observability & Product Analytics
Sentry is wired across Node.js server, Edge runtime, and client via @sentry/nextjs instrumentation — 10% trace sampling, graceful no-op when DSN is unset, and onRequestError forwarding for every server render and API route failure. PostHog runs dual-track: client-side SPA pageviews with Supabase user identification, plus server-side capture (posthog-node) for signup, onboarding, subscription, and referral funnels so backend state matches analytics dashboards. Both integrations no-op in dev when keys are missing.

Multi-Layer Caching, API Protection & Scale-Ready Infra
Caching is layered at every tier so read-heavy endpoints never hammer the DB: Next.js unstable_cache (60s revalidation) for leaderboard and public profiles, HTTP Cache-Control with s-maxage + stale-while-revalidate on analytics/dashboard APIs, in-memory memoization for the 1,500+ problem corpus, and a namespaced localStorage SWR cache on the client (wiped on logout). Edge/CDN caching on Vercel absorbs anonymous guest-preview traffic on /sheets, /patterns, and /analytics. API hardening: Supabase session auth on every write path, middleware splits guest-preview routes from strict auth-required ones (/rooms, /chat, /settings), and LeetCode GraphQL calls are isolated with no-store fetch to avoid stale credential leaks. PostgreSQL + Prisma with parallel Promise.all fan-out and encrypted session cookies — built to scale from hundreds to millions of users on serverless without UX degradation.
