Skip to content

Sai-Deekshith-06/leetcode-predictions-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode Predictions Viewer 📈

A full-stack web application that predicts LeetCode contest rating changes and compares them with actual contest results after the contest ends.

Built using FastAPI for the backend and React + Vite for the frontend, with Firebase integration for user grouping.


✨ What This Project Does

  • Fetches the predictions of rating changes for LeetCode Weekly & Biweekly contests from lccn.lbao.site

  • Fetches actual contest performance using LeetCode GraphQL

  • Supports multiple users via:

    • Channel ID (Firebase)
    • Manual username input
  • Displays results in a retro terminal-style UI

  • Uses LRU caching for fast repeated queries

  • Supports fallback backend URLs for reliability


🧱 Architecture Overview

Frontend (React + Vite)
        |
        |  REST API
        ↓
Backend (FastAPI)
        |
        ├── LeetCode GraphQL
        ├── Firebase (channels → users)
        └── LRU Cache

📂 Repository Structure

.
├── fast-api-backend/      # FastAPI backend
│   ├── main.py
│   ├── routers/
│   ├── helpers/
│   ├── middleware/
│   ├── models/
│   └── README.md          # Backend documentation (detailed)
│
└── frontend-vite/         # React + Vite frontend
    ├── src/
    ├── index.html
    ├── vite.config.js
    └── README.md

🚀 Quick Start (Local Development)

1️⃣ Backend Setup

cd fast-api-backend
uv sync
python start.py

Backend runs at:

http://localhost:7667

Docs:

📘 Detailed backend setup: ➡️ fast-api-backend/README.md


2️⃣ Frontend Setup

cd frontend-vite
npm install
npm run dev

Frontend runs at:

http://localhost:5173

🔌 Environment Configuration

Backend (fast-api-backend/.env)

PORT=7667
FIREBASE_CREDENTIALS_PATH=db_config/your-firebase.json
ALLOWED_ORIGINS=http://localhost:5173

Frontend (frontend-vite/.env.development)

VITE_API_BASE_URL=http://localhost:7667
VITE_API_BASE_URL_1=https://localhost:7768

📡 API Endpoints

Endpoint Method Purpose
/health GET Health check
/lc GET Rating predictions from lccn.lbao.site
/obtained GET Actual contest results from LeetCode GraphQL
/cache/clear POST Clear backend cache

(See backend README for full request/response formats)


🎨 Frontend Highlights

  • Retro CRT terminal UI

  • Light / Dark theme toggle

  • Parallel fetching of:

    • Predictions
    • Actual ratings
  • Graceful fallback to secondary backend

  • Responsive layout (mobile friendly)


🔮 Future Improvements

  • Redis instead of in-memory cache
  • Discord bot integration
  • Admin dashboard

👨‍💻 Author

Sai Deekshith Konda and Yashwanth Reddy LeetCode • Backend • Full-Stack Development

Releases

No releases published

Packages

No packages published