# AI Product Next.js boilerplate

> Streaming chat, typed output and tool calling, on auth, Postgres and billing.

For a product whose core loop is a model call. The Vercel AI SDK runs on Anthropic (or OpenAI). You get a streaming chat route and a chat page inside the signed-in app, plus Zod-checked structured output. A tool-calling scaffold ships with one read-only example tool.

Underneath is a working SaaS: sign-in with passwords, magic links and OAuth, a dashboard and settings, Polar billing with monthly, yearly and lifetime prices on a public `/pricing` page, and an admin panel with real users, bans, impersonation and an audit log. Better Auth, Drizzle on Neon Postgres, Resend, PostHog and Sentry.

Usage metering, background jobs, rate limits and tracing are left out on purpose. Solution docs cover when to add metering, jobs and tracing. Rules on `src/lib/ai/**` keep model calls on the server, streamed and schema-checked. `/add-tool` and `/eval-prompt` keep new work consistent.

The Compound Engineering plugin is enabled in `.claude/settings.json` and pinned to a release tag.

- Vercel AI SDK on Anthropic: a streaming chat page in the signed-in app, and a Zod schema on every structured call
- Tool-calling scaffold with one read-only example tool and a tool registry
- Rules on `src/lib/ai/**`: server-only model calls, streaming, no untrusted text in system prompts
- Polar checkout for monthly, yearly and lifetime prices, from a public `/pricing` page
- Better Auth sign-in, plus an admin panel with bans, impersonation and an audit log
- Solution docs on tool retries, streaming edge cases, metering, background jobs and tracing

**Batteries:** better-auth, neon, drizzle, polar, resend, posthog, sentry, ai-bundle, admin-panel

## Generate it

[Build the AI Product repo](https://agenticboilerplate.com/build?preset=ai-product)

---

Agentic Boilerplate: A Next.js repo your agent already knows. Free during launch, then $99 once.

- Site map for agents: https://agenticboilerplate.com/llms.txt
- Public API: https://agenticboilerplate.com/openapi.json
- Contact: agenticstudio@gmail.com
