Use case

Host a full-stack Next.js app with one command.

Hosting a full-stack Next.js app usually means creating an account, linking a repository, configuring a project, and adding a payment card. On x402-hosting it is one command run from the project directory. The CLI builds the app locally with OpenNext, publishes it as a Cloudflare Worker, and charges prepaid hosting time in USDC over the x402 protocol. There is no account, dashboard, or API key involved.

Next.js projectlocal OpenNext buildCloudflare Workerproduction URL
One command moves a Next.js project from a local directory to a production URL.

The command

From the root of a supported Next.js project, run:

$ npx x402-hosting@latest deploy --days 30

That single command covers the full path from source code to a production URL. The --days flag sets how long the project stays online; thirty days costs $6.01 in total.

What happens when you run it

The CLI detects the Next.js version, adds the OpenNext Cloudflare configuration to the project, and runs the build locally. Only after the build succeeds does payment start: the API answers with an HTTP 402 payment challenge, your wallet pays $0.01 for the upload plus $0.20 per project-day in USDC, and the platform publishes the artifact as a Cloudflare Worker. A local build failure therefore costs nothing, and the payment challenge is always the authoritative quote before any wallet signs.

What a full-stack app gets

An active project includes its static assets, 100,000 dynamic requests, and 15 million CPU milliseconds, so server components, route handlers, and server actions all run in production. Supported Next.js versions are 15.5.21 up to (but not including) 16, and 16.2.11 and later. Every project gets a stable URL likehttps://app-682fe91de571a7338dd1.x402-hosting.com.

What it costs

  • First deployment: $0.01 upload plus $0.20 × project-days
  • Thirty days of hosting: $6.01 in total, prepaid in USDC
  • New deployment at the same URL: $0.01
  • Renewal: $0.20 × additional project-days
  • Status and deployment-history reads: free

After the deploy

A successful first deployment writes x402-hosting.json to the project root with the URL, project id, owner wallet, and expiry. Keep it with the repository: every later operation — redeploy, renew, rollback — reads that record, and the wallet that paid the first upload must sign each paid mutation.

Related guides