StackBlaze AI SaaS Kit
A production-ready, multi-tenant AI SaaS template built on a single-language TypeScript stack. You buy a licence, run one command, answer a few prompts, and get a working app you own outright — auth, billing, an AI chat layer, and a multi-tenant data model already wired together.
This documentation is for operators: the developers who scaffold the template, configure it, run it locally, and deploy it to production.
What you get
- Authentication — email/password with verification, password reset, and optional Google / GitHub OAuth (better-auth).
- Multi-tenant workspaces — every user gets a personal workspace; users can
belong to many organisations. Every resource is scoped by
tenant_id. - AI chat — a streaming chat interface backed by the Vercel AI SDK, with a provider you pick at scaffold time (OpenAI, Anthropic, Google, and ~15 more).
- Agentic tool calling — an extensible tool registry, including a built-in
web_searchtool (Tavily / Exa / Firecrawl). - Billing — Stripe checkout, customer portal, and webhook-driven plan
changes, gated by the plan limits in
lib/billing/plans.ts. - Usage metering & limits — AI calls record tokens; monthly usage enforces hard and soft limits per plan.
- Admin portal — a role-gated platform-owner portal at
/admin. - Rate limiting & email — optional Upstash Redis rate limiting and Resend transactional email.
The stack
| Layer | Choice |
|---|---|
| Framework | Next.js 16 (App Router), React 19 |
| Language | TypeScript (strict) |
| AI | Vercel AI SDK — provider switchable via env var |
| Auth | better-auth + organization plugin |
| Database | PostgreSQL + Drizzle ORM |
| Billing | Stripe |
| UI | shadcn/ui + Tailwind v4 |
| Rate limiting | Upstash Redis (optional) |
| Resend (optional) | |
| Deploy target | Vercel |
Where to start
New to the template? Read Getting Started → Scaffold a project first — it walks through the
npx create-stackblaze-appflow end to end.