Skip to content

Enhance Contribution Endpoint with Rate Limiting and Token Support - #9026

Open
Rakshak05 wants to merge 2 commits into
JhaSourav07:mainfrom
Rakshak05:issue-#8572
Open

Enhance Contribution Endpoint with Rate Limiting and Token Support#9026
Rakshak05 wants to merge 2 commits into
JhaSourav07:mainfrom
Rakshak05:issue-#8572

Conversation

@Rakshak05

Copy link
Copy Markdown
Contributor

Description

Fixes #8572

Adds per-IP rate limiting (10 req/min) on contribution data requests, creates the /api/contributions endpoint, supports caller-supplied GitHub tokens (Authorization: Bearer <token>, x-github-token, or ?token=) for high-volume usage, and attaches standard Retry-After & X-RateLimit-* headers to HTTP 429 rate-limited responses.

Pillar

  • 🎨 Pillar 1 — New Theme Design
  • 📐 Pillar 2 — Geometric SVG Improvement
  • 🕐 Pillar 3 — Timezone Logic Optimization
  • 🛠️ Other (Bug fix, refactoring, docs)

Visual Preview

N/A (Backend API rate-limiting & endpoint resilience fix)

Checklist before requesting a review:

  • I have read the CONTRIBUTING.md file.
  • I have tested these changes locally (localhost:3000/api/streak?user=YOUR_USERNAME).
  • I have run npm run format and npm run lint locally and resolved all errors (CI will fail otherwise).
  • My commits follow the Conventional Commits format (e.g., feat(themes): ..., fix(calculate): ...).
  • I have updated README.md if I added a new theme or URL parameter.
  • I have starred the repo.
  • I have made sure that i have only one commit to merge in this PR.
  • The SVG output matches the CommitPulse "premium quality" aesthetic standard (no raw elements, smooth animations, correct fonts).
  • (Recommended) I joined the CommitPulse Discord community for contributor discussions, mentorship, and faster PR support.

Copilot AI lite review requested due to automatic review settings August 14, 2026 08:12
@vercel

vercel Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

@Rakshak05 is attempting to deploy a commit to the jhasourav07's projects Team on Vercel.

A member of the Team first needs to authorize it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@retenta-bot

retenta-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

This pull request adds important features to the contribution endpoint, including rate limiting and support for caller tokens, which aligns with our previous decisions on handling API rate limits effectively. For instance, the implementation of rate limit handling in the /api/streak endpoint has set a precedent for improving user experience during rate limit exhaustion. Additionally, the focus on security in past decisions, such as sanitizing error responses, complements this enhancement. Thank you for your contributions, and I look forward to your updates!

@retenta-bot retenta-bot Bot changed the title fix(api): add rate limiting and caller token support to contribution endpoint (#8572) Enhance Contribution Endpoint with Rate Limiting and Token Support Aug 14, 2026
@github-actions github-actions Bot added the status:blocked This PR is blocked due to a failing CI check. label Aug 14, 2026
@github-actions github-actions Bot removed the status:blocked This PR is blocked due to a failing CI check. label Aug 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📦 Next.js Bundle Size Report (Gzipped Sizes)

Asset PR Size Base Size Difference Status
static/chunks/app/api/contributions/route-[hash].js 0.29 KB - +0.29 KB (++100%) 🆕 New
static/chunks/main-[hash].js 41.29 KB 41.28 KB +0.01 KB (+0.03%) 🔴 Regression

📊 Summary of Totals

Category PR Size Base Size Difference
Total JS 5005.33 KB 5004.32 KB +1.02 KB (+0.02%)
Total CSS 354.80 KB 354.80 KB 0 B

@Aamod007 Aamod007 added mentor:Aamod007 type:feature New features, additions, or enhancements type:security Security fixes, dependency updates, or hardening level:intermediate Moderate complexity tasks quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. labels Aug 16, 2026

@Aamod007 Aamod007 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job implementing the new /api/contributions\ endpoint! The addition of per-IP rate limiting and custom token support is an excellent architectural improvement for scalability and abuse prevention. The tests are solid. Approved!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

level:intermediate Moderate complexity tasks mentor:Aamod007 quality:clean PR follows clean coding practices, proper formatting, documentation, and maintainability standards. type:feature New features, additions, or enhancements type:security Security fixes, dependency updates, or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

No rate limiting on contribution endpoint - single client can exhaust GitHub API quota for all users

3 participants