A LeetCode-style platform for mastering Low-Level Design (LLD) interviews, built with the MERN stack and Google Gemini AI.
| Document | Contents |
|---|---|
| RESEARCH_NOTE.txt | Learner problem, four categories of existing tools researched, four key gaps, product direction |
| DESIGN_NOTE.txt | MVP scope, user flow, domain classes/interfaces, evaluation approach, key trade-offs, extensibility |
| ARCHITECTURE.md | System design, data model, every API route, every important function, resilience behaviour, limitations |
| AI_USAGE.md | Five AI-assisted decisions: what was suggested, what was accepted or rejected, and why |
| README.md | This file — how to run the project |
| Layer | Technology |
|---|---|
| Frontend | React (Vite) + JavaScript |
| Styling | Vanilla CSS (LeetCode dark theme) |
| State | Zustand + React Router |
| Editor | Monaco Editor |
| Backend | Node.js + Express |
| Database | MongoDB + Mongoose |
| Cache / Live Sessions | Redis (ioredis) |
| AI | Google Gemini (configurable via GEMINI_MODEL) |
| Auth | JWT (JSON Web Tokens) |
DesignForge/
├── frontend/ # React Vite app
│ └── src/
│ ├── pages/ # HomePage, ProblemsPage, ProblemDetailPage, etc.
│ ├── components/# Navbar, ProtectedRoute
│ ├── services/ # Axios API service
│ └── store/ # Zustand state management
│
└── backend/ # Express API
├── models/ # User, Problem, Submission (Mongoose)
├── routes/ # auth, problems, submissions, sessions
├── middleware/ # JWT auth
└── utils/ # Gemini AI, scorer, seeder, redisClient, sessionStore, reviewer
- Node.js v18+
- MongoDB (local or Atlas)
- Google Gemini API Key
cd backend
npm installEdit backend/.env:
PORT=5000
MONGO_URI=mongodb://localhost:27017/lld-platform
REDIS_URL=redis://127.0.0.1:6379
JWT_SECRET=your_secret_key_here
JWT_EXPIRE=7d
GEMINI_API_KEY=your_gemini_api_key_here
GEMINI_MODEL=gemini-3.8-flash
NODE_ENV=developmentGet Gemini API Key: https://makersuite.google.com/app/apikey
GEMINI_MODELis configurable because Google retires model names fairly often. The previously usedgemini-1.5-flashbegan returning 404, which made every review silently fall back to a placeholder — set this to a current model.
Redis is optional. If it is unreachable the API keeps running and live code drafts fall back to an in-process store (see Redis).
cd backend
npm run devThe server auto-seeds 12 LLD problems on first run!
cd frontend
npm installcd frontend
npm run devNavigate to: http://localhost:5173
- 📋 12 LLD Problems — Parking Lot, Elevator, Chess, ATM, Vending Machine, and more
- 🏗️ Monaco Code Editor — Syntax highlighting for Java, Python, JS, C++, and Design Description
- 🤖 Gemini AI Review — Get detailed feedback on your LLD solutions
- 📊 Rubric Scoring — Scored on Class Design, Patterns, SOLID, Quality, Edge Cases
- 🔐 User Auth — JWT-based register/login
- 📈 Profile & History — Track your submissions and progress heatmap
- 🎨 LeetCode UI — Dark theme, split panel, filter sidebar
The frontend works with mock data even without MongoDB running. Problems, submissions, and AI feedback all have fallback mock data.
- Visit https://makersuite.google.com/app/apikey
- Create a free API key
- Add it to
backend/.envasGEMINI_API_KEY=your_key - Restart backend
Redis holds the code you are typing while you solve a problem. The backend
derives the countdown from a server-side deadline stored in Redis, so
reloading the page or switching tabs cannot buy you extra time.
- Opening a problem calls
POST /api/sessions/startand mints an attempt (sessionId) withdeadlineAt = now + problem.timeLimit. - The editor autosaves the buffer to
PUT /api/sessions/:sessionId, which refreshes the key's TTL. - On submit,
POST /api/submissionsreads the code from Redis (the request body cannot override it), grades it, writes theSubmissionto MongoDB, then sends the code to Gemini for review. The Redis draft is deleted once the code is safely in MongoDB.
Redis keys (TTL = timeLimit + 5 min grace so a just-expired auto-submit can
still read the buffer):
| Key | Holds |
|---|---|
attempt:{userId}:{problemId} |
active draft: code, language, deadline |
attempt-id:{sessionId} |
reverse index used to resolve a session |
REDIS_URL is the only setting. rediss:// turns on TLS automatically, so
paste whatever your provider gives you:
# Upstash
REDIS_URL=rediss://default:<password>@<region>.upstash.io:6379
# Redis Cloud
REDIS_URL=rediss://:<password>@<endpoint>:<port>
# AWS ElastiCache / self-hosted over TLS
REDIS_URL=rediss://:<password>@<host>:6379Check what it connected to via GET /api/health (sessionStore: connected) or
GET /api/sessions/status (the password is redacted from the response).