Skip to content

Example repositories

All packages are published and ready to use:

Terminal window
npm install @tallypay/core @tallypay/server @tallypay/react

Follow the Express + React tutorial for a step-by-step walkthrough, or reference the package docs:

End-to-end examples will ship under examples/ in the monorepo when the repository is public. Planned starters:

TemplateStackWhat it demonstrates
express-reactExpress + Vite + ReactPaywall an API route, PaymentButton in the client, local collector
hono-workersHono on Cloudflare WorkersEdge-deployed paywall with D1 logging
nextjsNext.js App RouterMiddleware-based paywalling with React hooks

Each template will include:

  • .env.example with testnet facilitator URL, merchant address, and TallyPay API key placeholders.
  • Testnet-only values — no mainnet secrets in source.
  • README with “clone → install → run” in under 2 minutes.

Quick local setup (before templates exist)

Section titled “Quick local setup (before templates exist)”

Server — create a new directory and install:

Terminal window
mkdir my-x402-api && cd my-x402-api
npm init -y
npm install express @tallypay/server

Add a minimal server (see Express tutorial).

Client — scaffold with Vite:

Terminal window
npm create vite@latest my-x402-client -- --template react-ts
cd my-x402-client
npm install @tallypay/react @tallypay/core

Wire up TallyPayProvider and PaymentButton (see React tutorial).

Once the repo is public, open a PR to add your own starter under examples/. Requirements:

  • Testnet values only.
  • Working npm install && npm run dev out of the box.
  • Covers both server and client in the same repo or clear instructions for running both.