npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@payai/x402-axios-starter

v0.1.2

Published

Create an x402 Axios client in less than 2 minutes!

Readme

x402 Axios Starter

Starter for running an x402 axios client.

You can find the upstream example at coinbase/x402 → examples/typescript/clients/axios.

Getting Started

Requirements

  • Node.js: 18 or newer

Create a new app using the template

Use your preferred package manager to scaffold:

npm (npx)

npm exec @payai/x402-axios-starter -- my-x402-app

pnpm

pnpm dlx @payai/x402-axios-starter my-x402-app

bun

bunx @payai/x402-axios-starter my-x402-app

Then inside your new app:

npm run dev

How the created client example works

When you run the generated app, index.ts will:

  • Load environment variables from .env (for example: RESOURCE_SERVER_URL, ENDPOINT_PATH, PRIVATE_KEY).
  • Create an Axios instance and attach x402 payment interceptor using withPaymentInterceptor.
  • Call your configured endpoint at ${RESOURCE_SERVER_URL}${ENDPOINT_PATH}.
  • Log two things to the console:
    • The parsed JSON response body
    • The decoded x-payment-response headers (useful for inspecting payment receipts/metadata)

The Starter Itself

Below are notes on the starter itself, which creates the example that devs use to get started.

How sync works

  • Workflow: .github/workflows/sync.yml
  • Triggered hourly (cron) and on manual dispatch.
  • Steps (high level):
    • Sparse clone upstream coinbase/x402 and restrict to examples/typescript/clients/axios.
    • Resolve latest x402-axios version from npm (best-effort).
    • Mirror files into vendor/upstream/ (transient; ignored in git and cleaned up).
    • Run scripts/sanitize.sh to:
      • Copy all files from vendor/upstream/ into template/ (root of the template), preserving structure.
      • Remove any legacy template/src/ directory.
      • Refresh NOTICE with the upstream commit and clean up vendor/ and upstream/ directories.
    • Inject the resolved x402-axios version into template/package.json (replacing any workspace reference).
    • Open a PR with the changes using peter-evans/create-pull-request.

Notes:

  • If npm view x402-axios version fails, the workflow falls back to 0.0.0 and will skip injecting the dependency until it is available.
  • The template mirrors the upstream example at the template root (no src/ in the template). Your generated app runs from its root.

Local development of this starter

# run the sanitize/mapping script locally (after an upstream sync or manual vendor update)
scripts/sanitize.sh examples/typescript/clients/axios <commit-sha>

Key files:

  • template/ – shipped starter template; mirrors upstream example at root
  • vendor/upstream/ – transient mirror used during sync (gitignored and cleaned)
  • .github/workflows/sync.yml – sync/PR workflow
  • scripts/sanitize.sh – maps upstream example into template/ (root)
  • bin/create.js – CLI that scaffolds a new project from template/

Releasing this starter to npm (optional)

  • The Release workflow publishes on pushes to main.
  • Requires NPM_TOKEN secret configured in the repo.

License and attribution

Apache-2.0. Portions are derived from coinbase/x402 (see NOTICE, LICENSE, and upstream notices).