Ship the product, not the plumbing.
A Next.js starter with workspaces, roles, Stripe billing and metered AI.
The three weeks every B2B AI product loses.
Workspaces
Slug-based tenancy with Owner, Admin and Member roles.
Invitations
Seat-aware invites with hashed tokens.
Stripe billing
Checkout, Billing Portal, idempotent webhooks.
Metered AI chat
Credits deducted per workspace.
API keys
Per-workspace keys for the chat API, stored as SHA-256.
Audit log
Who invited whom, and who changed which key.
Next.js 16, TypeScript, Drizzle on Postgres, Auth.js, Stripe, AI SDK 7, Tailwind v4 and shadcn/ui.
Plans, seats and credits on one screen.
Upgrade through Stripe Checkout. Payment methods and cancellation live in the Billing Portal.
Built to survive a real launch.
Credit deduction is one atomic SQL update.
Authorization is re-checked in the database, never trusted from the session.
39 tests, plus scripts that verify the database, billing and email.
See where every credit goes.
Usage per day, member and model, with a forecast. Members, roles and pending invites alongside.
What it does not do yet.
Rate limiting. Add it before going public.
Stripe Tax and usage-based Stripe prices.
Workspace deletion and UI tests.