Quota-based billing template for a durable, countable balance that goes up when you create and down when you delete, unlike a one-way usage meter. Each plan includes an amount, and going over triggers per-unit overage. This example uses a task management app with three plans (Starter, Pro, Scale): creating a task calls quota.add, deleting calls quota.remove, and a live usage bar tracks used / included.
Stack: Next.js 16, Better Auth, Drizzle ORM, PostgreSQL, Commet SDK
Quick Start
commet create my-app -t quota
cd my-app
pnpm install
pnpm devWhat's Included
- Three plans with increasing task limits (5, 15, 50)
- Per-task overage billing when you go over the included amount
- Live usage bar showing used / included, turning amber near the limit and destructive on overage
- Creating a task calls
quota.add; deleting a task callsquota.remove - Customer billing portal
- Pricing page with plan comparison
Key Files
actions/tasks.ts— Create and delete tasks withquota.add/quota.removecomponents/billing/task-usage-bar.tsx— Usage bar readingfeatures.getapp/pricing/page.tsx— Pricing page with plan comparisonlib/commet.ts— Commet SDK client
