Skip to content

ca-x/EdgeMirror

 
 

Repository files navigation

English | Español | 中文

EdgeMirror

A CDN-style edge mirror gateway for developer sources.

Accelerate PyPI, PyTorch, Hugging Face, GitHub, Docker registries, Linux mirrors, npm, Go modules, Maven, crates.io, runtime downloads, and universal file forwarding behind one clean domain.

Deploy to Cloudflare Deploy with Vercel

Verify Runtime Language Package manager Maintainer

Why EdgeMirror

EdgeMirror is a single-domain edge mirror gateway for common developer sources. The recommended production model is one public domain, such as edgemirror.w0x7ce.eu, with each source accelerator exposed by path: /edgemirror, /pypi, /hf, /github, /docker, /mirrors, /proxy, /npm, /go, /maven, /crates, /downloads, and /help.

Every page includes a shared language switcher for English, Spanish, and Chinese. Tool names stay in English while explanations, usage notes, and common UI labels follow the selected language.

Maintainer: tianrking

Keywords: edge mirror gateway, CDN-style source acceleration, Cloudflare Workers proxy, Vercel Functions proxy, PyPI mirror accelerator, PyTorch wheel proxy, Hugging Face mirror, Docker registry proxy, GitHub raw proxy, Linux mirror proxy, npm registry proxy, Go module proxy, Maven proxy, Gradle mirror, crates.io sparse registry proxy, runtime download accelerator.

Tool Stack

Cloudflare Workers Vercel Functions JavaScript ESM Single domain Path routing PyPI PyTorch Hugging Face GitHub Docker Linux mirrors Universal proxy npm Go modules Maven crates.io Downloads Syntax check Smoke test npm audit One click deploy Wrangler

Service Matrix

Stable means the route is recommended for daily use. Test means the accelerator is implemented, wired into smoke checks, and ready for validation before it is promoted to stable.

Status Service Single-domain route What it accelerates
Stable EdgeMirror Portal / or /edgemirror Visual dashboard and usage snippets for every source accelerator
Stable Help /help Route map, web usage, CLI recipes, and configuration guide in English, Spanish, and Chinese
Stable PyPI / PyTorch /pypi PyPI simple index, package files, and PyTorch wheel downloads
Stable Hugging Face /hf Hugging Face API, model files, datasets, and LFS downloads
Stable GitHub /github Git clone, raw files, release assets, and GitHub pages
Stable Docker Registry /docker UI, /v2 API Docker Hub plus quay, gcr, k8s, ghcr, nvcr prefixes
Stable Linux Mirrors /mirrors APT, YUM, DNF, Pacman, wget, and curl mirror paths
Stable Universal Proxy /proxy Any HTTP/HTTPS file URL with filename handling
Test npm Registry /npm npm, pnpm, yarn metadata and tarball downloads
Test Go Module Proxy /go GOPROXY module list, version metadata, .mod, and .zip files
Test Maven / Gradle /maven Maven Central, Google Maven, Gradle Plugin Portal, and JitPack
Test crates.io Sparse /crates Cargo sparse index and .crate package downloads
Test Runtime Downloads /downloads Node.js, Python, Go, Rustup, Open VSX, SourceForge, GitLab, Gitea, and direct file URLs

One-Click Deployment

Deploy to Cloudflare Workers

Click the Cloudflare button at the top of this README, or open:

https://deploy.workers.cloudflare.com/?url=https://github.com/tianrking/edgemirror

Cloudflare reads wrangler.toml, creates the Worker, and deploys it to the account-provided Worker name. The default configuration is intentionally portable: it enables workers.dev, disables preview URLs, and does not bind the maintainer's custom domain.

After the Worker is deployed, add one custom domain in the Cloudflare dashboard, or copy the route block from wrangler.custom-domain.example.toml into wrangler.toml after confirming that the domain belongs to your Cloudflare account. Every tool will still use the same path model on that domain.

Deploy to Vercel

Click the Vercel button at the top of this README, or open:

https://vercel.com/new/clone?repository-url=https://github.com/tianrking/edgemirror

Vercel uses api/index.js as a Web Handler function and vercel.json to route every path to that function. The Vercel deployment uses the same path model: /edgemirror, /pypi, /hf, /github, /docker, /mirrors, /proxy, /npm, /go, /maven, /crates, /downloads, and /help. Docker Registry API traffic is also auto-detected at /v2, /token, and /_worker_blob_proxy, so a single Vercel domain can serve Docker pulls without a /docker prefix in the image name.

Local Development

npm install
npm run verify
npm run dev

Useful scripts:

