A minimal Cloudflare Worker that deterministically routes ubq.fi traffic to Deno Deploy apps. No KV, no discovery, no sticky cookies, and no Cloudflare Pages fallback. The /rpc/:chainId path is exposed same‑origin per domain and proxied to https://rpc.ubq.fi to keep CORS simple.
See docs/deno-only-simplification.md for the URL mapping rules; we use those rules but keep the Cloudflare Worker as the single front‑door.
Prerequisites: Wrangler CLI authenticated to your Cloudflare account.
- Dev:
npm run cf:dev(orwrangler dev) - Deploy:
npm run cf:deploy(orwrangler deploy)
Entry point: src/worker.ts (module worker).
- Services
ubq.fi→https://ubq-fi.ubiquity-dao.deno.net<sub>.ubq.fi→https://<sub>-ubq-fi.ubiquity-dao.deno.net- Missing Deno 2 deployments are returned directly from Deno; there is no Deploy Classic fallback for service routes.
- Plugins (
os-*.ubq.fi)os-<plugin>.ubq.fi→<plugin>-main.deno.devos-<plugin>-main.ubq.fi→<plugin>-main.deno.devos-<plugin>-dev[elopment].ubq.fi→<plugin>-development.deno.dev
- RPC (same origin)
/rpc/:chainId→ proxied tohttps://rpc.ubq.fi/:chainId
- Routes are managed in the Cloudflare dashboard;
wrangler.tomldoes not attach routes. - We do not persist app state (no KV, no LKG, no admin endpoints).
- Upstream headers/status are passed through; we strip host/origin/referer/cookie to upstream.
# Start development server
bun run dev
# In another terminal, test locally
curl http://localhost:8787 -H "Host: pay.ubq.fi"# Type check
bun run type-check
# Build
bun run build
# Deploy
bun run deploy- Deploy service to Deno Deploy or Cloudflare Pages
- Force cache refresh:
curl -H "X-Cache-Control: refresh" https://newservice.ubq.fi - Verify routing with normal request:
curl https://newservice.ubq.fi
- The Worker emits structured JSON logs for each request, including
inHost(derived from URL) andhostHeader(rawHostheader), pluspath,status,ms, andcfRay. - In Cloudflare Workers Observability → Logs, filter by host using substring search, for example:
"hostHeader":"devpool.directory"- or
"inHost":"work.ubq.fi"
- Events:
event: "route"for successful proxy/rpc requestsevent: "route_error"on upstream failuresevent: "health"forGET /__health
- Bundle Size: ~4.6kb (optimized)
- Proxy Timeout: 6 seconds
Service shows as available but returns 404
- Check if the actual service URL exists
- Verify URL building logic in
src/utils/build-deno-url.ts
Build failures
- Run
bun run type-checkfor TypeScript errors - Ensure all dependencies are installed:
bun install - Check esbuild configuration in
package.json
See docs/troubleshooting.md for detailed solutions.
- Architecture Details - System design and data flow
- API Reference - Complete API documentation
- Sitemap Generation - Dynamic sitemap features and configuration
- Deployment Guide - Production deployment
- Troubleshooting - Common issues and solutions
- Make changes to TypeScript files in
src/ - Run type checking:
bun run type-check - Test locally:
bun run dev - Deploy:
bun run deploy
[Your License Here]
Need Help? Check the troubleshooting guide or review the architecture documentation.