Example repositories
Install from npm today
Section titled “Install from npm today”All packages are published and ready to use:
npm install @tallypay/core @tallypay/server @tallypay/reactFollow the Express + React tutorial for a step-by-step walkthrough, or reference the package docs:
@tallypay/server— Express and Hono middleware@tallypay/react— Provider, hooks, PaymentButton@tallypay/core— Types, wrapFetch, event emitter
Starter templates (coming at launch)
Section titled “Starter templates (coming at launch)”End-to-end examples will ship under examples/ in the monorepo when the repository is public. Planned starters:
| Template | Stack | What it demonstrates |
|---|---|---|
| express-react | Express + Vite + React | Paywall an API route, PaymentButton in the client, local collector |
| hono-workers | Hono on Cloudflare Workers | Edge-deployed paywall with D1 logging |
| nextjs | Next.js App Router | Middleware-based paywalling with React hooks |
Each template will include:
.env.examplewith 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:
mkdir my-x402-api && cd my-x402-apinpm init -ynpm install express @tallypay/serverAdd a minimal server (see Express tutorial).
Client — scaffold with Vite:
npm create vite@latest my-x402-client -- --template react-tscd my-x402-clientnpm install @tallypay/react @tallypay/coreWire up TallyPayProvider and PaymentButton (see React tutorial).
Contributing examples
Section titled “Contributing examples”Once the repo is public, open a PR to add your own starter under examples/. Requirements:
- Testnet values only.
- Working
npm install && npm run devout of the box. - Covers both server and client in the same repo or clear instructions for running both.