Skip to content

About

A Platform to learn and practise LLD Questiuons

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

LLD Arena - Low-Level Design Practice Platform

A LeetCode-style platform for mastering Low-Level Design (LLD) interviews, built with the MERN stack and Google Gemini AI.

📄 Deliverables

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

🚀 Tech Stack

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)

📁 Project Structure

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

🛠️ Setup & Installation

Prerequisites

  • Node.js v18+
  • MongoDB (local or Atlas)
  • Google Gemini API Key

1. Clone & Install Backend

cd backend
npm install

2. Configure Environment

Edit 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=development

Get Gemini API Key: https://makersuite.google.com/app/apikey

GEMINI_MODEL is configurable because Google retires model names fairly often. The previously used gemini-1.5-flash began 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).

3. Start Backend

cd backend
npm run dev

The server auto-seeds 12 LLD problems on first run!

4. Install Frontend

cd frontend
npm install

5. Start Frontend

cd frontend
npm run dev

6. Open Browser

Navigate to: http://localhost:5173

✨ Features

  • 📋 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

🧪 Testing Without Backend

The frontend works with mock data even without MongoDB running. Problems, submissions, and AI feedback all have fallback mock data.

📝 Adding Gemini API Key

  1. Visit https://makersuite.google.com/app/apikey
  2. Create a free API key
  3. Add it to backend/.env as GEMINI_API_KEY=your_key
  4. Restart backend

🗄️ Redis (live code sessions)

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.

Flow

  1. Opening a problem calls POST /api/sessions/start and mints an attempt (sessionId) with deadlineAt = now + problem.timeLimit.
  2. The editor autosaves the buffer to PUT /api/sessions/:sessionId, which refreshes the key's TTL.
  3. On submit, POST /api/submissions reads the code from Redis (the request body cannot override it), grades it, writes the Submission to 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

Connecting a cloud Redis

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>:6379

Check what it connected to via GET /api/health (sessionStore: connected) or GET /api/sessions/status (the password is redacted from the response).

About

A Platform to learn and practise LLD Questiuons

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages