@smidgendotio/next

Next.js

Easy: middleware 402 for bots + snippet blur for humans. Hard lock: resolvePaywallAccess() in a Server Component (or an API route) so unpaid HTML never includes the premium body.

Before you start

Replace placeholder values like smid_YOUR_PROJECT_ID and https://yoursite.com with your project ID and site origin from the dashboard.

  • A smidgen.io project — copy your project ID from the dashboard
  • Add https://yoursite.com under Allowed websites in project settings
  • Create at least one paywall rule whose path and selector match your premium content
  • Serve /.well-known/ai-catalog.json from those rules so agents can discover paid paths (first successful payment can list the URL on Coinbase Bazaar)
  • Set a payout wallet (Base or Solana) to receive USDC
  • API base URL: https://smidgen.io

Browser snippet

Easy: wallet checkout via snippet.js with data-x402-paywall. Hard lock: see the Hard lock tab.

Middleware

HTTP 402 for agents. Catalog + Coinbase Bazaar for discovery.

Quick setup

Create a project in the smidgen dashboard, then follow these steps on your site.

  1. npm install @smidgendotio/next
  2. Or scaffold with: npx @smidgendotio/cli init --stack next (writes .env.local and middleware.ts).
  3. Add middleware.ts and env vars (see below) — bots get HTTP 402 on matching routes.
  4. Easy paywall: paste the script tag and wrap content in data-x402-paywall.
  5. Hard lock: use resolvePaywallAccess() in a Server Component so unpaid HTML has no secrets.
  6. Add https://yoursite.com to Allowed websites.
  7. Serve /.well-known/ai-catalog.json (and Agentmap in robots.txt) so agents can discover paid paths. The first successful payment can list the URL on Coinbase Bazaar.

Personalized snippets

Open a project in the dashboard for copy-paste configs with your real project ID, API URL, and allowed origin.