Buy — $99

A Claude agent SaaS boilerplate for Next.js: what it has to cover

Who wrote this. We make Agentwright Starter, a paid starter kit, and this page describes it. The list of parts is useful whichever kit you choose, and also if you build everything yourself: each part links to a post with the code.

Most Next.js SaaS boilerplates cover sign-in, payments and a landing page. A product where a Claude agent does the work needs more, because every request costs you money and the model decides how many requests there are.

This page lists the parts such a boilerplate has to cover, shows where each one lives in Agentwright Starter, and says plainly what the kit leaves out.

What a Claude API starter kit for Next.js needs beyond login and payments

Part Why it is there File in the kit The code, explained
Streaming tool loop The agent calls Claude, runs the tools it asks for, and repeats. The loop needs a turn limit and has to stream while it works. lib/agent/loop.ts
app/api/agent/route.ts
Stream a tool-using Claude agent with SSE
Token and cost metering per user You pay per token and your customer pays per month. One row per model call tells you what each user costs. lib/billing/metering.ts Meter Claude API costs per user
Price snapshots Model prices change. Each usage row keeps the price it was charged with, so past totals stay the same. lib/billing/pricing.ts Snapshot prices on every usage row
Plan caps and rate limits A monthly cap checked before each model call, and a requests-per-minute limit that answers 429. lib/billing/metering.ts
lib/ratelimit/index.ts
Rate limiting an LLM endpoint with Postgres
Prompt caching The system prompt and the tool list are sent on every turn. Read from the cache, they cost a fraction of the normal input price. lib/agent/loop.ts
lib/agent/system-prompt.ts
Prompt caching in an agent loop
Billing webhooks A subscription changes a user's plan through a signed webhook. lib/billing/lemonsqueezy.ts, lib/billing/polar-events.ts Verify Lemon Squeezy webhooks
MCP servers as tools Tools that already exist as MCP servers become callable next to your own. lib/agent/mcp.ts MCP servers as tools in your own loop
Evals Golden cases run through the real loop, so a prompt change that breaks behaviour fails CI. evals/run.ts
evals/cases.ts
Evals in 140 lines of TypeScript

What's inside lists every file of the kit with a one-line note and shows three of them in full: the agent loop, the metering code and the eval cases.

Claude Agent SDK or your own loop?

If you are looking for a Claude Agent SDK SaaS template, know this first: Agentwright Starter does not use the Claude Agent SDK. It calls the Messages API through the Anthropic TypeScript SDK and runs its own loop of about 100 lines.

The Claude Agent SDK is Claude Code packaged as a library. It brings built-in tools for files, shell commands and web search, plus permissions, hooks, subagents and sessions. That makes it a strong start for a coding agent, or for an automation that works on files in a container.

A web app is a different job. Many users send requests to tools that you wrote, and you need to meter and cap every model call. A hand-written loop keeps the prompt small and puts each call in your hands. In our test on November 3, 2026, the same two-request task used 86,630 input tokens through the Agent SDK, nearly all of it the SDK's own prompt and tools (cached), and under 1,000 through a hand-written loop.

The full comparison, with runnable code for both and a decision table, is in Claude Agent SDK vs rolling your own tool loop. If your product is a coding agent, start with the Agent SDK and not with this kit.

What "token billing per user" means in this kit

The phrase can mean two things, and the kit does one of them.

Metering: yes. Every model turn writes one row to usage_events: input, output, cache read and cache write tokens, the cost in micro-dollars, and the id of the price row that was used. The /usage page shows each user their tokens, cost and plan cap. Totals are sums of stored costs, so a price change does not rewrite history. A model without a price row is refused before the API is called, so no call goes unrecorded.

Charging per token: no. Plans are flat subscriptions through Lemon Squeezy or Polar, and each plan has a monthly token cap. The seeded plans are Free (200,000 tokens a month), Pro (5 million) and Team (25 million). A plan can be allowed to run past its cap, as the seeded Team plan is. That usage is recorded, but the kit does not create a charge for it.

The numbers are yours to change: plans and caps are rows in your database.

Claude models and prices

The model is a setting (AGENT_MODEL, default Claude Sonnet 5.5). The kit ships price rows for these models:

