Business operating system for Claude Code — 57 skills, 21 agents, smart daemon. Unified inbox (WhatsApp/Email/Slack/Telegram), autonomous PR merge, full-AWS monitoring, revenue (Stripe+RevenueCat), e-commerce (Shopify), marketing (Klaviyo/Meta/GA4), voice (Bland/ElevenLabs), APM (Datadog/NewRelic/OTEL), YOLO mode.
Shell agent-teamsai-agentai-automationanthropicautonomous-agentawsbusiness-operationsclaudeclaude-codeclaude-code-plugindevopsecommerceinbox-zeroklaviyomarketingmcpmorning-briefingpr-automationshopifyterminal
feat(09-04): Next.js SaaS template with App Router, Auth.js v5, Stripe, Prisma
auroracapitald94eaca7ad39
diff --git a/claude-ops/templates/nextjs-saas/.env.example b/claude-ops/templates/nextjs-saas/.env.examplenew file mode 100644index 00000000..b92708e8--- /dev/null+++ b/claude-ops/templates/nextjs-saas/.env.example@@ -0,0 +1,9 @@+DATABASE_URL=postgresql://postgres:postgres@localhost:5432/saasapp+NEXTAUTH_URL=http://localhost:3000+NEXTAUTH_SECRET=change-me-to-random-secret-32-chars-min+GITHUB_CLIENT_ID=your-github-oauth-app-client-id+GITHUB_CLIENT_SECRET=your-github-oauth-app-client-secret+GOOGLE_CLIENT_ID=your-google-oauth-client-id+GOOGLE_CLIENT_SECRET=your-google-oauth-client-secret+STRIPE_SECRET_KEY=sk_test_your-stripe-secret-key+STRIPE_WEBHOOK_SECRET=whsec_your-stripe-webhook-secretdiff --git a/claude-ops/templates/nextjs-saas/README.md b/claude-ops/templates/nextjs-saas/README.mdnew file mode 100644index 00000000..8a39287d--- /dev/null+++ b/claude-ops/templates/nextjs-saas/README.md@@ -0,0 +1,98 @@+# Next.js SaaS Template++Production-ready SaaS starter with Next.js 14 App Router, Auth.js v5, Stripe billing, Prisma ORM, and Tailwind CSS.++## Features++- **Next.js 14 App Router** — server components, layouts, route groups+- **Auth.js v5 (next-auth@beta)** — GitHub and Google OAuth, PrismaAdapter, server-side sessions+- **Stripe billing** — subscription webhook handler with signature verification+- **Prisma ORM** — PostgreSQL with User, Account, Session, Subscription, VerificationToken models+- **Tailwind CSS v3** — utility-first styling, responsive dashboard layout+- **Landing page** — hero section with CTA buttons+- **Dashboard layout** — sidebar navigation, metric cards++## Prerequisites++- Node 20++- PostgreSQL (local or hosted)+- Stripe account (for billing features)+- GitHub OAuth App and/or Google OAuth credentials++## Quick Start++```bash+# 1. Install dependencies+npm install++# 2. Copy environment file and fill in all values+cp .env.example .env++# 3. Push Prisma schema to database+npm run db:push++# 4. Start development server+npm run dev+```++The app will be available at `http://localhost:3000`.++## Environment Variables++| Variable | Description |+| ------------------------ | ------------------------------------------------- |+| `DATABASE_URL` | PostgreSQL connection string |+| `NEXTAUTH_URL` | Full URL of your app (e.g. `http://localhost:3000`) |+| `NEXTAUTH_SECRET` | Random 32+ char secret for session signing |+| `GITHUB_CLIENT_ID` | GitHub OAuth App client ID |+| `GITHUB_CLIENT_SECRET` | GitHub OAuth App client secret |+| `GOOGLE_CLIENT_ID` | Google OAuth client ID |+| `GOOGLE_CLIENT_SECRET` | Google OAuth client secret |+| `STRIPE_SECRET_KEY` | Stripe secret key (`sk_test_...` or `sk_live_...`) |+| `STRIPE_WEBHOOK_SECRET` | Stripe webhook signing secret (`whsec_...`) |++## Auth Provider Setup++### GitHub OAuth+1. Go to GitHub → Settings → Developer Settings → OAuth Apps → New OAuth App+2. Set **Authorization callback URL** to `http://localhost:3000/api/auth/callback/github`+3. Copy Client ID and Client Secret to `.env`++### Google OAuth+1. Go to [Google Cloud Console](https://console.cloud.google.com) → APIs & Services → Credentials+2. Create OAuth 2.0 Client ID (Web application)+3. Add `http://localhost:3000/api/auth/callback/google` as an authorized redirect URI+4. Copy Client ID and Client Secret to `.env`++## Stripe Webhook Setup++1. Install Stripe CLI: `brew install stripe/stripe-cli/stripe`+2. Forward events to your local server:+ ```bash+ stripe listen --forward-to localhost:3000/api/webhooks/stripe+ ```+3. Copy the webhook signing secret output to `STRIPE_WEBHOOK_SECRET` in `.env`+4. In production, create a webhook endpoint in the Stripe Dashboard pointing to `https://yourdomain.com/api/webhooks/stripe`++## Deployment++### Vercel (recommended)++[](https://vercel.com/new)++1. Push your repo to GitHub+2. Import the project in Vercel+3. Add all environment variables in the Vercel dashboard+4. Set `NEXTAUTH_URL` to your production domain+5. Deploy++### Other platforms++Build the app and run it:++```bash+npm run build+npm start+```++Ensure `DATABASE_URL` points to a production PostgreSQL instance and run `npm run db:push` (or `prisma migrate deploy` for production migrations) before starting.diff --git a/claude-ops/templates/nextjs-saas/app/(auth)/login/page.tsx b/claude-ops/templates/nextjs-saas/app/(auth)/login/page.tsxnew file mode 100644index 00000000..a0fd9783--- /dev/null+++ b/claude-ops/templates/nextjs-saas/app/(auth)/login/page.tsx@@ -0,0 +1,24 @@+'use client';+import { signIn } from 'next-auth/react';++export default function LoginPage() {+ return (+ <div className="flex min-h-screen items-center justify-center bg-gray-50">+ <div className="w-full max-w-md rounded-lg bg-white p-8 shadow">+ <h2 className="text-2xl font-bold text-gray-900">Sign in</h2>+ <button+ onClick={() => signIn('github', { callbackUrl: '/dashboard' })}+ className="mt-6 w-full rounded-md bg-gray-900 px-4 py-2 text-white hover:bg-gray-700"+ >+ Continue with GitHub+ </button>+ <button+ onClick={() => signIn('google', { callbackUrl: '/dashboard' })}+ className="mt-3 w-full rounded-md border border-gray-300 px-4 py-2 hover:bg-gray-50"+ >+ Continue with Google+ </button>+ </div>+ </div>+ );+}diff --git a/claude-ops/templates/nextjs-saas/app/(dashboard)/layout.tsx b/claude-ops/templates/nextjs-saas/app/(dashboard)/layout.tsxnew file mode 100644index 00000000..29354a61--- /dev/null+++ b/claude-ops/templates/nextjs-saas/app/(dashboard)/layout.tsx@@ -0,0 +1,28 @@+import Link from 'next/link';++export default function DashboardLayout({ children }: { children: React.ReactNode }) {+ return (+ <div className="flex h-screen bg-gray-100">+ <aside className="w-64 bg-white shadow-sm">+ <div className="p-6">+ <h2 className="text-xl font-semibold">SaaS App</h2>+ </div>+ <nav className="mt-4 px-4">+ <Link+ href="/dashboard"+ className="block rounded-lg px-4 py-2 text-gray-700 hover:bg-gray-100"+ >+ Dashboard+ </Link>+ <Link+ href="/dashboard/settings"+ className="block rounded-lg px-4 py-2 text-gray-700 hover:bg-gray-100"+ >+ Settings+ </Link>+ </nav>+ </aside>+ <main className="flex-1 overflow-auto p-8">{children}</main>+ </div>+ );+}diff --git a/claude-ops/templates/nextjs-saas/app/(dashboard)/page.tsx b/claude-ops/templates/nextjs-saas/app/(dashboard)/page.tsxnew file mode 100644index 00000000..9f7499af--- /dev/null+++ b/claude-ops/templates/nextjs-saas/app/(dashboard)/page.tsx@@ -0,0 +1,16 @@+export default function DashboardPage() {+ return (+ <div>+ <h1 className="text-3xl font-bold text-gray-900">Dashboard</h1>+ <p className="mt-2 text-gray-600">Welcome back. Here is your overview.</p>+ <div className="mt-6 grid grid-cols-1 gap-6 sm:grid-cols-3">+ {['Total Users', 'Monthly Revenue', 'Active Subscriptions'].map((metric) => (+ <div key={metric} className="rounded-lg bg-white p-6 shadow">+ <p className="text-sm font-medium text-gray-600">{metric}</p>+ <p className="mt-2 text-3xl font-bold text-gray-900">—</p>+ </div>+ ))}+ </div>+ </div>+ );+}diff --git a/claude-ops/templates/nextjs-saas/app/api/auth/[...nextauth]/route.ts b/claude-ops/templates/nextjs-saas/app/api/auth/[...nextauth]/route.tsnew file mode 100644index 00000000..3bc7e225--- /dev/null+++ b/claude-ops/templates/nextjs-saas/app/api/auth/[...nextauth]/route.ts@@ -0,0 +1,2 @@+import { handlers } from '../../../../lib/auth';+export const { GET, POST } = handlers;diff --git a/claude-ops/templates/nextjs-saas/app/api/webhooks/stripe/route.ts b/claude-ops/templates/nextjs-saas/app/api/webhooks/stripe/route.tsnew file mode 100644index 00000000..0dc2d8bc--- /dev/null+++ b/claude-ops/templates/nextjs-saas/app/api/webhooks/stripe/route.ts@@ -0,0 +1,35 @@+import { NextRequest, NextResponse } from 'next/server';+import Stripe from 'stripe';+import { prisma } from '../../../../lib/prisma';++const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, { apiVersion: '2024-06-20' });++export async function POST(req: NextRequest) {+ const body = await req.text();+ const sig = req.headers.get('stripe-signature')!;++ let event: Stripe.Event;+ try {+ event = stripe.webhooks.constructEvent(body, sig, process.env.STRIPE_WEBHOOK_SECRET!);+ } catch {+ return NextResponse.json({ error: 'Invalid signature' }, { status: 400 });+ }++ if (+ event.type === 'customer.subscription.updated' ||+ event.type === 'customer.subscription.deleted'+ ) {+ const subscription = event.data.object as Stripe.Subscription;+ await prisma.subscription.upsert({+ where: { stripeSubscriptionId: subscription.id },+ update: { status: subscription.status },+ create: {+ stripeSubscriptionId: subscription.id,+ status: subscription.status,+ userId: subscription.metadata.userId,+ },+ });+ }++ return NextResponse.json({ received: true });+}diff --git a/claude-ops/templates/nextjs-saas/app/globals.css b/claude-ops/templates/nextjs-saas/app/globals.cssnew file mode 100644index 00000000..b5c61c95--- /dev/null+++ b/claude-ops/templates/nextjs-saas/app/globals.css@@ -0,0 +1,3 @@+@tailwind base;+@tailwind components;+@tailwind utilities;diff --git a/claude-ops/templates/nextjs-saas/app/layout.tsx b/claude-ops/templates/nextjs-saas/app/layout.tsxnew file mode 100644index 00000000..9c7cf8e0--- /dev/null+++ b/claude-ops/templates/nextjs-saas/app/layout.tsx@@ -0,0 +1,18 @@+import type { Metadata } from 'next';+import { Inter } from 'next/font/google';+import './globals.css';++const inter = Inter({ subsets: ['latin'] });++export const metadata: Metadata = {+ title: 'SaaS App',+ description: 'Built with Next.js App Router',+};++export default function RootLayout({ children }: { children: React.ReactNode }) {+ return (+ <html lang="en">+ <body className={inter.className}>{children}</body>+ </html>+ );+}diff --git a/claude-ops/templates/nextjs-saas/app/page.tsx b/claude-ops/templates/nextjs-saas/app/page.tsxnew file mode 100644index 00000000..957b2292--- /dev/null+++ b/claude-ops/templates/nextjs-saas/app/page.tsx@@ -0,0 +1,28 @@+import Link from 'next/link';++export default function LandingPage() {+ return (+ <main className="flex min-h-screen flex-col items-center justify-center bg-gradient-to-b from-white to-gray-50 p-8">+ <h1 className="text-5xl font-bold tracking-tight text-gray-900 sm:text-6xl">+ Your SaaS Product+ </h1>+ <p className="mt-4 text-xl text-gray-600 max-w-xl text-center">+ Description of what your product does. Replace this with your value proposition.+ </p>+ <div className="mt-8 flex gap-4">+ <Link+ href="/register"+ className="rounded-md bg-indigo-600 px-6 py-3 text-white font-semibold hover:bg-indigo-500"+ >+ Get started+ </Link>+ <Link+ href="/login"+ className="rounded-md border border-gray-300 px-6 py-3 font-semibold hover:bg-gray-50"+ >+ Sign in+ </Link>+ </div>+ </main>+ );+}diff --git a/claude-ops/templates/nextjs-saas/lib/auth.ts b/claude-ops/templates/nextjs-saas/lib/auth.tsnew file mode 100644index 00000000..cd934925--- /dev/null+++ b/claude-ops/templates/nextjs-saas/lib/auth.ts@@ -0,0 +1,26 @@+import NextAuth from 'next-auth';+import GitHub from 'next-auth/providers/github';+import Google from 'next-auth/providers/google';+import { PrismaAdapter } from '@auth/prisma-adapter';+import { prisma } from './prisma';++export const { handlers, auth, signIn, signOut } = NextAuth({+ adapter: PrismaAdapter(prisma),+ providers: [+ GitHub({+ clientId: process.env.GITHUB_CLIENT_ID!,+ clientSecret: process.env.GITHUB_CLIENT_SECRET!,+ }),+ Google({+ clientId: process.env.GOOGLE_CLIENT_ID!,+ clientSecret: process.env.GOOGLE_CLIENT_SECRET!,+ }),+ ],+ pages: { signIn: '/login' },+ callbacks: {+ session({ session, user }) {+ session.user.id = user.id;+ return session;+ },+ },+});diff --git a/claude-ops/templates/nextjs-saas/lib/prisma.ts b/claude-ops/templates/nextjs-saas/lib/prisma.tsnew file mode 100644index 00000000..67f1d28a--- /dev/null+++ b/claude-ops/templates/nextjs-saas/lib/prisma.ts@@ -0,0 +1,9 @@+import { PrismaClient } from '@prisma/client';++const globalForPrisma = globalThis as unknown as { prisma: PrismaClient };++export const prisma =+ globalForPrisma.prisma ??+ new PrismaClient({ log: process.env.NODE_ENV === 'development' ? ['query'] : [] });++if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;diff --git a/claude-ops/templates/nextjs-saas/lib/stripe.ts b/claude-ops/templates/nextjs-saas/lib/stripe.tsnew file mode 100644index 00000000..7380f7f2--- /dev/null+++ b/claude-ops/templates/nextjs-saas/lib/stripe.ts@@ -0,0 +1,2 @@+import Stripe from 'stripe';+export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, { apiVersion: '2024-06-20' });diff --git a/claude-ops/templates/nextjs-saas/next.config.ts b/claude-ops/templates/nextjs-saas/next.config.tsnew file mode 100644index 00000000..f8874b30--- /dev/null+++ b/claude-ops/templates/nextjs-saas/next.config.ts@@ -0,0 +1,3 @@+import type { NextConfig } from 'next';+const config: NextConfig = {};+export default config;diff --git a/claude-ops/templates/nextjs-saas/package.json b/claude-ops/templates/nextjs-saas/package.jsonnew file mode 100644index 00000000..ea51ced4--- /dev/null+++ b/claude-ops/templates/nextjs-saas/package.json@@ -0,0 +1,36 @@+{+ "name": "nextjs-saas",+ "version": "0.1.0",+ "private": true,+ "scripts": {+ "dev": "next dev",+ "build": "next build",+ "start": "next start",+ "lint": "next lint",+ "db:push": "prisma db push",+ "db:studio": "prisma studio"+ },+ "dependencies": {+ "next": "^14.0.0",+ "react": "^18.0.0",+ "react-dom": "^18.0.0",+ "next-auth": "^5.0.0-beta.25",+ "@auth/prisma-adapter": "^2.0.0",+ "@prisma/client": "^5.0.0",+ "stripe": "^14.0.0",+ "clsx": "^2.0.0",+ "tailwind-merge": "^2.0.0"+ },+ "devDependencies": {+ "@types/node": "^20.0.0",+ "@types/react": "^18.0.0",+ "@types/react-dom": "^18.0.0",+ "autoprefixer": "^10.0.0",+ "eslint": "^8.0.0",+ "eslint-config-next": "^14.0.0",+ "postcss": "^8.0.0",+ "prisma": "^5.0.0",+ "tailwindcss": "^3.0.0",+ "typescript": "^5.0.0"+ }+}diff --git a/claude-ops/templates/nextjs-saas/prisma/schema.prisma b/claude-ops/templates/nextjs-saas/prisma/schema.prismanew file mode 100644index 00000000..70d4176e--- /dev/null+++ b/claude-ops/templates/nextjs-saas/prisma/schema.prisma@@ -0,0 +1,64 @@+generator client {+ provider = "prisma-client-js"+}++datasource db {+ provider = "postgresql"+ url = env("DATABASE_URL")+}++model User {+ id String @id @default(cuid())+ name String?+ email String @unique+ emailVerified DateTime?+ image String?+ accounts Account[]+ sessions Session[]+ subscriptions Subscription[]+ createdAt DateTime @default(now())+}++model Account {+ id String @id @default(cuid())+ userId String+ type String+ provider String+ providerAccountId String+ refresh_token String?+ access_token String?+ expires_at Int?+ token_type String?+ scope String?+ id_token String?+ session_state String?+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)++ @@unique([provider, providerAccountId])+}++model Session {+ id String @id @default(cuid())+ sessionToken String @unique+ userId String+ expires DateTime+ user User @relation(fields: [userId], references: [id], onDelete: Cascade)+}++model Subscription {+ id String @id @default(cuid())+ userId String+ stripeSubscriptionId String @unique+ status String+ createdAt DateTime @default(now())+ updatedAt DateTime @updatedAt+ user User @relation(fields: [userId], references: [id])+}++model VerificationToken {+ identifier String+ token String @unique+ expires DateTime++ @@unique([identifier, token])+}diff --git a/claude-ops/templates/nextjs-saas/tailwind.config.ts b/claude-ops/templates/nextjs-saas/tailwind.config.tsnew file mode 100644index 00000000..b1f868ae--- /dev/null+++ b/claude-ops/templates/nextjs-saas/tailwind.config.ts@@ -0,0 +1,8 @@+import type { Config } from 'tailwindcss';++const config: Config = {+ content: ['./app/**/*.{js,ts,jsx,tsx,mdx}', './components/**/*.{js,ts,jsx,tsx,mdx}'],+ theme: { extend: {} },+ plugins: [],+};+export default config;