Next.js SaaS template for products that charge by usage — API calls, storage, email sends. Two plans (Starter, Pro) with included usage amounts per feature.
Usage above the included limits is billed as overage at the end of each billing period. Your customers keep a predictable base price and pay more only when they use more.
Stack: Next.js 16, Better Auth, Drizzle ORM, PostgreSQL, Commet SDK
Quick Start
commet create my-app -t metered
cd my-app
pnpm install
pnpm devWhat's Included
- Two plans with monthly and yearly prices
- Three metered features: API Calls, Storage, Email Sends
- Included usage per plan with overage billing
- Usage tracking via Commet SDK
- Usage overview dashboard showing current vs included
- Customer billing portal
- Pricing page with included amounts
Key Files
lib/auth/auth.ts— Better Auth + Commet plugin with usage modulelib/payments/commet.ts— Checkout session creationapp/(dashboard)/dashboard/page.tsx— Usage overview with current vs includedapp/pricing/page.tsx— Dynamic pricing with included amountsapp/api/commet/portal/route.ts— Customer portal redirect
Learn More
- Consumption Models — Metered model details
- Track Usage
- Customer Portal
Run commet create my-app -t metered to start from this template, or browse the source on GitHub.
