Skip to content

Self-hosting

The router is a Fetch handler. Cloudflare Workers is the default deployment target for x402-router.wgw.lol, but the package is not tied to Cloudflare.

import { createX402Router } from "@tunnckocore/x402-router";
const handler = createX402Router();
export default {
fetch(request: Request) {
return handler.fetch(request);
},
};
  • Standard Request and Response.
  • fetch for upstream facilitator calls.
  • No database.
  • No router-side secrets.

Use createX402Router({ upstreams }) if you want to add or replace facilitators.

GET /health
GET /healthz

Both return a small JSON health response from the router package.