Command Purpose
npm run dev Start Cloudflare Worker dev server
npm run dev:cloudflare Same as npm run dev
npm run dev:vercel Start Vercel local development with npx vercel@latest dev
npm run check Syntax-check every JavaScript file under src and scripts
npm run smoke:vercel Import the Vercel function entry and verify core routes
npm run verify Run syntax check, Vercel smoke test, and high-severity npm audit
npm run deploy:cloudflare Deploy with Wrangler
npm run deploy:vercel Deploy to Vercel production with npx vercel@latest --prod

Routing Model

EdgeMirror is designed around single-domain path routing:

Runtime style Example Notes
Path routing https://edgemirror.w0x7ce.eu/pypi/simple/ Recommended production model
Vercel path routing https://your-app.vercel.app/pypi/simple/ Same routes after one-click Vercel deploy

For Docker on a single-domain deployment, use the deployment host directly:

docker pull your-app.vercel.app/library/nginx:latest

The router forwards Docker's /v2, /token, and blob redirect traffic to the Docker tool automatically.

Health checks are available at:

/health
/healthz
/__health

They return JSON with the project version and the registered service list.

Examples

Install a Python package:

pip install numpy -i https://edgemirror.w0x7ce.eu/pypi/simple/

Install PyTorch wheels:

pip install torch torchvision --index-url https://edgemirror.w0x7ce.eu/pypi/pytorch/cu118

Download a Hugging Face model:

export HF_ENDPOINT=https://edgemirror.w0x7ce.eu/hf
huggingface-cli download gpt2

Clone through the GitHub proxy:

git clone https://edgemirror.w0x7ce.eu/github/vercel/next.js.git

Pull a Docker image:

docker pull edgemirror.w0x7ce.eu/library/nginx:latest

Proxy a generic file:

curl -L -O "https://edgemirror.w0x7ce.eu/proxy/https://nodejs.org/dist/v22.11.0/node-v22.11.0-x64.msi"

Use the new test npm registry route:

npm install lodash --registry=https://edgemirror.w0x7ce.eu/npm/
pnpm install lodash --registry=https://edgemirror.w0x7ce.eu/npm/

Use the new test Go module route:

go env -w GOPROXY=https://edgemirror.w0x7ce.eu/go,direct

Use the new test Maven / Gradle routes:

repositories {
    maven { url = uri("https://edgemirror.w0x7ce.eu/maven/maven-central") }
    maven { url = uri("https://edgemirror.w0x7ce.eu/maven/google") }
    maven { url = uri("https://edgemirror.w0x7ce.eu/maven/gradle-plugin") }
}

Use the new test crates.io sparse route:

[source.crates-io]
replace-with = "edgemirror"

[source.edgemirror]
registry = "sparse+https://edgemirror.w0x7ce.eu/crates/"

Use the new test runtime download route:

curl -L -O "https://edgemirror.w0x7ce.eu/downloads/node/v22.11.0/node-v22.11.0-x64.msi"
curl -L -O "https://edgemirror.w0x7ce.eu/downloads/https://nodejs.org/dist/v22.11.0/node-v22.11.0-x64.msi"

Project Layout

api/index.js              Vercel Functions Web Handler entry
scripts/check-syntax.mjs  Cross-platform JavaScript syntax checker
scripts/smoke-vercel.mjs  Vercel runtime smoke test
src/config.js             Project metadata, service registry, health paths
src/html.js               HTML rewrite fallback for non-Cloudflare runtimes
src/i18n.js               Language detection, language switch links, and localized URLs
src/index.js              Host/path router and health endpoint
src/proxy-utils.js        Shared CORS, redirect, header, and proxy helpers
src/tools/*.js            Individual tool implementations
vercel.json               Vercel routing and build configuration
wrangler.toml             Portable Cloudflare Workers deploy configuration
wrangler.custom-domain.example.toml  Optional custom-domain configuration example

Configuration

Edit src/config.js when adding, renaming, or documenting a tool. Edit wrangler.toml when changing the Cloudflare Worker name or compatibility date.

For Cloudflare custom domains, add the domain in the Cloudflare dashboard or use wrangler.custom-domain.example.toml as a reference after the domain is available in the target account. For Vercel custom domains, add one primary domain in the Vercel dashboard and keep the same path routes.

Production Notes

  • Keep npm run verify green before deploying.
  • Keep wrangler updated; it is the local Cloudflare dev/deploy toolchain.
  • Cloudflare custom domains are account-specific, so the portable default wrangler.toml does not hard-code one.
  • Use one primary domain for the public product experience; legacy per-tool hosts are not the recommended interaction model.
  • Some upstream services may have rate limits, authentication requirements, or terms of service that still apply through a proxy.

Roadmap

  • Promote test accelerators to stable after more upstream compatibility checks.
  • Add configurable service domains through environment variables.
  • Add structured access logs and optional request tracing.
  • Add per-tool smoke tests with mocked upstream responses.
  • Add deployment preview screenshots for the portal and tool pages.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • JavaScript 100.0%