Find LeetCode problems by meaning — not just by name.
Have you ever faced a situation where you vaguely remembered a LeetCode problem you once solved, but couldn’t recall its exact title? Or come across a question in an online assessment (OA) that felt familiar — like a slightly tweaked version of a LeetCode problem — but no amount of keyword guessing could help you find it again?
Leet-Search is built to solve exactly that.
A semantic search engine for LeetCode problems — built with FastAPI, Next.js, and pgvector.Leet-Search understands the meaning and context behind queries, allowing users to find relevant problems based on intent rather than exact wording. Whether you're preparing for coding interviews or exploring new problem types, Leet-Search helps you discover the right problems faster and more intuitively.
🔗 Live App: leet-search-gray.vercel.app
📦 Repository: github.com/Eli4479/Leet-Search
- 🔍 Semantic Search — vector-based querying of LeetCode problem descriptions
- 🧩 Modular FastAPI Architecture — clean separation of concerns (routes, services, controllers)
- 🔗 Supabase — hosted PostgreSQL with
pgvector
leet-search/
├── backend/
│ ├── app/
│ │ ├── controllers/ # Handles endpoint logic
│ │ ├── database/ # DB connection + Supabase client
│ │ ├── models/ # Pydantic schemas & data models
│ │ ├── routes/ # API route registration
│ │ ├── services/ # Core business logic
│ │ ├── utils/ # Helper utility functions
│ │ └── main.py # FastAPI app entry point
│ ├── .env # Environment variables
│ └── requirements.txt # Python dependencies
│
├── frontend/
│ ├── .next/ # Next.js build output
│ ├── node_modules/
│ ├── public/ # Static assets
│ ├── src/ # All frontend source code
│ ├── .gitignore
│ ├── components.json
│ ├── eslint.config.mjs
│ ├── next-env.d.ts
│ ├── next.config.ts
│ ├── package-lock.json
│ ├── package.json
│ ├── postcss.config.mjs
│ ├── .env
│ ├── README.md
│ └── tsconfig.json
├── .gitignore
└── README.md # Project documentation
In your .env file in frontend (excluded via .gitignore), define:
NEXT_PUBLIC_API_URL=http://127.0.0.1:8000/apiIn your .env file in backend (excluded via .gitignore), define:
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_KEY=your-supabase-service-role-keyPOST /api/search?page=1{
"query": "graph dfs",
"limit": 5
}[
{
"id": "1472",
"title": "Design Browser History",
"url": "https://leetcode.com/problems/design-browser-history/",
"paid_only": false,
"match_percentage": 77.24,
"content": "formated HTML content of the problem.",
"original_content": "original HTML content of the problem."
},
...
]| Field | Description |
|---|---|
id |
LeetCode problem ID |
title |
Name of the problem |
url |
Direct LeetCode URL |
paid_only |
Whether the problem is paid-only |
match_percentage |
Similarity score with query (0–100%) |
content |
Formatted HTML content of the problem |
original_content |
Original HTML content (for reference) |
| Tool/Service | Description |
|---|---|
| 🐍 FastAPI | Fast Python web framework (ASGI-compatible) |
| 🔗 Supabase | PostgreSQL + pgvector for embeddings |
| 🚀 Next.js | React framework for the frontend |
| 💎 shadcn/ui | Beautiful UI components for Next.js |
We’re thrilled you’re considering contributing to Leet-Search — a fast, intelligent semantic search engine for LeetCode problems!
Whether you're:
- Fixing bugs 🐛
- Improving performance ⚡
- Enhancing the UI/UX 💅
- Refining search algorithms 🔍
- Writing tests or documentation 🧪📝
- Your contribution matters 💪🏻
-
Fork the repo and create your branch:
git checkout -b feature/your-feature-name
-
Commit your changes:
git commit -m "feat: brief description of your change" -
Push to GitHub:
git push origin feature/your-feature-name
-
Open a Pull Request here 🚀
Found a bug or have a feature idea? Open an Issue – we’d love to discuss it with you!
- 🔥 Add support for more problem platforms (e.g., Codeforces, GFG)
- ✨ Enhance the frontend UX (Next.js + Tailwind)
- 🧠 Improve vector similarity logic or embeddings
- 🧪 Write unit tests for routes/services
- 🛡 Add rate limiting, error logging, or caching
Want to run Leet-Search on your machine? Here's how:
git clone https://github.com/Eli4479/Leet-Search.git
cd Leet-Search-
Navigate to backend and create a virtual environment:
cd backend python3 -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Create a
.envfile:SUPABASE_URL=https://your-project.supabase.co SUPABASE_KEY=your-supabase-service-role-key
-
Start the FastAPI server:
uvicorn app.main:app --reload
API will run at: http://127.0.0.1:8000
-
Navigate to frontend and install packages:
cd ../frontend npm install -
Start the frontend dev server:
npm run dev
Your app will run at: http://localhost:3000
Prepare the LeetCode problem embeddings and load them into Supabase:
- Open your Supabase project
- Go to SQL Editor
- Open the file
backend/scripts/sql.txt - Copy its contents and run the query
This will create the problems_bge table with the necessary columns (including vector type for embeddings).
Open backend/app/main.py and un-comment the following line:
# populate_db()Change it to:
populate_db()cd backend
uvicorn app.main:app --reloadThis will:
- Fetch LeetCode problems (free + paid)
- Format and clean problem content
- Generate embeddings using OpenAI (or your configured model)
- Save the output to:
backend/scripts/problems.csv
- Go to your Supabase Table Editor
- Select the
problems_bgetable - Click "Import Data"
- Upload the generated CSV file from:
backend/scripts/problems.csv✅ NOTE: After populating, you have to comment out
populate_db()again to avoid re-triggering on future backend runs.
- Visit
http://localhost:3000 - Type a query like
graph dfs - Confirm the results load from your FastAPI backend
- Format code before committing (
black,prettier, etc.) - Use conventional commit messages (e.g.
feat:,fix:,docs:) - Open small, focused PRs with clear descriptions
Whether you're here to contribute, learn, or get inspired — thank you for checking out Leet-Search!
Built with ❤️ and ☕ by Aryan Patel