Paste a GitHub file or Gist URL, get a CDN URL you can drop straight into a <script>, <link> or fetch(). Self-hostable Next.js app — a jsDelivr-style alternative you run yourself.
Live: https://ghcdn.vercel.app
- Serve GitHub repository files directly via CDN URL
- Serve Gist content directly via CDN URL
- Memory-efficient caching for faster delivery
- Purge cached content when needed
- Modern, responsive UI with excellent user experience
https://github.com/{username}/{repo}/{branch}/{path}
Example:
https://github.com/p32929/p32929.github.io/blob/react/README.md
https://gist.github.com/{username}/{gistId}
Example:
https://gist.github.com/p32929/7a2375cf2eb3d2986a741d7dc293a4c8
Here are 5 practical examples of when GitHub CDN is useful:
-
Serving JavaScript Libraries in Web Pages
<script src="https://your-cdn-domain.com/github/username/repo/branch/path/to/script.js"></script>
-
Loading CSS Stylesheets
<link rel="stylesheet" href="https://your-cdn-domain.com/github/username/repo/branch/path/to/styles.css">
-
Embedding Code Snippets from Gists
<script src="https://your-cdn-domain.com/gist/username/gistId"></script>
-
Fetching JSON Configuration Files
fetch('https://your-cdn-domain.com/github/username/repo/branch/path/to/config.json') .then(response => response.json()) .then(data => console.log(data));
-
Serving Text Content and Documentation
<iframe src="https://your-cdn-domain.com/github/username/repo/branch/path/to/documentation.md" width="100%" height="500px"></iframe>
GitHub CDN has some limitations you should be aware of:
-
Binary Files: Not optimized for serving large binary files or applications.
-
Image Files: While technically possible, the CDN is not optimized for image delivery. Consider using dedicated image hosting services for better performance.
-
Rate Limiting: Subject to GitHub API rate limits if you don't provide a GitHub token.
-
Private Repositories: Does not support private repositories unless you provide authentication.
-
Frequent Updates: If your content changes frequently, you may need to manually purge the cache.
- Node.js 18.x or later
- npm or yarn
- Clone the repository
git clone https://github.com/p32929/ghcdn.git
cd ghcdn- Install dependencies:
npm install
# or
yarn- Start the development server:
npm run dev
# or
yarn dev- Open http://localhost:3000 in your browser
Create a .env file with the following variables:
GITHUB_TOKEN=your_github_token # Optional, but recommended for higher rate limits
Deploy GitHub CDN with one click to your preferred platform:
- Cloudflare Pages: Fork the repo and import it in Cloudflare Pages
- Fly.io: Run
fly launchin the cloned repository - Cyclic: Import from Cyclic Dashboard
- Northflank: Create project from Northflank
- Deta Space: Use
space pushafter installing Space CLI - Replit: Import directly from Replit
- Glitch: Remix on Glitch
- Surge.sh: Deploy with
surgeafter building locally - GitHub Pages: Use GitHub Actions for deployment (static export required)
- Azure Static Web Apps: Deploy via Azure Portal
All platforms will auto-detect Next.js and apply appropriate build settings. No additional configuration files needed!
Run with Docker:
docker build -t ghcdn .
docker run -p 3000:3000 -e GITHUB_TOKEN=your_token ghcdn| Variable | Required | Description |
|---|---|---|
GITHUB_TOKEN |
No | GitHub personal access token for higher API rate limits (Create token) |
Most platforms will prompt you to add environment variables during deployment.
MIT License — Copyright (c) 2025 Fayaz Bin Salam. See LICENSE for the full text.
Contributions are warmly welcomed and greatly appreciated! Whether it's a bug fix, new feature, or improvement, your input helps make this project better for everyone.
Before submitting a pull request, please:
- Create an issue describing the feature or bug fix you'd like to work on
- Wait for discussion and approval to ensure alignment with project goals
- Fork the repository and create your feature branch
- Submit your pull request with a clear description of changes
This approach helps avoid duplicate efforts and ensures smooth collaboration. Thank you for considering contributing!
Sharing this repository with your friends is just one click away from here
I do fixed-price delivery work on my own projects. One invoice, one date, no hourly billing:
| White-label build — this project rebranded, extended and deployed as yours | $6,500 · 3 weeks |
| Custom app from scratch on my own stack, signed and auto-updating | $12,500 · 6 weeks |
| Production-hardening sprint — 72 hours on this project, for your load and your security review | $999 |
| Ongoing capacity — one project-week of my time reserved every month | $9,000 / month |
Full details → p32929.github.io/hire · Email fayazdevinbox@uberip.com — scoping and quotes are free and I answer within one business day.