ModelModel idInput, per million tokensOutput, per million tokens
Claude Fable 5.2claude-fable-5-2$8$40
Claude Opus 5.5claude-opus-5-5$4$20
Claude Sonnet 5.5claude-sonnet-5-5$2$10
Claude Haiku 5.5claude-haiku-5-5$0.10$0.50

Prices in USD, checked against the official Claude pricing page on November 10, 2026. Claude Haiku 5.5 has a second price row for prompts over 100,000 tokens ($0.50 input, $2.50 output). The kit also has a price row for Claude Fable 5.1.

Every current price, with the caching and batch rates, is on Claude API pricing. The Claude API cost calculator turns them into a cost per request, per user and per month.

The stack

Next.js 16 with the App Router, TypeScript, the Anthropic TypeScript SDK, the MCP TypeScript SDK, Drizzle ORM on Postgres, Auth.js v5, Tailwind CSS v4 and Zod. Sign-in is GitHub OAuth, with optional email magic links through Resend.

Version 0.5.1 has 48 code files with 5,776 lines, 64 tests, and a GitHub Actions workflow that runs the type check, the tests and a production build. The setup guide and the deploy guide for Vercel and Neon that ship with the kit are public.

Where the kit is weak, and what it does not include

  • It is new. The first release was on 2026-11-01 and the current version is 0.5.1. There are no customers yet, so there are no reviews and no showcase of apps built with it.
  • Claude only. The agent loop, metering and evals are built on the Anthropic SDK. If you need OpenAI or Gemini too, another kit fits better.
  • No Stripe. Your app's billing is Lemon Squeezy or Polar. The Polar adapter is new in version 0.5.0: it has 49 automated tests, and on 2026-11-13 we ran a subscription through it in Polar's sandbox (Polar's real servers, a test card, no real money): checkout, plan change, cancellation and revocation each set the user's plan as documented. A renewal and a failed renewal come a month after a purchase, so those are covered by tests with Polar's sample events and not by a live run, and no real-money payment has gone through it. Its docs list the same five steps to check with your own Polar account before you take payments.
  • No teams, organizations or seats. Each user has one plan; "team" is only a plan name.
  • Minimal UI: sign-in, chat, usage, pricing and an admin page for licenses. The home page is a stub. There is no marketing site, blog or component library.
  • No live demo. Instead, /inside/ lists every file and shows three of them in full.
  • No RAG or search, no file uploads, no job queue. The plan cap is a monthly token count, and the kit does not charge for usage past it (on a plan with overage_allowed set, such as the seeded Team plan, usage simply continues).

For kits that cover some of these, see nine starter kits side by side and the one-to-one comparisons.

Price

Agentwright Starter is $99 at the launch price for the first 50 licenses (list $149; the code LAUNCH is applied at checkout). You pay once and every future version is included. 14-day refund, no questions asked.

Buy now — $99 Read the code first

Questions

Does it use the Claude Agent SDK?

No. It uses the Anthropic TypeScript SDK and its own tool loop. The section above says why, and when the Agent SDK is the better choice.

Is this an official Anthropic boilerplate?

No. Agentwright is an independent business. The kit is not made, endorsed or sponsored by Anthropic. It is built on Anthropic's public API and SDK.

Can I use OpenAI or Gemini with it?

No. The loop, the metering and the evals are written for Claude and the Anthropic SDK.

Does it work with Stripe?

Not out of the box. The kit has billing code for Lemon Squeezy and for Polar, and none for Stripe. The provider code sits in a few files, and metering and plan caps read your own database, so they stay the same if you add another provider. The FAQ names the files.

Which Next.js version does it use?

Next.js 16, since version 0.5.0. The kit includes a note on what changed and how to bring a project built on an earlier version up to date (docs/next16.md).

Can I see the code before I pay?

Yes. What's inside lists every file and shows the agent loop, the metering code and the eval cases in full, and the docs that ship with the kit are public. There is no live demo. If the kit does not fit, the refund window is 14 days.

Updated on November 12, 2026, for version 0.5.1 of the kit. Something wrong or unclear? Email hello@agentwright.app.