Guides

Build guides

Step-by-step walkthroughs for shipping real features with @buildbase/sdk.

35 posts · page 3 of 3

Build guide

How to enforce quotas server-side in Next.js

The record call is the lock, not the if-statement after it. How quota enforcement actually behaves on hard-cap and overage plans.

4 min read
Build guide

How to add a credits wallet in Next.js, and why the balance is not one number

Add a credits wallet in Next.js: sell packages, show the balance, spend FIFO from dated buckets, and warn before expiry. The balance is an aggregate over buckets, not a column you decrement.

10 min read
Build guide

How to change pricing without affecting existing customers in Next.js

Change SaaS pricing without affecting existing customers: publish a new plan version, leave subscriptions pinned to the old one, and decide what a v1 customer sees when you ship v3.

10 min read
Build guide

An annual and monthly toggle in Next.js, and why it is not a boolean

How to add an annual and monthly toggle in Next.js: why the display interval is not the billing interval, what happens to plan allowances, and where the savings percentage should come from.

8 min read
Build guide

Proration on plan change in Next.js, and why a downgrade needs the opposite setting

Proration on plan change in Next.js: why upgrades and downgrades need opposite proration behavior, and how to read direction without mistaking a yearly plan for a bigger one.

9 min read
Build guide

How to add a free trial without a card in Next.js

A free trial with no credit card in Next.js: turn the card requirement off on the plan version, then handle the part Stripe cannot - what your app renders, and who the gate lets through.

8 min read
Build guide

Charge per credit in Next.js, and why the debit goes last

Charge per credit in Next.js: check the balance before the work, debit after it, return 402 when the balance is empty, and pass an idempotencyKey so a retry is not charged twice.

8 min read
Build guide

Charge per seat in Next.js, and handle the moment seats run out

Per-seat billing in Next.js: read seat state, gate the invite button, and branch on why invites are blocked. The three block reasons need three different answers.

4 min read
Build guide

Charge per API call in Next.js, with overages billed to Stripe

Meter every call, enforce the quota in the same request, and bill what goes over. The whole loop in one route handler.

2 min read
Build guide

Enforcing quotas in React without scattering if-statements

Gate features on remaining quota with conditional components, and warn before the wall rather than at it.

2 min read
Build guide

Add multi-tenant workspaces in an afternoon

Workspaces, membership and roles without designing a tenancy model from scratch or bolting one on later.

3 min read

Follow a guide with your own project

Every guide starts with one install. Create a project and build along.

7-day free trialNo credit card requiredCancel anytime