Skip to content

thera-org/coderats

Repository files navigation

🧠 GitHub Contributions Ranking

A web platform built with Next.js (App Router) + NextAuth + Firebase Firestore that authenticates users via GitHub and displays a real-time ranking based on actual contribution data.


🚀 Features

  • 🔐 GitHub OAuth login (NextAuth)
  • 🔎 Real-time contribution tracking via GitHub API:
    • Commits
    • Pull Requests
    • Issues
    • Code Reviewsa
    • Project Diversity
    • Active Days
  • 📊 Automatic score calculation based on weighted criteria
  • 🏆 Real-time public leaderboard
  • 👤 Private profile page with user-specific stats
  • 🔄 Auto-sync every 24 hours + manual sync (up to 3x/day)

🧱 Tech Stack


🛠️ Setup

  1. Clone the repository:
git clone https://github.com/your-username/github-ranking.git
cd github-ranking
  1. Create .env.local and add:
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
NEXTAUTH_SECRET=your_secret
NEXTAUTH_URL=http://localhost:3000

NEXT_PUBLIC_FIREBASE_API_KEY=...
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=...
NEXT_PUBLIC_FIREBASE_PROJECT_ID=...
NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET=...
NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID=...
NEXT_PUBLIC_FIREBASE_APP_ID=...
  1. Install dependencies and start dev server:
npm install
npm run dev

🔁 Update Logic

  • 📅 User data is updated automatically once every 24 hours
  • 🔘 Users can trigger up to 3 manual updates per day
  • 🔒 All data is cached in Firestore to avoid GitHub API overuse

📦 Project Structure

├── app/
│   ├── profile/
│   ├── ranking/
├── lib/
│   ├── firestore-user.ts       ← leaderboard logic + syncing
│   ├── github/
│   │   └── getUserStats.ts     ← GitHub API integration
├── components/                 ← UI components

📈 Scoring Breakdown

Criteria Weight (%)
Commits 40%
Pull Requests 25%
Issues 15%
Code Reviews 10%
Project Diversity 5%
Active Days 3%
Streak (coming) 2%

✨ Future Improvements

  • 🧩 Contribution streak tracking
  • 🕒 CRON-based background sync (Firebase Functions)
  • 📈 Personal dashboard with history

📄 License

This project is licensed under the MIT License.


🙌 Credits

Releases

No releases published

Packages

No packages published

Contributors 5

Languages