nextjs-ai-sdk-trpc

featured fresh

Production-ready Next.js 15 starter with Vercel AI SDK, tRPC, Prisma, and RevenueCat. Ships with streaming chat, tool use, and subscription paywall.

by closedlab · updated · license MIT · ★ 2.1k · ↓ 4.8k

compatibility

vercel full
netlify full
railway full
self-hosted partial

stack

Next.js 15Vercel AI SDKtRPCPrismaPostgresRevenueCatTailwindshadcn/ui

What you get

A real AI app skeleton — not a todo list. Streaming chat with tool use, typed end-to-end via tRPC, Postgres-backed conversation history, and RevenueCat for subscriptions so you can gate premium features from day one.

Quick start

npx create-cache-app my-app --template nextjs-ai-sdk-trpc
cd my-app
cp .env.example .env.local  # fill in keys
pnpm install
pnpm db:push
pnpm dev

What’s wired up

  • Streaming chat via ai/react with Claude Sonnet as default, switchable
  • Tool use with a registry pattern — drop a new tool file into src/tools/ and it auto-registers
  • tRPC with superjson, React Query, and typed procedures for auth, chat, and billing
  • Prisma models for User, Conversation, Message, Subscription
  • RevenueCat webhook handler and entitlement checks in middleware

What’s not included

No auth provider baked in — the starter is agnostic. Wire up Clerk, Auth.js, or Supabase Auth. The docs have recipes for all three.