Credit-based AI billing
A real usage ledger — every generation decrements a credit, blocks at zero, and surfaces an upgrade flow. The one thing most kits fake, built for real.
A light-themed AI-SaaS starter kit for Next.js. Auth, a credit-based billing ledger and a streaming AI chat, all running offline with zero cloud keys. Add your keys when you're ready to ship.
No sign-up. No API keys. Clone → npm run dev → streaming AI chat in 60 seconds.
Credits
48 / 50
The boring 80%, already built on
Auth, billing, a credit ledger, and a streaming chat. All wired up, working offline, and swappable for the real thing behind a single env flag.
A real usage ledger — every generation decrements a credit, blocks at zero, and surfaces an upgrade flow. The one thing most kits fake, built for real.
Token-by-token streaming with a live cursor. Mock provider by default; flip an env var for OpenAI or Anthropic — the UI never changes.
type Session = {
userId: string;
email: string;
credits: number;
}cookie today · Auth.js / Clerk tomorrow
Cookie session that runs offline today and swaps for Auth.js or Clerk tomorrow. The app only depends on a tiny Session shape.
Checkout tops up the local ledger with zero keys, then becomes Stripe Checkout the moment STRIPE_SECRET_KEY is set. Same interface, both paths.
DATABASE_URL
libSQL writes to a local SQLite file out of the box. Point DATABASE_URL at Turso to go to production without touching the data layer.
--color-brand:#7C5CFCone variable → every gradient, button & accent
Light, premium, and violet by default. Change --color-brand in globals.css and every gradient, button and accent follows.
The demo-without-keys is the whole point — prove the product to yourself before you sign up for a single SaaS.
git clone, npm install, npm run dev. The kit boots with a local SQLite file, demo auth, and a mock AI provider — no .env required.
$ npm install && npm run devSign in with one click, open the chat, watch a response stream token-by-token, and see a credit decrement and a limit-reached upgrade flow.
$ open http://localhost:3000/chatDrop in OPENAI_API_KEY, STRIPE_SECRET_KEY, and a Turso DATABASE_URL. Mock paths become real ones — the UI code never changes. Deploy.
$ vercel --prodEvery tier runs locally first. Add Stripe to charge cards — the credit ledger is identical in mock and real mode.
Kick the tires. Everything runs locally, no card needed.
50 credits / month
For the product you're actually shipping to real users.
5,000 credits / month
Usage-based billing for a product with traction.
25,000 credits / month
“Add a short customer quote here describing how this kit helped your team ship faster. Keep it specific and honest.”
“Another placeholder quote goes here. Highlight a concrete result — time saved, a feature shipped, or a problem solved.”
“One more placeholder quote. Swap in a real testimonial once you have permission to feature the reviewer.”
Yes. With zero environment variables, auth is a demo cookie, the database is a local SQLite file, billing tops up a local credit ledger, and the AI streams a deterministic mock response. The whole purchase → credits → streaming-chat loop is demoable offline.
Set OPENAI_API_KEY or ANTHROPIC_API_KEY. The mock branch in lib/ai.ts is replaced by a real streaming call — the chat UI and credit metering code never change.
Every generation decrements one credit from a ledger stored in the database, records the usage, and blocks at zero with a clean limit-reached state. Credit packs top the ledger back up — mocked offline, real Stripe Checkout when STRIPE_SECRET_KEY is set.
Plinth is intentionally light, premium, and violet. It's not another dark dashboard template. Recolor the entire kit by editing a single CSS variable, --color-brand, in app/globals.css.
Next.js 15 App Router, TypeScript, Tailwind v4, and libSQL (local file or Turso). No heavyweight ORM, no forced multi-tenancy — small and clear on purpose.
Yes. It ships under a permissive license for building unlimited end products. You can't resell the kit itself as a competing starter kit. See LICENSE.md for the full terms.
Still curious? hello@yourdomain.com
Clone Plinth and have a streaming AI SaaS with real credit billing running in minutes — no cloud keys required.