DEV Community

vishu
vishu

Posted on

Building LeetRun: How I Turned Scattered LeetCode Prep into a Gamified SaaS Platform

Live at leetrun.vercel.app - guest preview at /sheets, /patterns, /analytics before signup


The Problem: Prep Is Scattered, Unmotivating, and Lonely

If you have ever prepared for a software-engineering placement cycle, you know the ritual: open Blind 75 in one tab, NeetCode 150 in another, Striver's sheet in Notion, LeetCode in a third window, and manually tick boxes when you finally get an Accepted verdict.

Nobody tells you which pattern you are weak in relative to Google or Amazon interviews. Nobody holds you accountable when you skip a week. And every AI chatbot gives the same generic two-pointer lecture whether you solved 200 mediums yesterday or zero.

I built LeetRun to close that gap.


The Core Insight

The data already exists on LeetCode. The GraphQL API exposes full submission history. The product opportunity was indexing that history against curated sheets and wrapping it in motivation loops — not building another problem database from scratch.


What LeetRun Actually Ships

  • Curated sheets — Blind 75, NeetCode 150, Striver SDE, Striver A2Z, Striver 79, Love Babbar 450, Google Top 100, Amazon Top 100
  • Deep LeetCode Sync — one import of your full accepted history auto-checks every matched problem on every sheet
  • Interview patterns — DP, graphs, two pointers, sliding window and more, ranked by weightage with C++ templates
  • Build-your-own revision — random sets filtered by topic, difficulty, and solved state
  • Adaptive quests — daily, weekly, revision quests generated from weakest topics and target company, auto-verified against real solves
  • Savage AI mentor — context-aware coach with personality modes from supportive to savage (Pro unlocks full roast mode)
  • Leaderboards — global and friends boards by XP, level, streak, solve count, or contest rating
  • Multiplayer rooms — private 6-char codes, live solve progress, mock contests with your batch
  • Public profiles — shareable analytics, levels, streaks, badges for resumes and LinkedIn

Deep Sync: One Import, Every Sheet Auto-Checked

Basic LeetCode integrations show public profile stats. Deep Sync goes further.

User authenticates once with LeetCode session token
→ Backend fetches full accepted submission graph via GraphQL
→ Submissions normalised and matched against 1,500+ problem corpus
→ Every sheet row updates atomically
→ Client caches in localStorage SWR for instant repaint
Enter fullscreen mode Exit fullscreen mode

The reaction in user testing was always the same: "Wait, it already knows I solved all of these?"

Yes. That is the point.


Savage AI Mentor: Context Snapshot + RAG, Not a Chatbot Wrapper

When a user asks LeetRun a question, we do not pass a bare prompt to Gemini or Groq. We compile a context snapshot first:

  • LeetCode stats and current streak
  • Active daily quests
  • Sheet completion percentages
  • Weakest pattern families by weightage

On top of that, a RAG retrieval layer searches a corpus of 1,500+ indexed problems, 21 interview pattern families, and system-design notes. Lexical scoring selects citeable chunks before generation — reducing hallucinated constraints and invented problem variants.

Why Both Gemini and Groq?

Use Case Model
Complex explanations, multi-step reasoning, system design Gemini
Low-latency mid-session coaching Groq

The router sends queries to the optimal model based on complexity, expected response length, and whether the user is in savage mode (Pro) or standard coaching (Free).


Gamification That Respects the Grind

Interview prep is a marathon. Consistency beats intensity.

  • XP system — Easy 15, Medium 40, Hard 120, verified against real LeetCode accepts
  • Streaks and levels — visible on public profiles and leaderboards
  • Adaptive quests — daily (Free), weekly and revision (Pro)
  • Leaderboards — global and friends, pre-fetched server-side with 60s revalidation
  • Multiplayer rooms — 6-character codes, live member progress, mock contests
  • Badges and coins — tied to verified solves and quest completion

Pricing (Student-First, INR)

Tier Price Highlights
Free ₹0 forever Sync, daily quests, basic leaderboard, standard AI, 1 room
Pro ₹299/month Weekly + revision quests, savage AI, unlimited rooms, badges
Team Custom Up to 20 members, shared leaderboard, admin analytics

Founding offer: Pro free for the first 200 users, no credit card required.


Why PostgreSQL Over a Document Store

LeetRun's data model is deeply relational: users, problems, sheets, user-problem join tables, quest progress, XP events, leaderboard rankings, multiplayer room state, and friend graphs.

Firebase could work for a MVP checklist app. It would fight you once you need ranked leaderboards, quest verification against historical solves, and room state with live member progress.


Five Caching Layers

1. Next.js unstable_cache — leaderboard and profile data, 60s revalidation
2. HTTP Cache-Control (s-maxage + stale-while-revalidate) — analytics API routes
3. In-memory memoization — 1,500+ problem corpus loaded at boot
4. localStorage SWR — instant sheet and analytics repaints on client
5. Vercel Edge CDN — guest-preview routes (/sheets, /patterns, /analytics)
Enter fullscreen mode Exit fullscreen mode

Stack Summary

Layer Choices
Frontend Next.js 16, TypeScript, Tailwind CSS
Auth & Data Supabase Auth, PostgreSQL, Prisma ORM
AI Gemini API, Groq API, RAG retrieval, lexical scoring
External LeetCode GraphQL (authenticated Deep Sync)
Observability Sentry, PostHog
Deploy Vercel, Edge CDN, multi-layer SWR

What I Learned Building a Personal Product as SaaS

LeetRun started as a tool I needed during my own prep cycle. Productising it forced decisions client work sometimes lets you defer:

  • Pricing in INR for Indian students
  • Guest preview instead of hard paywalls
  • Founding-member caps instead of fake urgency
  • Caching architecture before traffic justifies it

The hardest engineering was not the UI. It was trust. Users hand over LeetCode session tokens and expect every sheet to stay in sync forever. Deep Sync, quest verification, and XP integrity had to be boringly correct. The fun parts (savage AI roasts, leaderboard climbs, room codes) only work if the data layer never lies.


Try it live: leetrun.vercel.app

Guest preview at /sheets, /patterns, and /analytics — no signup needed.


Tags: webdev javascript beginners career nextjs ai saas leetcode placement buildinpublic

read more - https://vishu.app/blog

Top comments (0)