Code behind ping.playit.gg. This webpage tests latency against the playit.gg Anycast tunneling network.
To run the frontend by itself during normal UI work:
git clone git@github.com:playit-cloud/ping.playit.gg.git
cd ping.playit.gg
npm i
npm run devThis project now follows Cloudflare's recommended SPA pattern:
- Vite builds the frontend into
dist/ - one Cloudflare Worker serves the SPA assets and the share API
- React Router handles the SPA routes for
/and/shared/:shareId - shared latency snapshots are stored in an R2 bucket
Frontend source now uses a flat top-level layout under src/:
api/for browser-side API clients and ping helperscomponents/for reusable UI building blockspages/for route-level page componentsshared/for shared hooks, route config, types, and data
Vite and TypeScript are configured with the @/ alias so frontend imports can reference src/ with absolute paths.
wrangler.tomlworker/index.ts.dev.vars.example
Before deploying, replace the placeholder R2 settings in wrangler.toml:
binding = "SHARE_RESULTS_BUCKET"bucket_name = "ping-playit-gg-results-placeholder"
The example Worker env file documents the same placeholder values:
SHARE_URL_BASE=http://127.0.0.1:8787
R2_BUCKET_BINDING=SHARE_RESULTS_BUCKET
R2_BUCKET_NAME=ping-playit-gg-results-placeholderSHARE_URL_BASE is optional. Leave it unset in production if share links should use the incoming request origin automatically.
- Install dependencies:
npm i- Build the SPA assets:
npm run build- Create local config files from the examples and fill in your real values:
.dev.vars
- Start the Worker dev server:
npm run cf:devThe Worker serves the built SPA from dist/, including direct navigation to /shared/:shareId, and exposes:
POST /api/shareGET /api/share/:shareId
After updating the placeholder bucket names and creating the matching R2 bucket in Cloudflare:
npm run cf:deploy