Skip to content

[BUG] BADGE_BASE_URL in customize/utils.ts is hardcoded to production URL — breaks badge generation in non-production environments #985

@KaparthyReddy

Description

@KaparthyReddy

Description

In app/customize/utils.ts, the badge base URL is hardcoded to the production Vercel deployment:

const BADGE_BASE_URL = 'https://commitpulse.vercel.app/api/streak';

This means the customize page always generates badge URLs pointing to production, even when running locally or on a staging/preview deployment. Developers testing locally will generate badges that hit the production API instead of their local server, making it impossible to test badge customization against a local build.

Steps to Reproduce

  1. Run the app locally
  2. Navigate to the customize page
  3. Configure a badge with custom colors or theme
  4. Copy the generated badge URL or embed snippet
  5. Observe the URL points to https://commitpulse.vercel.app/api/streak instead of http://localhost:3000/api/streak

Expected Behavior

BADGE_BASE_URL should use the NEXT_PUBLIC_SITE_URL environment variable with a fallback to the production URL, consistent with how BASE_URL is defined in app/(root)/dashboard/[username]/page.tsx:

const BADGE_BASE_URL = ${process.env.NEXT_PUBLIC_SITE_URL ?? 'https://commitpulse.vercel.app'}/api/streak;

Screenshots / Logs

N/A

GitHub Username (If applicable)

N/A

Environment

Chrome

Metadata

Metadata

Assignees

Labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions