Shipwright
The AI SaaS starter kit where the AI part is actually finished.
Most boilerplates bolt a chat call onto an auth template. Shipwright ships the hard parts of an AI product — streaming, tool use, structured outputs, prompt versioning with evals, and per-user token metering wired for billing.
Streaming done right
SSE chat endpoint with token-by-token streaming, client disconnect handling, and a final usage event — not a toy fetch wrapper.
src/lib/ai/stream.tsToken metering & cost attribution
Every request is recorded per user with exact cost in micro-USD, including prompt-cache reads and writes. Quota checks and usage-based billing build on one table.
src/lib/metering/meter.tsTyped tool use
Declare tool inputs once with Zod: JSON Schema for the API, runtime validation with model-readable errors, and typed execute() — plus a production agent loop with iteration caps.
src/lib/ai/tools.tsStructured outputs
Schema-guaranteed JSON via the API's structured outputs — no "respond only with JSON" prompting, no parse-retry loops.
src/lib/ai/generate.tsVersioned prompts + evals
Prompts live in a versioned registry, and an eval harness with deterministic graders and an LLM judge gates prompt changes in CI.
src/lib/ai/evals/runner.tsRate limiting
Per-caller limits on the AI endpoints out of the box, with a seam to swap in Redis for multi-instance deploys.
src/lib/ratelimit.ts