[ Blog ]
Building AI SaaS, in detail
Production notes from building Shipwright — the parts of a Claude-powered app that boilerplates skip. Every article starts from a real bill, a real outage, or a real production decision, and ends with the code that fixed it.
- — Streaming that survives client disconnects
- — Per-request token and cost metering
- — Prompt versioning and evals in CI
- — Quotas, model gating, and Stripe billing
Everything described here runs live in the demo chat, which shows the exact cost of every request as you use it — the same code these posts take apart.
Metered billing for an AI SaaS: the 402 pattern and the Stripe gotcha that breaks renewals
How metered AI billing works end to end: return HTTP 402 to drive upgrades, sync subscriptions from Stripe webhooks, and the renewal-date gotcha.
Read →Catch prompt regressions in CI before your users do
Shipping a prompt edit can quietly break quality for your biggest user. An eval harness of deterministic graders plus an LLM judge that fails CI first.
Read →How to keep an AI free tier from bankrupting you: two ceilings and a cheap model
An uncapped free tier on an expensive model is how AI apps lose money. Two ceilings keep it safe: a monthly request quota and per-plan model gating.
Read →Tracking LLM costs per user: the schema that billing can actually trust
Per-user LLM cost tracking that billing can trust: one row per request, integer micro-USD instead of floats, and a monthly rollup that drives quotas.
Read →Claude prompt caching: the break-even math and the mistake that turns it off
Claude cache reads bill at a tenth of the input rate; writes cost 1.25x. The break-even math, the 5-minute TTL, and the mistake that disables caching.
Read →Your Next.js AI streaming route keeps billing you after the user leaves
A streaming LLM route in the Next.js App Router keeps generating tokens after the user closes the tab, and you pay for all of them. Here is the fix.
Read →
New posts land as the kit evolves — when a dependency bumps, a model changes pricing, or a production incident teaches something worth writing down. If you want the full working system instead of piecemeal patterns, the kit is a one-time purchase with twelve months of updates: see pricing for the in-app billing demo, or the landing page for everything that ships inside.