Skip to content

GitHub Enterprise Server (GHES) support #325

Description

@raghavpillai

Summary

Better Hub currently only works with github.com. It would be great to support GitHub Enterprise Server (GHES) instances, since a lot of teams and orgs run private GHES deployments internally.

Problem

  • All GitHub API calls, OAuth flows, and web URLs are hardcoded to github.com / api.github.com
  • The socialProviders.github OAuth provider uses github.com endpoints exclusively
  • Avatar URLs on GHES private-mode instances require web session cookies (API tokens don't work for the avatars subdomain)
  • Links throughout the UI point to github.com with no way to override

Proposal

  1. Centralized GitHub URL config — a single github-config.ts that reads from environment variables (GITHUB_WEB_URL, GITHUB_API_URL, GITHUB_GRAPHQL_URL, etc.) and falls back to github.com defaults. Every file that builds a GitHub URL imports from this config instead of hardcoding.

  2. Generic OAuth — replace socialProviders.github with better-auth's genericOAuth plugin so the authorization and token endpoints can point at a GHES instance.

  3. Avatar proxy for GHES private mode — a server-side route that authenticates with the GHES web UI, caches the session cookie, and proxies avatar images. A GhesImage component wraps next/image to transparently route GHES avatar URLs through the proxy.

  4. UI link updates — swap all hardcoded https://github.com references in components to use the configurable base URL, so "Open in GitHub" links, breadcrumbs, and copy-link buttons all point at the correct host.

Configuration

The following env vars would control GHES mode (all optional, defaults to github.com):

NEXT_PUBLIC_GITHUB_WEB_URL=https://ghes.example.com
GITHUB_API_URL=https://ghes.example.com/api/v3
GITHUB_GRAPHQL_URL=https://ghes.example.com/api/graphql

# For private-mode avatar proxying
GHES_AVATAR_USERNAME=bot-account
GHES_AVATAR_PASSWORD=password

When none of these are set, behavior is identical to today.

Notes

  • GHES uses /api/v3 and /api/graphql paths on the same host rather than separate api.github.com / github.com domains
  • Private mode GHES instances serve avatars behind web session auth, not API token auth
  • OAuth apps on GHES support the same OAuth2 flow, just with different endpoint URLs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions