Explore complete applications for the main Commet billing models and lifecycle patterns.
The examples are runnable applications, not isolated API snippets. Each one shows how product state, Commet configuration, server actions, and customer access work together.
| Example | What it demonstrates |
|---|---|
| Fixed subscription | A recurring plan, checkout, and subscription-backed access |
| Metered usage | Included usage, event tracking, and overage |
| Credits | Recurring credits and credit-aware product actions |
| Fixed balance | Prepaid monetary balance and top-ups |
| AI balance | AI token costs charged against a balance |
| Seats | Team membership synchronized with seat quantities |
| Quota | Capacity checks and quota mutations |
The webhooks example shows subscription activation, past-due recovery, cancellation, signed event handling, and UI derived from confirmed billing state.
Clone the repository, open one example directory, copy .env.example, and use a sandbox API key. Keep the example's database and Commet organization disposable; Test Clock operations and fixture cards are sandbox-only.
git clone https://github.com/commet-labs/commet.git
cd commet/examples/metered
cp .env.example .env
pnpm install
pnpm devRead the example together with the relevant conceptual guide. The source shows one implementation; How Billing Works defines the rules that remain true across frameworks.
How is this guide?