# BuildBase: every published post and the changelog
> The full text of https://www.buildbase.app, for agents. The map is https://www.buildbase.app/llms.txt; the API and SDK documentation is https://docs.buildbase.app/llms-full.txt. Each post is also served alone at its URL plus `.md`.
## Orb vs BuildBase: what $6.00 a credit actually buys
> Orb now publishes a self-serve price: $6.00 per credit, with credits drawn by billings and by ingested events at the same time. Here is the arithmetic, and where BuildBase fits instead.
- Source: https://www.buildbase.app/compare/orb-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-11-06
### In short
Orb charges $6.00 per credit on its self-serve Business plan, and credits drain from two meters at once: one per $1,000 of billings, one per 200,000 ingested events. Past 200 events per dollar billed, ingestion sets your bill rather than the 0.60%. BuildBase makes billing one of 20 modules on your own Stripe account.
For years the honest answer to "what does Orb cost" was that nobody outside
their sales calls knew. The roundups on page one still say contact sales.
That changed. Orb publishes a self-serve price now, and the pages telling you it
does not are out of date. The price turns out to be stranger than a percentage.
None of them has done the arithmetic on it, so we did.
### The one-paragraph answer
Orb is a dedicated usage-metering and billing engine, owned by Adyen since July.
Its Business plan costs $6.00 per credit, and credits drain from two meters at
once: one per $1,000 of billings processed, one per 200,000 events ingested. BuildBase is an
SDK where billing is one of 20 modules, sitting beside authentication,
workspaces and role permissions, and running on your own Stripe account. Pick
Orb when metered events genuinely are your pricing and getting them right is an
engineering problem. Pick BuildBase when billing is the fourth system you have
not built yet. They barely compete, because they answer different questions.
### What a credit actually is
A credit is two meters sharing one balance. Orb's pricing page quotes the rate:
$6.00 per credit on Business, or less with volume discounts, and new accounts
get 100 free credits. An equivalence sits in the FAQ: one credit "works out to
0.60% of billing volume, plus event ingestion and other metered dimensions."
Read that second clause again. It is doing more work than it looks.
The consumption table underneath tells you what a credit really buys, and it is
not one thing. One credit is $1,000 of billings processed through Orb. It is
also 200,000 events ingested, live and test alike, and two credits is 500,000
rows exported. Those are not
three ways of describing one credit, they are separate meters drawing down a
single balance.
So your bill is not 0.60% of revenue. It is that **plus** $0.03 per 1,000
ingested events, which is what $6.00 per 200,000 events works out to, and the
0.60% is simply the floor you pay when you ingest almost nothing.
### The crossover is 200 events per dollar
The ingestion dial starts costing more than the billings dial at **200 ingested
events per dollar of billings**.
The arithmetic is short. Billings consume credits at one per $1,000, so a dollar
of revenue burns 0.001 credits. Events consume credits at one per 200,000, so an
event burns 0.000005 credits. Divide one by the other and the crossover falls at
200 ingested events for every dollar of billings. Below that, revenue sets your
bill. Above it, your meter does.
Two products, same revenue:
A B2B tool bills $50,000 a month and ingests two million events. Billings cost
50 credits, events cost 10 credits, so 60 credits at $6.00 is $360. That is
0.72% of billings, a fifth above the headline and no real surprise.
An AI product bills the same $50,000 and ingests twenty million events, because
it meters per call and per token. Billings still cost 50 credits. Events now
cost 100 credits. The bill is 150 credits, or $900, which is 1.8% of billings -
three times the number on the pricing page, for identical revenue.
Neither product is being overcharged. Orb's costs really do scale with ingestion,
and pricing the thing that drives your cost is defensible. But a founder who
budgets 0.60% off the FAQ and happens to be building the second product will be
wrong by a factor of three, and no page currently ranking for Orb's pricing will
have warned them.
Work out your own ratio before you model anything. Monthly ingested events
divided by monthly dollars billed. If that number is comfortably under 200, the
headline percentage is roughly your bill. If it is over, ingestion is what you
are buying. Price it as such.
### Where BuildBase charges differently
BuildBase charges a flat plan price and takes no share of your revenue. Free at
$0, then Launch at $19, Grow at $49 and Scale at $99 a month, with a seven-day
trial on the paid plans and no card needed to start one. Yearly is ten months
for twelve. Those were current on 31 October 2026, and the live ones are always
at [/pricing](/pricing).
Nothing in that scales with what you bill your customers. Stripe's own fees are
Stripe's, charged to [your own Stripe account](/blog/bring-your-own-stripe), and
nothing sits in between. We do meter three things and bill overage on them:
workflow runs at $0.25, $0.15 and $0.10 per 1,000 on Launch, Grow and Scale, web
analytics events at $2 per 100,000, and storage at $0.10 per GB-month. Every
other quota is a hard allowance that simply stops.
That is a deliberately smaller promise than Orb's. Our billing module does plan
versioning, seat and usage pricing in flat, graduated or volume tiers, add-ons,
promotion codes, Stripe Tax, and a credit ledger with expiry and auto top-up.
Per-plan limits apply to any metric you define, with overage reported to Stripe
Billing Meters. What it is not is an ingestion pipeline.
| Feature | BuildBase | Orb |
| --- | --- | --- |
| Published price | Free $0, then $19, $49 and $99 a month | Business at $6.00 per credit, less with volume discounts; Enterprise is custom |
| How the bill grows | Flat plan price; overage only on workflow runs, analytics events and storage | Credits drawn by billings ($1,000 each) and events (200,000 each), so revenue and ingestion both push it up |
| Event ingestion | Per-plan limits on any metric, with overage reported to Stripe Billing Meters | Hosted rollups documented at 1M+ billing events per second in production |
| Late data and corrections | Not built | Backfills that recalculate affected invoices, and simulations against historical usage |
| Revenue recognition and ERP | Not built: no revenue recognition, no accounting sync | Recognized and deferred revenue with exports, plus a one-way NetSuite sync |
| Auth, workspaces and roles | 16 sign-in methods, multi-tenant workspaces and role permissions in the same instance | Out of scope: Orb is a billing and metering product |
| Payment relationship | Your own Stripe account | Owned by Adyen since 1 July 2026 |
### The acquisition, with less certainty than you have read elsewhere
Adyen acquired Orb. Its own knowledge hub says the deal was announced in June
2026 and completed on 1 July. That much is from the acquirer and is solid.
Beyond it, be careful. A deal value circulates widely in third-party coverage,
and so does a description of how Adyen runs Orb internally, but neither appears
on an Adyen or Orb page we could load today. We have repeated both in [our own
earlier writing](/compare/lago-alternatives), and on this pass we could not
stand them up, so they are not in this post. Treat any specific number you see
attached to this deal as reported rather than confirmed.
What the acquisition does change is the premise of every "neutral metering
engine" pitch. [Metronome went to
Stripe](/compare/metronome-vs-buildbase) on 14 January 2026, per Stripe's own
newsroom post, and Orb went to Adyen on 1 July. If you
were shopping for a metering layer precisely so a payments company would not own
it, the two deepest options on the list are now owned by payments companies. That
may not matter to you at all, and Orb's engine did not get worse on 1 July.
### Where Orb wins
> **Where Orb wins:** Three things, and they are not close.
>
> **Throughput we do not publish a number for.** Orb documents hosted rollups
> handling 1M+ billing events per second in production deployments. Our constants
> carry no throughput figure at all, deliberately, because our metering is sized
> for per-plan quotas and overage rather than for being the pipeline behind
> someone's inference API. Orb's own customer page names Vercel, Replit, Supabase
> and Baseten, which tells you the volume band it is built for.
>
> **Late data, and being able to change your mind.** Orb ships backfills and
> corrections that recalculate already-issued invoices when events arrive late,
> and simulations that replay a pricing change against historical usage before you
> ship it. BuildBase has neither. If an event lands two days after the invoice, we
> have no story for that and Orb has a product for it.
>
> **The finance side of billing.** Orb tracks recognized and deferred revenue with
> exports, and syncs to NetSuite as real invoices, credit memos and customer
> deposits with line-level service periods. BuildBase ships no ERP integration, no
> accounting sync and no revenue recognition in any of its 20 modules. A finance
> team closing the books in NetSuite is a customer we do not serve, and no amount
> of module count changes that.
### So which problem do you have
Ask what breaks first, not which is cheaper.
If events are the product and double-counting one is a revenue incident, you
want metering infrastructure, and you should go read the field properly rather
than take our word for it. [The best usage-based billing
tools](/compare/best-usage-based-billing-tools) and [metered billing for AI
products](/compare/best-metered-billing-tools-for-ai-products) both cover Orb,
and it comes out well in both. [Lago](/compare/lago-vs-buildbase) is the one to
look at if self-hosting matters.
If instead the honest description is "we bill a few hundred companies for seats
and a plan tier, and we also need login, and workspaces, and a way to say who
can see what", then a credit that drains on ingestion is priced for a problem
you do not have. [Metered and seat-based billing are different
businesses](/blog/metered-vs-seat-based-billing). We costed the multi-vendor
version of that stack in [the real monthly cost of Clerk plus Stripe plus Lago
plus Knock](/blog/auth-billing-stack-cost), and the integration work between them
is the line item that never appears on anyone's pricing page.
We know the second shape because it is ours. BuildBase meters its own workflow
runs through the same module we sell, which is how those overage rates above
exist at all, and PlugNode runs usage-based credit metering on it. The thing that made
that work was never ingestion throughput. It was that the meter already knew
which workspace a run belonged to and whether the caller's role was allowed to
start it. Bolt a metering engine on from outside and those two questions are
yours to answer, in glue code, for every product you ship. That is the trade. We
give up depth, and the three things above are not a courtesy.
A note on sourcing. Orb's $6.00 per credit, the 100 free credits, the 0.60% FAQ
line and the consumption table (one credit per $1,000 of billings and per
200,000 events, two credits per 500,000 exported rows) were read on withorb.com
on 6 November 2026, as were the page-one search results described at the top.
The hosted-rollup throughput, backfills, simulations and revenue recognition
come from docs.withorb.com the same day, the NetSuite behaviour from Orb's own
product page, and the customer names from its customers page. Orb's acquisition
dates are Adyen's own knowledge hub, and Metronome's are Stripe's newsroom, both
read the same day. Every credit calculation above is ours,
worked from Orb's published figures and shown so you can check it. Our plan
prices and overage rates come from the shared constants this site builds from,
verified 31 October 2026, and the live ones are always at [/pricing](/pricing).
---
## Metronome vs BuildBase: metering infrastructure, or one module of your app?
> Metronome is usage-based billing infrastructure, now part of Stripe, priced on billing volume and ingested events. BuildBase makes billing one of 20 modules on your own Stripe account.
- Source: https://www.buildbase.app/compare/metronome-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-11-05
### In short
Metronome is usage-based billing infrastructure, now part of Stripe. Its Starter tier runs 0.8% of billing volume plus $0.04 per 1,000 ingest events; the tier above is contact sales. BuildBase makes billing one of 20 modules on your own Stripe. Metronome fits per-event pricing at scale; BuildBase fits seats and plans.
Search "Metronome alternatives" and the same roster comes back on every page:
Orb, Lago, Chargebee, Stripe Billing, maybe Recurly. Those lists are written by
billing vendors, so they all answer one question - which metering engine
replaces this metering engine.
For a lot of the people searching, that question is already the wrong one.
### The one-paragraph answer
Metronome is usage-based billing infrastructure: it ingests metered events,
rates them, and turns them into invoices and negotiated contracts. Since
January it has been part of Stripe. BuildBase is an SDK where billing is one
of 20 modules, sitting beside authentication, workspaces and role permissions,
and running on your own Stripe account. Pick Metronome when metered events
_are_ your pricing and the volume is high enough that ingestion accuracy is a
genuine engineering problem. Pick BuildBase when you charge for seats or plans
and billing is the fourth system you still have to build. They are not the same
purchase.
### What each one is selling
Metronome sells the part of billing that gets hard at scale. Events arrive,
they get rated against a contract, and an invoice comes out the other end with
the commits and drawdowns applied correctly. Their docs are organised around
contracts, not plans, and the plan-based API is marked legacy for new
customers. That is a product built for companies negotiating committed spend,
not for a team picking a monthly price.
BuildBase sells the systems around it. Billing is in there, and it is a real
billing module: subscription plans with versioning, seat and usage pricing in
flat, graduated or volume tiers, add-ons, promotion codes, Stripe Tax, and a
credit ledger with expiry and auto top-up. Per-plan limits apply to any metric
you define, with overage reported to Stripe Billing Meters.
But it sits next to [multi-tenant
workspaces](/guides/multi-tenant-workspaces-in-an-afternoon), role permissions,
email and workflow automation, which is the actual reason to buy it.
So this is not really a contest between two billing products. It is a question
about what else is unbuilt.
### Where the pricing models split
Metronome publishes one rate and keeps the rest behind a conversation. Its
Starter tier reads 0.8% of billing volume plus $0.04 per 1,000 ingested events;
the Custom tier is contact sales, with invoicing integrations, data exports and
an account manager attached. Verified on metronome.com on 5 November 2026 - a
billing vendor's own rate card moves without an announcement, so check it
before you commit to anything.
Read the shape rather than the rate. A share of billing volume means the bill
grows with your revenue whether or not the billing got harder, which is the
[revenue tax every billing platform charges in some
form](/blog/billing-platform-revenue-tax). The per-event line means the bill
also grows with how granular your metering is. Both are correct ways to price
infrastructure that scales with you. They are also exactly wrong for a product
that bills 400 companies for 12 seats each and ingests almost nothing.
BuildBase charges a flat plan price instead: Free at $0, then Launch at $19,
Grow at $49 and Scale at $99 a month, with a seven-day trial on the paid plans
and no card needed to start one. Those are our published plans as of 31 October
2026, and the live ones are always at [/pricing](/pricing).
We take no percentage of your revenue. Stripe's own fees are Stripe's,
charged to [your own Stripe account](/blog/bring-your-own-stripe), and nothing
sits in between.
| Feature | BuildBase | Metronome |
| --- | --- | --- |
| Published price | Free $0, then $19, $49 and $99 a month | Starter at 0.8% of billing volume plus $0.04 per 1,000 ingested events; Custom is contact sales |
| How the bill grows | Flat plan price; overage only on workflow runs, analytics events and storage | A share of billing volume, so the bill tracks your revenue |
| Event ingestion | Per-plan limits on any metric, with overage reported to Stripe Billing Meters | A dedicated ingest API, documented at 100,000 events per second |
| Negotiated contracts | Not built: no commits, no drawdown, no revenue recognition | Prepaid and postpaid commits, drawdown, renewals and revenue recognition |
| ERP and marketplace billing | Not built | NetSuite and Salesforce, plus AWS, Azure and GCP marketplaces |
| Auth, workspaces and roles | 16 sign-in methods, multi-tenant workspaces and role permissions in the same instance | Out of scope: its docs cover billing only |
| Stripe relationship | Your own Stripe account | Native Stripe integration, and Metronome is part of Stripe since January 2026 |
### The acquisition changes the question
Stripe completed its purchase of Metronome on 14 January 2026 and said it would
fold the metering engine into Stripe Billing. Metronome's homepage now carries
the line itself.
Most of the "Metronome alternatives" posts still ranking were written as though
you were choosing a neutral metering vendor to sit in front of whichever
processor you liked. That framing is gone. If part of why you are shopping is
not wanting a payment company to own your metering roadmap, Metronome is now
the thing you were avoiding, and [Orb went the same way when Adyen bought
it](/compare/lago-alternatives).
Worth being honest about the other direction, though. Most small teams were
going to be on Stripe regardless, and a metering engine owned by Stripe is not
obviously worse for them. What nobody can tell you yet is whether Metronome
stays separately purchasable, and Stripe has not said. Anyone claiming to know
is guessing.
### Where Metronome wins
> **Where Metronome wins:** Two things, and neither is close.
>
> **Enterprise contract structures we do not build at all.** Metronome ships
> prepaid and postpaid commits with drawdown, negotiated one-time charges,
> contract renewals and revenue recognition, plus NetSuite sync and metering
> through the AWS, Azure and GCP marketplaces. BuildBase has subscriptions,
> seats, tiers, credits and quota overage. It has no commits, no drawdown, no
> revenue recognition, no ERP sync and no cloud marketplace billing. A company
> closing committed-spend deals through AWS Marketplace should buy Metronome and
> not think about us again.
>
> **Published ingestion scale.** Metronome's docs state 100,000 events per second
> without pre-aggregation. We publish no comparable figure, because we do not
> have one to publish - our metering is sized for per-plan quotas and overage,
> not for being the ingestion pipeline behind a frontier model's API. Stripe's
> own announcement named OpenAI, Anthropic and NVIDIA among their customers,
> which makes the point better than a benchmark would.
### The part the vendor lists skip
Every roundup on page one assumes you have already decided billing is a
separate infrastructure purchase. Ours makes the opposite assumption, so here
is the check that actually decides it: what is your billable unit, and how many
of them do you ingest a day?
If the answer is tokens, gigabytes, API calls or compute-seconds, in volumes
where double-counting an event is a revenue incident, you want metering
infrastructure. Go read the field properly. We did a pass at it in [the best
usage-based billing tools](/compare/best-usage-based-billing-tools) and
[metered billing for AI products](/compare/best-metered-billing-tools-for-ai-products),
and Metronome comes out well in both.
If the answer is "seats, and a plan tier, and a usage allowance we mostly
enforce rather than bill", then a per-event rate card is priced for a problem
you do not have. [Metered and seat-based billing are different
businesses](/blog/metered-vs-seat-based-billing). Tooling that is excellent at
one is overbuilt for the other.
We know the shape of that second case because it is ours. BuildBase bills its
own workflow runs at $0.25, $0.15 and $0.10 per 1,000 on Launch, Grow and
Scale, metered through the same module we sell - and the thing that made it
work was never ingestion throughput. It was that the meter already knew which
workspace the run belonged to and whether the caller's role was allowed to
start it. PlugNode, one of our own products, runs per-flow-run billing on
exactly that. Bolt a metering engine on from outside and you are answering
those two questions yourself, in glue code, for every product you ship.
### How to decide
Ask which thing breaks first.
Contracts with commits, and a finance team that needs revenue recognition?
Hand that to Metronome.
If it is "we need billing, and also login, and also workspaces, and also a way
to say who can see what," you are looking at four vendors, four integrations
and the wiring between them, which is the line item nobody puts on a pricing
page. We costed one version of that stack in [the real monthly cost of Clerk
plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost).
A note on sourcing. Metronome's two tiers, its rates and the line about being
part of Stripe were read on metronome.com on 5 November 2026. The commits,
drawdown and revenue recognition, and the legacy status of the plan-based API,
come from docs.metronome.com the same day, and the ingestion figure from its
ingest API reference. The acquisition date is Stripe's own newsroom post.
Our plan prices come from the shared constants this site builds from, verified
31 October 2026, and the live ones are always at [/pricing](/pricing).
---
## Stripe Billing vs BuildBase, and why it is not either-or
> Stripe Billing is the subscription engine on your Stripe account. BuildBase is the entitlement layer above it, on that same account. Here is what each one actually decides.
- Source: https://www.buildbase.app/compare/stripe-billing-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-11-05
### In short
Stripe Billing and BuildBase are not substitutes. BuildBase sells plans through Stripe Checkout on your own Stripe account, so Stripe charges for Billing either way. What differs is the layer above: Stripe Billing produces the invoice, BuildBase turns an active subscription into quotas and roles.
Most "X vs BuildBase" posts are about substitution. This one is not, and
pretending otherwise would cost you an afternoon.
BuildBase sells plans through Stripe Checkout on your own Stripe account. The
subscription it creates is a Stripe subscription, sitting in your Stripe
dashboard, raising Stripe invoices. So the question was never which of these
two charges your customer's card. Stripe does, either way. The question is what
sits above that charge and decides what the customer is now allowed to do.
### The one-paragraph answer
Pick Stripe Billing on its own if what you need is the invoice: recurring
plans, proration, tax, dunning and a customer portal you do not have to build.
Pick BuildBase if the invoice was never the hard part, and the work you keep
postponing is the code that turns "this subscription is active" into "this
workspace member may call this endpoint 40,000 more times this month." In
practice you run both, because BuildBase sells through Stripe either way.
### The fee is a constant, not a difference
Stripe charges 0.7% of billing volume for Billing, read from its own pricing
page on 4 November 2026. Its wording for what that covers is "Billing
transactions processed on and off Stripe," excluding one-off invoices. There is
a contracted alternative: $620 a month on a one-year contract for up to
$100,000 of monthly billing volume, then $1,500, $2,950 and $5,750 for the
$250,000, $500,000 and $1,000,000 tiers, with 0.67% above each cap. Card
processing sits outside all of that and does not change: 2.9% plus 30 cents for
domestic cards.
Now the part that decides this comparison. Because BuildBase's subscriptions
are Stripe subscriptions on your account, that percentage does not vanish when
you adopt BuildBase. Put it in both columns and move on.
TODO(dharmik): Stripe does not publish a per-integration-path breakdown of what
counts as Billing volume, so no public page settles whether a Checkout
subscription created through BuildBase is rated exactly like one created in the
Stripe dashboard. Confirm against a live account before anyone quotes a saving
here.
That is the opposite of what a comparison page is meant to say, which is why it
goes near the top instead of into a footnote. If you came looking for a way
around the 0.7%, the options that genuinely move that number are
merchant-of-record platforms and standalone metering engines, and they are
sorted by shape in [Stripe Billing
alternatives](/compare/stripe-billing-alternatives). We are not one of them.
### What each one actually decides
Stripe Billing decides what the customer owes. It models the plan, prorates a
mid-cycle change, applies tax, retries the failed card, and produces a document
a finance team can reconcile. That is a deep and unglamorous problem, and
Stripe has spent years on it.
BuildBase decides what the customer may do. A plan here carries entitlements:
features gated by plan, per-metric quotas, credits with a ledger behind them.
`bb.usage.record` meters a quota and checks it in the same call. The
subscription that defines that quota lives in the same instance as the
workspace it belongs to and the roles of the people inside it, which is the
agreement you would otherwise maintain by hand between three systems.
Does Stripe have entitlements? It has the primitives, and plenty of teams build
the layer themselves on subscription metadata. The real question is whether you
want to own that code, and how it behaves the week someone downgrades mid-cycle
while a seat is still active.
### The dogfood detail
Our own metering ends up back inside Stripe. PlugNode bills per flow run, and
on the paid plans workflow runs are a quota that bills over: $0.25 per 1,000 on
Launch, $0.15 on Grow, $0.10 on Scale. BuildBase counts those runs against the
workspace, then reports the overage into Stripe Billing Meters so the charge
lands on the same invoice as the plan.
If we thought Stripe Billing was the thing to replace, that is not how we would
have built it.
| Feature | BuildBase | Stripe Billing |
| --- | --- | --- |
| What it charges you for | A plan price that does not move with revenue | 0.7% of billing volume |
| Whose Stripe account | Yours | Yours |
| Invoices, tax and dunning | Stripe Tax and promotion codes at checkout | Its core product |
| Entitlements and quotas | Per-plan limits, credits ledger, quota checks | Build it on subscription metadata |
| Workspaces, roles and auth | Same instance, 20 modules | Not its job |
The price row is the one people read first. It is also the one most likely to
mislead, because a percentage and a plan price are not two quotes for the same
thing: they are two shapes of cost, and only one of them moves when you have a
good quarter.
### Our pricing, for the record
Ours comes out of the repo rather than off a web page. Free is $0, Launch is
$19 a month, Grow $49 and Scale $99, last checked against the production API on
31 October 2026. The paid plans open with a 7-day trial that does not ask for a
card. Free has no trial, because there is nothing to trial into. Live figures
are at [/pricing](/pricing).
Set that beside 0.7% and the shapes differ in a way worth noticing: a
percentage tracks your revenue, a plan price tracks your plan. [The crossover
math](/blog/billing-platform-revenue-tax) is worked properly elsewhere, with
one caveat for this page. That post compares a flat plan against a percentage
vendor you could drop. Stripe is not a vendor you drop.
> **Where Stripe Billing wins:** **Invoicing depth we do not match.** Proration edge cases, credit notes, the
> dunning retries Stripe tunes on its own data, and a customer portal that
> handles the awkward cases without you shipping a screen. If your finance team
> has opinions about reconciliation, those opinions are about Stripe Billing,
> and they are reasonable ones.
>
> **It meters a long way for free.** Basic usage-based billing through the Meters
> API includes up to 100 million events a month. That is past the point where
> most products know whether their pricing model works at all.
>
> **Nothing to migrate.** Turning Billing on is a setting inside an account you
> already have. Adopting a bundle is a larger decision and a harder one to
> reverse, and it should be judged that way.
>
> **At small volume the percentage is cheap.** 0.7% of a few hundred dollars a
> month is a rounding error against any flat plan, ours included. Percentage
> pricing is genuinely kind to a product that has not found its revenue yet.
### Where each one is the wrong call
Stripe Billing alone is the wrong call if you keep writing the same
`if (plan === 'pro')` branch in new places and nobody can say what a trial
user is allowed to do without reading three files. That is an entitlement
problem wearing a billing costume, and no invoicing feature fixes it. The
shape of the fix is in [what entitlements
are](/blog/what-are-entitlements).
BuildBase is the wrong call if billing is the only thing you still need and
your auth, workspaces and roles already work. Adopting a backend to get quotas
is a bad trade when the rest of it would be replacing things that are fine. The
bundle pays off while you are still choosing the pieces, which is the same
argument [the Stigg comparison](/compare/buildbase-vs-stigg) reaches from the
entitlements side.
### If you are starting from Stripe Billing today
Stripe stays. You connect the account BuildBase will sell on, then define your
plans, prices and trials in BuildBase, and those sync out to that account. The
genuinely new work is the mapping from a plan to what it entitles, which is
also the thing you are actually adopting, so it is worth doing slowly.
TODO(dharmik): the repo documents the sync in one direction, plans defined in
BuildBase pushed to Stripe, and nothing I can find describes what happens to
subscriptions already running on that account when it is connected. Write that
path down before this post advises anyone mid-flight.
[How BYO-Stripe works](/blog/bring-your-own-stripe) covers the account side.
[Charging per API call](/guides/charge-per-api-call-nextjs) is the smallest
end-to-end example of the metering side.
---
## Descope vs BuildBase: a flow builder for auth, or auth inside a backend
> Descope is an auth platform with a drag-and-drop flow builder, SSO and mobile SDKs. BuildBase is one SDK for auth, billing and workspaces. Prices, sign-in methods and where each one wins.
- Source: https://www.buildbase.app/compare/descope-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-11-03
### In short
Descope is auth built on a visual flow builder, with SSO and mobile SDKs, free to 7,500 MAU and $799 a month for 25,000. BuildBase is one SDK for auth, billing, workspaces and email, free to 10,000 users and $19 a month for 25,000. Descope wins on enterprise identity and mobile, BuildBase on price and scope.
Descope and BuildBase both let you add passkeys, magic links and a Google
button without writing the ceremony yourself. That is where the overlap ends.
Descope is an authentication platform, and it goes deep on identity. BuildBase
is a backend where authentication is one of 20 modules, and it goes wide.
### The one-paragraph answer
If you sell to enterprises that will ask for SAML SSO and SCIM, ship native
mobile apps, or want product people to edit the sign-in steps on a canvas,
Descope is the stronger tool and it is not close. If you are building a web
SaaS and need sign-in, workspaces, subscriptions and the emails around them to
agree with each other, BuildBase does that in one SDK, and at list price it
costs a fraction of Descope for the same user count.
### Where each fits
Descope's centre is **Flows**: sign-up, sign-in and step-up sequences built in a
drag-and-drop editor, connecting screens, conditions and third-party connectors,
then embedded in your app or served as a hosted page. Around it sit SSO, SCIM,
fine-grained authorization, an admin portal for your customers, and SDKs for
web, mobile and backend.
BuildBase's centre is the workspace. A user signs in, belongs to workspaces
with roles, and each workspace has a plan, quotas, credits and invoices. Auth is
the front door to that, configured in the console and rendered on a hosted
sign-in page in 8 languages. You do not design the screens on a canvas; you
tick the methods each app offers, and the page draws them.
### Sign-in methods, side by side
Both cover the methods most web apps want. The differences are in the paid tiers.
Descope's plans all include passkeys, email magic links, email codes,
authenticator apps, social login and SSO. Google One Tap and a custom OIDC provider start on Pro, and anonymous users on Growth. Text message and voice codes go through Descope for up to
100 deliveries a month, then through your own connector.
BuildBase's sign-in methods are email and password, magic links, email codes,
phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, one OpenID
Connect or OAuth 2.0 provider of your own, Ethereum and Solana wallets, and
enterprise SSO (Enterprise plan, through your own WorkOS account).
Phone sign-in uses SMS sign-in codes through your own provider, Twilio or a
signed webhook. Around those methods sit Google One Tap, usernames, guest users
and device code sign-in for CLIs and TVs. Two-step sign-in is an authenticator
app, single-use backup codes or text-message codes, under a policy of off,
optional or required, and an authenticator app or a passkey is the stronger
choice. Which plan includes which method is on [the pricing page](/pricing).
The SMS line deserves a second look, because both products push you to your
own provider. Descope's 100 a month is a trial allowance: past it, phone
sign-in stops until a connector is set up. BuildBase starts there, with no
allowance at all, so the Twilio account is part of setup rather than a surprise
in month two. Twilio's own price per code, on its [Verify pricing page](https://www.twilio.com/en-us/verify/pricing), is the same either way.
### Pricing, verified 17 October 2026
Descope publishes four plans. **Free** is $0 for 7,500 MAU with no overages, so
you upgrade to grow past it. **Pro** starts at $249 a month for 10,000 MAU and
**Growth** at $799 a month for 25,000, both billed annually, with each extra
MAU at $0.05. **Enterprise** is custom.
BuildBase has four published plans: **Free** at $0 with 10,000 monthly active
users, **Launch** at $19 a month with 25,000, **Grow** at $49 with 100,000, and
**Scale** at $99 with 500,000. Free has no trial and stops at its allowance; the
paid plans start with a 7-day trial that does not ask for a card.
Put both on the same user counts, at list price:
| Monthly active users | Descope | BuildBase |
| -------------------- | ---------------------------- | ------------ |
| 7,500 | $0 (Free) | $0 (Free) |
| 25,000 | $799 (Growth) | $19 (Launch) |
| 50,000 | $2,049 (Growth plus overage) | $49 (Grow) |
| 100,000 | $4,549 (Growth plus overage) | $49 (Grow) |
The overage rows are $799 plus $0.05 for each MAU above 25,000: $1,250 more at
50,000 and $3,750 more at 100,000. From 25,000 up, Descope's Pro plan would cost more than Growth.
Two caveats keep this honest. Descope's price buys SSO connections, the flow
builder and compliance paperwork that ours does not. And at 7,500 users both
are free, but only Descope's free plan includes SSO connections.
| Feature | BuildBase | Descope |
| --- | --- | --- |
| Free plan | 10,000 MAU on Free; paid plans start with a 7-day trial without a card | 7,500 MAU, no overages |
| At 25,000 MAU | $19/mo (Launch) | $799/mo (Growth, billed annually) |
| Passkeys, magic links, email codes | Built in; plans on the pricing page | Included on every plan |
| Authenticator app second step | Two-step sign-in with backup codes, or text-message codes | Included on every plan |
| SMS and voice codes | Through your own Twilio or webhook only | 100 a month through Descope, then your own connector |
| SAML / OIDC enterprise SSO | Enterprise plan only, through your own WorkOS account | 3 to 10 connections by plan, more as an add-on |
| Designing the sign-in steps | Tick methods per app; hosted page in 8 languages | Drag-and-drop Flow Builder |
| Client SDKs | Next.js, Vite, React Router / Remix, TanStack Start | Web, Swift, Kotlin, Flutter and more |
| Billing, workspaces, email, workflows | Included, 20 modules in one instance | Not part of the product |
> **Where Descope wins:** Descope does several things better, and if any of them is on your list, it
> should win.
>
> **Enterprise identity.** Descope includes SAML and OIDC SSO connections even on its free plan, adds a self-service SSO setup for your customers' IT admins from Pro, and SCIM provisioning from Growth. Adaptive MFA and step-up authentication are on every plan. Our
> SAML and OIDC SSO is on the Enterprise plan only, through your own WorkOS
> account. If an enterprise buyer's security review includes SSO and a custom
> plan is not on the table, this comparison is over.
>
> **Mobile.** Descope has SDKs for Swift, Kotlin, React Native and Flutter, plus
> Vue.js, Angular and SvelteKit on the web. Our SDK is for React-based web apps
> and JavaScript backends. If your product is a phone app, Descope covers ground
> we do not.
>
> **Editing the flow without a deploy.** Flows let someone change the sign-up
> steps, add a condition or plug in a connector from a canvas. Our hosted page is
> configurable, not programmable: you choose the methods, the branding and the
> words, not the order of the screens.
>
> **Compliance paperwork.** Descope's Pro and Growth plans include SOC 2 reports,
> and Growth offers a HIPAA BAA. A customer whose procurement checklist asks for
> either gets an answer from Descope today.
>
> **A free plan with SSO.** 7,500 MAU and up to three SSO connections for
> nothing. Our Free plan covers more users, 10,000, but SSO is on our Enterprise
> plan only.
### How to decide
Write down who signs in to your product a year from now. If the answer
includes enterprise employees through their company's identity provider, or
people on a native phone app, start with Descope and price the billing and
workspace pieces separately.
If the answer is people and teams on a web app who will subscribe, invite
colleagues and hit quotas, the auth decision is the small half of the problem.
That is the case BuildBase is built for, and the reason the price above covers
far more than sign-in. The [Clerk comparison](/compare/clerk-vs-buildbase) and
the [WorkOS comparison](/compare/workos-vs-buildbase) make the same trade from
other angles, [Frontegg](/compare/frontegg-vs-buildbase) is the other vendor
that puts SSO connections on its free plan, and
[best auth for B2B SaaS](/compare/best-auth-for-b2b-saas) sorts the field by
whether you need SSO yet.
### Sources
Descope figures verified 17 October 2026 on Descope's own pages:
[descope.com/pricing](https://www.descope.com/pricing) (plans, MAU allowances,
the $0.05 overage, SSO connections per plan, 100 SMS or voice deliveries a month
through Descope, SOC 2 reports and HIPAA BAA by plan, Google One Tap and custom
OIDC provider from Pro),
[Descope getting started](https://docs.descope.com/getting-started) (supported
SDKs) and [Descope Flows](https://docs.descope.com/flows) (the drag-and-drop
Flow Builder). BuildBase plans are our published pricing, last checked against
the production plans on 31 October 2026 (PLAN_FACTS).
---
## Frontegg vs BuildBase: SSO on the free plan, or 20 modules on one bill
> Frontegg puts enterprise SSO on its free plan and charges $0.10 per MAU above 7,500. BuildBase is one SDK for auth, billing and workspaces. Verified prices, and where each one wins.
- Source: https://www.buildbase.app/compare/frontegg-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-11-03
### In short
Frontegg is CIAM with enterprise SSO and SCIM on its free plan, and a calculator charging $0.10 per monthly active user above 7,500 that stops quoting at $2,500 a month. BuildBase is one SDK for auth, billing, workspaces and email, free to 10,000 users and $19 at 25,000. Frontegg wins on identity depth.
Frontegg's pricing page has a slider. Drag it far enough and the price
disappears: past 32,500 monthly active users the number is replaced by "Talk
to Us". The same thing happens at 25 enterprise connections, and at 2,500
machine-to-machine tokens. All three stop at the same place, $2,500 a month,
which tells you where the self-serve product ends and the sales call begins.
That ceiling is the most useful thing on the page, and it frames the whole
comparison.
### The one-paragraph answer
If your next three customers will ask for SAML before they sign, and you want
that working this week without a plan upgrade or a WorkOS account of your own,
Frontegg is the better pick and the free plan makes it easy to prove. If what
you actually need is sign-in plus subscriptions plus workspaces plus the emails
that go with them, all agreeing with each other on one bill, that is the case
BuildBase is built for, and at 25,000 users the list prices are $1,750 and $19.
### Where each fits
Frontegg is CIAM, and it goes deep. Enterprise SSO and SCIM, an embedded
self-service admin portal your customers run themselves, ReBAC, hierarchical
tenants, and an identity protection set that covers bot detection, impossible
travel, new-device and suspicious-IP detection, stale users and
accounts-at-risk analytics. Much of it ships as in-app components you drop into
your product rather than screens you build.
BuildBase's centre is the workspace. Someone signs in, belongs to workspaces
with roles, and each workspace carries a plan, quotas, credits and invoices.
Auth is the front door to that and one of 20 modules in a single instance. You
do not get a tenant security centre component. You do get the billing that
Frontegg leaves to you.
### What Frontegg's calculator charges, verified 3 November 2026
Frontegg publishes two plans. **Pay as you go** is $0 a month, and its
always-included list is 7,500 monthly active users, 5 enterprise connections
for SSO or SCIM, unlimited organizations, a custom domain and a fully
customised hosted login. **Enterprise** is custom, and adds multiple
environments, advanced fraud protection, a 99.99% uptime SLA and premium
support.
Everything above the free allowance is metered, and the calculator is linear:
| What you move | Free allowance | Rate above it |
| ---------------------- | -------------- | --------------- |
| Monthly active users | 7,500 | $0.10 each |
| Enterprise connections | 5 | $125 each |
| M2M tokens | none | $1 each monthly |
The rates hold exactly until the total reaches $2,500 a month. At 10,000 users
the calculator reads $250, at 25,000 it reads $1,750, at 32,500 it reads
$2,500, and at 33,000 it stops quoting. Enterprise connections do the same
thing at 25, and M2M tokens at 2,500.
So "pay as you go" is true over a defined range, and that range is narrower
than the sliders suggest. Worth knowing before you plan around it.
### Our pricing beside it
BuildBase publishes four plans. **Free** is $0 with 10,000 monthly active
users. **Launch** is $19 a month with 25,000, **Grow** $49 with 100,000, and
**Scale** $99 with 500,000. Free has no trial and stops at its allowance; the
paid plans open with a 7-day trial that does not ask for a card.
Put both on the same user counts, at list price, with no extra Frontegg
connections or M2M tokens beyond the free allowance:
| Monthly active users | Frontegg | BuildBase |
| -------------------- | ---------- | ------------ |
| 7,500 | $0 | $0 (Free) |
| 10,000 | $250 | $0 (Free) |
| 25,000 | $1,750 | $19 (Launch) |
| 32,500 | $2,500 | $19 (Launch) |
| 50,000 | Talk to Us | $49 (Grow) |
Two things keep that table honest. Frontegg's column buys five SSO connections
and an identity product ours does not match, and our Free plan covers 10,000
users but carries no SSO at all. The gap is real, and so is what it pays for.
> **Key takeaway:** Frontegg charges for identity and hands you the free SSO early. BuildBase
> charges for a backend and puts SSO late. Which is cheaper depends entirely on
> whether the SSO arrives before the revenue does.
### Sign-in methods
Both cover what a web app needs. Frontegg's authentication list runs to
password, passwordless, social logins, enterprise SSO, passkeys, MFA, bot
detection, email verification, signup flows, session management and user
impersonation, with a login builder for the box itself.
BuildBase ships email and password, magic links, email codes, phone codes,
passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, one OpenID Connect or
OAuth 2.0 provider of your own, Ethereum and Solana wallets, and enterprise SSO
on the Enterprise plan, through your own WorkOS account. Phone sign-in is SMS
sign-in codes through your own provider, Twilio or a signed webhook. Around
those sit Google One Tap, usernames, guest users and device code sign-in for
CLIs and TVs. Two-step sign-in is an authenticator app, single-use backup codes
or text-message codes, under one policy of off, optional or required, and an
authenticator app or a passkey is the stronger choice.
Separately, every BuildBase app is an OAuth 2.0 authorization server, which is
how agents and third-party apps get access. Frontegg has been building toward
the same reader from the other direction, with M2M tokens, token restriction
policies and an MCP server for coding assistants.
| Feature | BuildBase | Frontegg |
| --- | --- | --- |
| Free plan | 10,000 MAU on Free; paid plans open with a 7-day trial without a card | 7,500 MAU and 5 enterprise connections, $0 |
| At 25,000 MAU | $19/mo (Launch) | $1,750/mo (Pay as you go) |
| Where the published price stops | Scale at $99/mo covers 500,000 MAU | $2,500/mo, then Talk to Us |
| SAML / OIDC enterprise SSO | Enterprise plan only, through your own WorkOS account | 5 connections on the free plan, $125 each after |
| Directory Sync (SCIM) | Enterprise plan, through your own WorkOS account | Shares the enterprise connection allowance |
| Identity protection | Brute-force protection and a breached-password check | Impossible travel, new device, suspicious IP, bot detection |
| Authorization model | Roles and permissions per workspace | Custom roles, permissions, ReBAC, tenant hierarchies |
| Client SDKs | Next.js, Vite, React Router / Remix, TanStack Start | React, Next.js, Angular, Vue, Swift, Kotlin, Flutter |
| Backend SDKs | JavaScript and TypeScript, on Node.js, Bun, Deno, Workers | Node.js, Go, Python FastAPI and Flask, Java |
| Billing, workspaces, email, workflows | Included, 20 modules in one instance | Not part of the product |
> **Where Frontegg wins:** Frontegg beats us in several places, and if one of them is on your list it
> should win.
>
> **Enterprise SSO on the free plan.** Five SAML or OIDC connections, at $0,
> before you have a customer. Ours is on the Enterprise plan, through your own
> WorkOS account, which means a conversation and a WorkOS bill of your own. For a
> seed-stage B2B company whose first logo wants SSO, that difference decides it.
>
> **Identity protection.** Impossible travel detection, new-device detection,
> suspicious IP detection, accounts-at-risk analytics and a tenant security
> centre your customers can open themselves. We have brute-force protection and a
> check against breached passwords. That is not the same product.
>
> **Mobile and framework reach.** Frontegg publishes SDKs for iOS Swift, Android
> Kotlin, React Native, Flutter and Ionic Capacitor, and on the web covers
> Angular, Vue.js and Vanilla.js. Our frontend SDK is React, which is four
> frameworks and no phone app.
>
> **Backend languages.** Go, Python and Java, against our JavaScript and
> TypeScript. If your API is written in Go, Frontegg has a first-party SDK for it
> and we do not.
>
> **Authorization depth.** ReBAC and hierarchical tenant structures, for products
> where a parent organization needs graded access to its children. Our roles and
> permissions are per workspace, which is simpler and sometimes too simple.
>
> **Compliance paperwork.** Frontegg's Enterprise plan carries a 99.99% uptime
> SLA, a support SLA, custom legal agreements and a HIPAA BAA. A procurement
> checklist asking for any of those gets an answer from Frontegg today.
### How to decide
Ask when SSO arrives relative to revenue. If an enterprise buyer is in the next
two quarters and you have no WorkOS account, Frontegg's free five connections
are worth more than the price gap, and you should price the billing and
workspace work separately because you will still be writing it.
If instead your users are teams on a web app who subscribe, invite colleagues
and hit quotas, sign-in is the small half of the problem. The
[WorkOS comparison](/compare/workos-vs-buildbase) makes this trade from the
identity side, [best auth for B2B SaaS](/compare/best-auth-for-b2b-saas) sorts
the field by whether you need SSO yet, and
[the real monthly cost of Clerk plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost)
prices the pieces Frontegg leaves out. If isolation is what worries you,
[best multi-tenant backend](/compare/best-multi-tenant-backend) covers who
maintains that policy.
### Sources
Frontegg figures verified 3 November 2026 on Frontegg's own pages:
[frontegg.com/pricing](https://frontegg.com/pricing) for the two plans, the
always-included allowances, the $0.10 per monthly active user, $125 per
enterprise connection and $1 per M2M token rates read off the calculator, the
$2,500 point where it stops quoting, the feature comparison table and the
Enterprise 99.99% uptime SLA and HIPAA BAA, and
[the Frontegg SDK overview](https://developers.frontegg.com/ciam/sdks/overview)
for the frontend, mobile and backend SDK lists and the MCP server. BuildBase
plans are our published pricing, last checked against the production plans on
31 October 2026 (PLAN_FACTS).
---
## FusionAuth vs BuildBase: free to self-host, under a licence worth reading
> FusionAuth Community is free to self-host and publishes no user cap, but it is not open source. What the licence actually restricts, what the paid tiers publish, and what you still build after login.
- Source: https://www.buildbase.app/compare/fusionauth-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-11-01
### In short
FusionAuth Community is free to self-host with no published user cap, but it ships under the FusionAuth Customer License Agreement, a proprietary agreement. Paid tiers start at $162 a month. BuildBase is not an identity product: it is 20 modules on one instance, with a Free plan and paid plans from $19 a month.
Nearly every directory listing I opened while writing this says FusionAuth
Community is free and open source.
The first half is true. The second half is not, and FusionAuth does not claim it
either: its own licence FAQ says the company has chosen a closed source model
for the core product. The free edition is real, it is genuinely free, and it is
governed by a proprietary agreement that you accept by downloading the software.
Those three things fit together fine. They just do not fit the sentence everyone
keeps repeating.
That matters less than it sounds. A FusionAuth evaluation gets stuck on the
licence; the expensive question is the one nobody asks.
### Which one should you pick
Pick FusionAuth if identity is the whole job and you want to run it yourself.
It is a complete identity server, it costs nothing to self-host, your backend
can be in any language it publishes a client library for, and it will still run
on your hardware the day the vendor stops returning calls. Pick BuildBase if the
login box is the small half of the problem and the real work is workspaces,
roles, plans, quotas, invoices and the mail that goes with them. These two
products overlap at the sign-in form and almost nowhere after it.
### What you are choosing between
FusionAuth is an identity server you deploy. Users, tenants, applications,
groups, tokens, the OAuth 2.0 and OIDC flows around them, plus lambdas for
custom logic and connectors for pulling identities from somewhere else. You run
the binary and you own the database. It is single-purpose software, deep rather
than wide.
BuildBase starts from the workspace instead of the session. Someone signs in,
belongs to workspaces with roles, and each workspace carries a plan, quotas,
credits and invoices. Authentication is one of 20 modules on a single instance.
PlugNode, one of six products of ours that run on it, uses auth, team workspaces
with role-based access control, Stripe billing and usage-based credit metering
out of the same records, which is the part that would otherwise be a mapping
table somebody maintains forever.
Different question, really. FusionAuth asks how identity should work and hands
you most of the controls. We assume it is settled and start at what the account
does next.
### What FusionAuth costs, verified 1 November 2026
Four plans, and the pricing page publishes less than you would expect.
**Community** is free and self-hosted: "Self-host FusionAuth on your own
infrastructure for free," with no user cap stated on the page. **Starter**
starts at $162 a month, billed annually, and includes basic hosting.
**Essentials** and **Enterprise** both read "Starting at $2,970/mo", billed
annually, the first with business hosting and the second with high availability
hosting. I read those cards twice on 1 November 2026 and they carried the same
figure both times, at the page's default selector position of 1,000 monthly
active users.
Treat that $2,970 collision as a reason to call sales rather than a price. The
page sets a monthly active user selector and then publishes no per-MAU rate, no
included-MAU allowance per tier, and no explanation of how moving the selector
changes any of the four cards. Every number carries "Starting at". So the honest
summary is that FusionAuth publishes a floor and a billing unit, and the rest of
the quote is a conversation.
The billing unit is documented far better than the price is. An active user is
anyone who logs in during the period, counted once however often they return.
Non-production instances are exempt. That covers development, UAT, testing and
CI, and instance count does not change the licence cost either, so three nodes
running for availability is still one licence.
Our side is our own published pricing, last checked against the live page on
31 October 2026. Free is $0 with 10,000 monthly active users, 50 workspaces,
1 GB of storage and 2 team seats, and it stops at its allowance rather than
billing over. Launch is $19 a month with 25,000 monthly active users, 1,000
workspaces, 10 GB of storage and 3 team seats. Grow is $49 with 100,000 and
Scale is $99 with 500,000. The paid plans start with a 7-day trial that does
not ask for a card, and yearly billing is ten months for twelve. Three quotas
bill past their allowance on the paid plans: workflow runs at $0.25, $0.15 or
$0.10 per 1,000 runs on Launch, Grow and Scale, web analytics events at $2 per
100,000 events, and storage at $0.10 per GB-month. We publish no uptime figure:
targets vary by plan.
> **Key takeaway:** You cannot build an honest side-by-side dollar table from these two pricing
> pages, and you should distrust one that tries. FusionAuth's published figures
> are floors with no scaling curve attached. Ours are complete prices for a
> different product. The comparison that decides it is not price per user.
### The licence, since nobody quotes it
The agreement at fusionauth.io/license is the FusionAuth Customer License
Agreement, version 2, dated 4 May 2026, and section 2.3 is explicit about how
the free tier enters it: free-tier licensees are bound by downloading the
free-tier software. There is no separate permissive licence underneath.
Section 3 is the part worth reading before you commit. No disassembling,
reverse engineering, modifying or making derivative works, at 3(d). No
distributing, renting, leasing, sublicensing, assigning, transmitting or selling
it onward, at 3(f), and no running it on a service bureau or time sharing basis,
at 3(e). Then 3(g): you may not use the software to create or develop a
competing product or service. Ownership stays put, by section 5.1. Some bundled
third-party components carry their own open source notices, and section 14.1
says those are governed separately.
One more clause is easy to miss. Section 2.3 applies section 2.1 to free-tier
licensees except 2.1.3, which is the software warranty. So the free tier runs
under the section 7 disclaimer: the offerings are provided "AS IS", with no
representations or warranties of any kind.
None of that makes FusionAuth a bad choice. Paid features over a free core is an
ordinary arrangement, and the free tier here is more generous than most. But
"free and open source" and "free under a proprietary agreement with a
no-compete clause and no warranty" are different propositions, and only one of
them is what you are actually agreeing to. If your reason for self-hosting is
that you want terms nobody can revoke, this is the paragraph that decides it,
and [the difference between self-hosted and open
source](/blog/self-hosted-vs-open-source) is worth settling before you pick
either product. [Ory](/compare/ory-vs-buildbase) is the contrast that makes it
legible: its core really is Apache-2.0, and that is a different kind of promise
from a free tier under a customer agreement.
Ours is a smaller promise and not a competing one. There is no free self-hosted
tier: self-hosting is arranged by talking to us, priced per installation, and
that price is not on sale, so there is no figure to give you. Once it is set
up, you create the installation in the dashboard, deploy the compose file, and
the installation checks in. FusionAuth's floor is download and run. Ours is a
conversation first, then an installation that phones home.
### What the free edition actually includes
More than you would guess, and the docs state the rule plainly: Community has
all features not otherwise labeled in the documentation. The question is only
which features carry a label.
Starter adds SAML v2 IdP-initiated login, advanced multi-factor methods and
connectors. Enterprise adds SCIM, threat detection, the tenant manager, the MFA
lambda and application MFA policies; the SCIM API docs carry an "Enterprise plan
required" notice on the page itself.
Read that list the right way round. General SAML v2 support is not labelled,
which puts it in the free tier, and only IdP-initiated login moves to Starter.
A FusionAuth install you pay nothing for can terminate SAML single sign-on for a
customer. That is worth saying plainly, because it is the single biggest thing
FusionAuth gives away that we charge for, and I come back to it below.
### Sign-in methods and SSO
These are not the same kind of list. BuildBase ships a fixed set you switch on:
email and password, magic links, email codes, phone codes, passkeys, Google,
LinkedIn, GitHub, Microsoft, Apple, one OpenID Connect or OAuth 2.0 provider of
your own, Ethereum and Solana wallets, and Enterprise SSO. Around those sit
guest users, usernames, device code sign-in and Google One Tap, which are ways
of using the methods rather than methods themselves. Separately, every app is an OAuth 2.0 authorization server,
which is how agents and third-party apps get access.
FusionAuth gives you the protocols and the configuration surface and lets you
assemble the list, which is the more flexible answer and the more work.
Enterprise SSO is where the two diverge commercially. BuildBase sells SAML and
OIDC sign-in and Directory Sync (SCIM) on the Enterprise plan, through your own
WorkOS account: a customer's IT admin connects their provider from a setup link,
verified domains send each person to their company sign-in, single sign-on can
be required per company, and directory groups map to roles. FusionAuth puts SCIM
on Enterprise too. But its SAML sits in the free tier, so if the only enterprise
question on your roadmap is "can you do SAML", FusionAuth answers it for nothing
and we do not. [Best auth for B2B SaaS](/compare/best-auth-for-b2b-saas) sorts
the wider field by whether you need that this quarter, and the [WorkOS
comparison](/compare/workos-vs-buildbase) covers what our arrangement costs.
| Feature | BuildBase | FusionAuth |
| --- | --- | --- |
| Licence | Proprietary SDK and platform | FusionAuth Customer License Agreement; free tier bound on download |
| Free tier | Free plan; paid plans start with a 7-day trial, no card | Community, self-hosted, no user cap published |
| What gets metered | Monthly active users, 10,000 on Free and 25,000 on Launch | Monthly active users; non-production instances excluded |
| Published entry price | Free; paid plans from $19/mo | Free self-hosted; Starter from $162/mo, billed annually |
| Price transparency | Full price list for every plan | Floors only; no per-MAU rate or allowance published |
| Languages | TypeScript and JavaScript | Seven client libraries, plus Android and iOS SDKs |
| SAML single sign-on | Enterprise plan, through your own WorkOS account | In the free tier; IdP-initiated login from Starter |
| Directory sync (SCIM) | Enterprise plan, through your own WorkOS account | Enterprise plan |
| Billing, email, workflows | Included, 20 modules on one instance | Not part of the product |
| Air-gapped deployment | Not offered | Air-gapped licence, by arrangement with sales |
> **Where FusionAuth wins:** **Your backend does not have to be JavaScript.** FusionAuth publishes client
> libraries for Go, Java, .NET Core, PHP, Python, Ruby and TypeScript, front-end
> SDKs for Angular, React and Vue, a Kotlin SDK for Android and a Swift SDK for
> iOS, plus an OpenAPI spec for anything else. Our SDK is TypeScript, and we do
> not support Vue, Svelte, React Native or native mobile at all. If your API is
> Django or Go, or your product is a native app, FusionAuth is adoptable and we
> are not. That single fact ends this comparison more often than anything else on
> this page.
>
> **SAML for nothing.** General SAML v2 is unlabelled in FusionAuth's docs, which
> puts it in the free self-hosted edition. Our Enterprise SSO is on the Enterprise
> plan, through your own WorkOS account. When a buyer's security review asks the
> SAML question, FusionAuth can answer it on a free install and we send you to a
> sales conversation. That is a real gap and no module count closes it.
>
> **Free at any user count, with no licence fee.** Community publishes no MAU cap.
> You can run it for ten users or a hundred thousand without a licence fee, and
> the only bill is infrastructure and the hours to operate it. Ours is free up to
> 10,000 monthly active users, and past that a paid plan from $19 a month. [The
> real cost of self-hosting against a managed
> service](/blog/self-host-vs-managed-cost) prices the hours either way, but free
> is free.
>
> **It runs where you need it to.** FusionAuth sells an air-gapped licence for
> networks with limited or no connectivity. We have nothing equivalent, and a
> self-hosted installation of ours checks in with our dashboard. For defence, health or
> regulated deployments that is not a preference, it is the requirement.
>
> **Depth in identity we do not match.** Lambdas for custom token and
> registration logic, connectors from Starter for federating against an existing identity
> store, a tenant manager, and threat detection on the Enterprise tier. We ship a
> fixed set of sign-in methods you switch on. If your problem really is identity
> rather than the account built around it, theirs is the deeper toolkit and it is
> not close.
### How to decide
Two questions end this outright.
Is your backend JavaScript, and is your front end web? If not, stop here:
FusionAuth is the only one of the two you can adopt. Does a contract require you
to run identity on your own hardware, air-gapped or otherwise? FusionAuth again.
Read section 3 first, especially 3(g).
If neither lands, the question is what you are actually buying. FusionAuth will
hold your users, run your flows, federate your OAuth clients and terminate SAML,
and it will not invoice anyone, enforce a quota, meter a credit, send a campaign
or run a workflow, because it was never meant to. Those stay yours. [The cost of
building auth yourself](/blog/cost-of-building-auth-yourself) does the
arithmetic for the half FusionAuth does cover, and the half it does not is
usually larger: plans, subscription state, entitlements, usage counters,
invoices, dunning and the mail around all of it. [Auth0
alternatives](/compare/auth0-alternatives) works through the same trap from the
other direction.
So do not let the licence argument eat the evaluation. It is worth twenty
minutes, and the answer is clear once you read section 3. Then go price the
second system, the one that turns a signed-in user into a paying customer,
because that is where the real number is. If the workspace that signs in is also
the record that gets billed, a bundle removes a mapping you would otherwise own
for the life of the product. That cuts both ways: fewer vendors to keep in step,
less freedom to swap one piece out. [What RBAC actually
is](/blog/what-is-rbac) covers the roles half if that is the piece you are
weighing, and
[SuperTokens](/compare/supertokens-vs-buildbase) is the closest sibling
comparison if free self-hosting with paid add-ons is the shape you are shopping
for.
### Sources
FusionAuth figures verified 1 November 2026 against FusionAuth's own pages.
[fusionauth.io/pricing](https://fusionauth.io/pricing) for the four plans, the
free self-hosted Community edition, the $162 Starter floor, the $2,970 shown for
Essentials and Enterprise at the default 1,000 MAU selector position, and the
hosting and support lines.
[fusionauth.io/license](https://fusionauth.io/license) for the FusionAuth
Customer License Agreement version 2 of 4 May 2026, section 2.3 on free-tier
acceptance and the 2.1.3 warranty exclusion, sections 3(d) to 3(g), the section
7 "AS IS" disclaimer, section 5.1 and section 14.1.
[fusionauth.io/license-faq](https://fusionauth.io/license-faq) for the closed
source model, the paid self-hosted licences, and the statement that you
typically do not pay to run Community behind your own web or mobile
application.
[fusionauth.io/docs/get-started/core-concepts/licensing](https://fusionauth.io/docs/get-started/core-concepts/licensing)
for the MAU definition, the exclusion of logins against non-production
instances, the four plan names, the note that instance count does not change
what a licence costs, and the air-gapped licence.
[fusionauth.io/docs/v1/tech/premium-features/](https://fusionauth.io/docs/v1/tech/premium-features/)
for the tier labels and the rule that Community holds everything unlabelled.
[fusionauth.io/docs/apis/scim/](https://fusionauth.io/docs/apis/scim/) carries
the Enterprise requirement on SCIM.
[fusionauth.io/docs/sdks/](https://fusionauth.io/docs/sdks/) lists the client
libraries and SDKs.
BuildBase plans, modules and sign-in methods come from our own constants, last
checked against the live pricing page on 31 October 2026 (PLAN_FACTS).
---
## Ory vs BuildBase: priced per daily user, assembled per service
> Ory bills per average daily active user and ships as four services you run yourself. What that converts to, where Ory wins outright, and when BuildBase is the wrong shape for the job.
- Source: https://www.buildbase.app/compare/ory-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-10-31
### In short
Ory is an Apache-2.0 identity stack - Kratos, Hydra, Keto, Oathkeeper - you run yourself, or Ory Network at $770 a year with $21 of monthly credit at $0.14 per average daily active user. BuildBase is 20 modules on one instance, free for 10,000 monthly active users and $19 on Launch for 25,000.
Ory does not sell you a monthly active user.
That reads like a quibble until you try to budget. Ory Network meters average
daily active users, the average daily count of unique people who call the
Identities APIs, and every auth comparison you have read is written in MAU,
including the ones on this site. So the first job with an Ory quote is working
out what it says in the unit you actually hold. Nobody does that conversion for
you, and no pricing page can do it honestly: it depends on how often your users
come back.
### Which one should you pick
Pick Ory if your backend is not JavaScript, if you need to be an OAuth 2.0
provider that other people's software federates to, or if running the thing
yourself under a permissive licence outranks every other requirement. Pick
BuildBase if the login box is the small half of the problem and the real work is
workspaces, roles, plans, quotas and the mail that goes with them. Past the
sign-in form these two barely overlap, which both pricing pages make harder to
see than it should be.
### What you are choosing between
Ory is a set of services, not a product you install. Kratos holds identities and
runs the self-service flows around them: login, registration, verification,
recovery and profile, against an identity schema you define yourself.
Hydra is the OAuth 2.0 and OpenID Connect provider. Keto does permissions as
Zanzibar-style relationship tuples, sold on the Network as Ory Permissions.
Oathkeeper sits in front of your APIs as an identity-aware proxy, and Polis
bridges SAML into OAuth 2.0 and OIDC and speaks SCIM 2.0. You take the ones you
need and you operate them.
BuildBase starts from the workspace instead of the session. Someone signs in,
belongs to workspaces with roles, and each workspace carries a plan, quotas,
credits and invoices. Authentication is one of 20 modules on a single instance.
PlugNode, one of six products of ours that run on it, uses auth, team workspaces
with role-based access control, Stripe billing and usage-based credit metering
out of the same records.
So Ory asks how identity should work and hands you a lot of rope. BuildBase
assumes identity is settled and asks what the account does afterwards.
### What Ory Network costs, verified 31 October 2026
Four tiers, two published prices.
**Developer** is free: no usage metering, one member, two development
environments, and no production or staging environment at all, which makes it a
tier for building rather than shipping. **Production** is $770 a year and carries
$21.00 of included monthly usage credit, one production environment, three
staging, five development and one custom domain. **Growth** is $9,350 a year
with $255.00 of monthly credit, two production environments, five staging,
twenty development and up to three organizations. **Enterprise** is contact-only.
Three things are metered, and none of them is a monthly active user:
- Average daily active users: $0.14 on Production, $0.12 on Growth
- Machine-to-machine tokens from the client credentials flow: $0.007 and $0.006
per token per month
- Permission checks against the Permissions API: $0.000090 and $0.000085 per
check per month
Now do the arithmetic the page leaves to you. That $21.00 of credit at $0.14
covers 150 average daily active users before a usage charge appears, and $770 a
year is about $64 a month. On Growth, $255.00 at $0.12 is roughly 2,125. Whether
150 daily actives is a lot depends entirely on your product.
What happens past the credit is the part the page does not say. It publishes the
rates and it publishes the credit; it does not state how usage above the credit
is billed. Monthly-billed figures for Production and Growth are not shown
either. Plan with the annual numbers and treat them as a floor.
Read the tier table before the price, though, because the gating is where this
gets decided. One-click SAML, SCIM directory sync, multi-tenant production
environments and multi-brand projects are Enterprise only. B2B SSO on Growth is
OIDC and not SAML. B2B organizations start on Growth and stop at three. Every
Ory tier, the free one included, carries MFA with hardware keys, the
fine-grained Permission API, and OAuth 2.0 client credentials, authorization
code, token rotation and the OIDC provider. Ory also publishes a 99.99% SLA on its
Enterprise tier.
Our side is our own published pricing, last checked against the production
plans on 31 October 2026. Free is $0 with 10,000 monthly active users, 50
workspaces, 1 GB of storage and 2 team seats, and it stops at its allowance.
Launch is $19 a month with 25,000 monthly active users, 1,000 workspaces, 10 GB
of storage and 3 team seats. Grow is $49 with 100,000 and Scale is $99 with
500,000. The paid plans start with a 7-day trial that does not ask for a card.
Yearly billing is ten months for twelve. On the paid plans three things bill
over their allowance: workflow runs at $0.25, $0.15 or $0.10 per 1,000, web
analytics events at $2 per 100,000, and storage at $0.10 per GB-month. On uptime we publish
no number: targets vary by plan, which is less than Ory offers its Enterprise
customers.
> **Key takeaway:** There is no table in this post putting those two columns side by side in
> dollars, and you should distrust any post that builds one. A monthly active user
> and an average daily active user count different things. The ratio between them
> is a property of your product, and only you can measure it.
### What self-hosting Ory gives you, and what it does not
The binaries are free and unmetered. Kratos, Hydra, Keto, Oathkeeper and Polis
are Apache-2.0 on Ory's own open source page and on GitHub, and no licence fee
attaches to running them at any user count. That is real, and no pricing change
next year takes it back.
Then read the Kratos README. It describes an Ory Enterprise License, a paid
self-hosted edition adding features the free build does not have, SCIM and SAML
named among them, plus CVE patches under an SLA, advanced scaling and
multi-tenancy, premium support and a private Docker registry. Ory's open source
page positions the free build for evaluation and prototyping, and marks it as
lacking CVE security patching and production Helm charts.
Ory's own pages pull in two directions here. Polis ships SAML and SCIM 2.0
under Apache-2.0, the same two the Kratos README puts behind the Enterprise
License. Both are Ory properties. The Enterprise License carries no published
price, so there is no figure to quote. Which of those two shapes Ory is depends
on the build you run, and [the difference between self-hosted and open
source](/blog/self-hosted-vs-open-source) is worth settling before you commit
to either. Paid add-ons over a free self-hosted core are a common arrangement,
and [SuperTokens prices the same one in
public](/compare/supertokens-vs-buildbase): multi-factor sign-in, account
linking and multi-tenancy are paid there on self-hosted installs too, and two of
the three carry a monthly minimum whatever your user count. Read the figures off
their pricing page rather than off this one, because they were last checked for
that post and not for this one.
Ours is a smaller promise. There is no free self-hosted tier: self-hosting is
arranged by talking to us, priced per installation, and that price is not on
sale, so there is no number to give you there either. Once it is set up, you
create the installation in the dashboard, deploy the compose file with Docker,
and the installation checks in. Ory's floor is clone and run; ours is a
conversation first, then an installation that phones home. [The real cost of self-hosting against a managed
service](/blog/self-host-vs-managed-cost) prices the hours either way.
### Sign-in, SSO and permissions
The two method lists are not comparable, because they are not the same kind of
list. BuildBase ships a fixed set you switch on: email and password, magic
links, email codes, phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft,
Apple, one OpenID Connect or OAuth 2.0 provider of your own, Ethereum and Solana
wallets, and Enterprise SSO. Around those sit guest users, usernames, device
code sign-in and Google One Tap, which are ways of using the methods rather than
methods themselves. Separately, every app is an OAuth 2.0 authorization server,
which is how agents and third-party apps get access.
Kratos gives you flows and an identity schema and leaves the list to what you
configure. Hydra is what makes you an OAuth 2.0 and OpenID Connect provider for
other people's software, and nothing on our side claims to be that. Agent access
is not the same product as being the identity provider a partner federates to,
and a comparison that blurs the two is doing you no favours.
Enterprise SSO is where the stories rhyme. BuildBase sells SAML and OIDC sign-in
and Directory Sync (SCIM) on the Enterprise plan, through your own WorkOS
account: a customer's IT admin connects their provider from a setup link,
verified domains send each person to their company sign-in, single sign-on can be
required per company, and directory groups map to roles. Ory puts one-click SAML
and SCIM on its Enterprise tier, with OIDC-only B2B SSO on Growth. Both products
charge for the thing your buyer's security review will ask about. The
[WorkOS comparison](/compare/workos-vs-buildbase) goes through what that
arrangement costs on our side, and [best auth for B2B
SaaS](/compare/best-auth-for-b2b-saas) sorts the wider field by whether you need
it this quarter.
Permissions is the one place Ory models something roles cannot. Keto works in
relationship tuples between objects and subjects, metered at $0.000090 per check
on Production. Ours is role-based at the organization and workspace level, with
custom permissions, role-scoped API keys and three-tier resolution, which
[what RBAC actually is](/blog/what-is-rbac) covers. Ask whether someone may read
a document because their team owns the folder it sits in. Ory models that.
Roles cannot.
| Feature | BuildBase | Ory |
| --- | --- | --- |
| Licence | Proprietary SDK and platform | Apache-2.0 core; paid Enterprise License for self-hosted SCIM and SAML |
| Free tier | Free plan, 10,000 MAU; 7-day trial on paid plans, no card | Developer tier free, but no production environment |
| What gets metered | Monthly active users, 25,000 on Launch | Average daily active users, M2M tokens, permission checks |
| Published entry price | $0 (Free), then $19/mo (Launch) | $770/yr, about $64/mo, plus $0.14 per aDAU past $21.00 of credit |
| Languages | TypeScript and JavaScript | Nine official SDKs plus a REST API |
| Enterprise SSO and directory sync | Enterprise plan, through your own WorkOS account | Enterprise tier; OIDC-only B2B SSO on Growth |
| Permissions model | Roles at org and workspace level, custom permissions | Zanzibar relationship tuples, billed per check |
| OAuth 2.0 provider for third parties | Authorization server for agents and connected apps | Hydra, a general-purpose OAuth 2.0 and OIDC provider |
| Billing, email, workflows | Included, 20 modules on one instance | Not part of the product |
| If you run it yourself | One compose file: server, client app, auth portal, Mongo, Redis | Kratos, Hydra, Keto, Oathkeeper and Polis, as needed |
> **Where Ory wins:** **Nine official SDKs, against one.** Ory publishes TypeScript, Go, Python, Java,
> PHP, Dart, Ruby, C# and Rust, plus a documented REST API. Our SDK is TypeScript:
> Next.js, Vite, React Router / Remix and TanStack Start on the front end, Express,
> NestJS, Fastify, Hono and Astro on the server. A Django or Go API is a
> straightforward Ory install and not a BuildBase one at all. This is the biggest
> honest gap between the two, and no module count closes it.
>
> **Apache-2.0 you can run forever.** Kratos, Hydra, Keto, Oathkeeper and Polis
> carry a permissive licence, which means you clone them, run them, and never have
> a vendor in the loop or a per-installation fee to renew for the life of the
> deployment. Self-hosting here is arranged with us, per installation, and each
> installation checks in with our dashboard. That is a smaller promise. When owning the
> deployment outright is the first requirement, Ory settles the comparison before
> anything else gets discussed.
>
> **A free tier that does real work.** Ory's Developer tier costs nothing, meters
> nothing, and still carries MFA, the fine-grained Permission API and the OAuth 2.0
> provider flows. It has no production environment, so it is a building tier rather
> than a shipping one. Ours is a Free plan with 10,000 monthly active users that
> stops at its allowance, without every feature the paid plans carry. Both are
> free; Ory's gives you more of its feature list for nothing.
>
> **Relationship-based permissions.** Keto expresses authorization that roles
> cannot reach, like a grant that exists because a team owns a parent object. If
> your access model is shaped that way, Ory has the product and we do not.
>
> **A published uptime SLA.** Ory commits to one on its Enterprise tier. Our
> targets vary by plan and we publish no figure, which is a weaker answer to the
> same question.
### How to decide
Two questions end this outright, and if either lands you can stop reading.
Is your backend JavaScript? If not, Ory is the only one of the two you can
adopt, and nothing further matters. Does a contract require you to run identity
on your own hardware under a licence nobody can revoke? Then Ory again, with the
Enterprise License question parked until you know whether you need SCIM in the
self-hosted build.
If neither lands, the question becomes what you are really buying. An identity
stack is not an account system. Ory will hold your users, federate your OAuth
clients and answer permission checks, and it will not invoice anyone, enforce a
quota, send a campaign or run a workflow, because it was never meant to. Those
stay yours to build and maintain, and [the cost of building auth
yourself](/blog/cost-of-building-auth-yourself) is the sibling arithmetic for
the half Ory does cover. If the workspace that signs in is also the record that
gets billed, a bundle removes a mapping you would otherwise own for the life of
the product. That is the trade, and it cuts both ways: fewer agreements to keep,
less freedom to swap one piece out.
### Sources
Ory figures verified 31 October 2026 against Ory's own pages. `ory.sh` now
redirects to `ory.com`.
[ory.com/pricing](https://www.ory.com/pricing/) for the four tiers, the $770 and
$9,350 annual prices, the $21.00 and $255.00 monthly credits, the $0.14 and
$0.12 aDAU rates, the machine-to-machine and permission-check rates, the
environment counts, the Enterprise-only SAML and SCIM gating, the OIDC-only B2B
SSO on Growth and the Enterprise SLA.
[ory.com/open-source](https://www.ory.com/open-source/) for the Apache-2
licensing of Hydra, Kratos, Polis, Keto and Oathkeeper and the evaluation
positioning of the free build.
[github.com/ory/kratos](https://github.com/ory/kratos) for the Ory Enterprise
License description, and [github.com/ory/polis](https://github.com/ory/polis)
for the SAML and SCIM 2.0 bridge under Apache-2.0.
[ory.com/docs/sdk](https://www.ory.com/docs/sdk) for the nine official SDKs.
BuildBase plans, modules and sign-in methods come from our own constants, last
checked against the production plans on 31 October 2026 (PLAN_FACTS).
---
## SuperTokens vs BuildBase: where free self-hosting stops being free
> SuperTokens core is free to self-host at any scale. MFA, account linking and multi-tenancy are paid add-ons with a $100 a month floor. How that compares with BuildBase, free to 10,000 users.
- Source: https://www.buildbase.app/compare/supertokens-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-10-30
### In short
SuperTokens is open source and free to self-host at any user count; its managed cloud is $0.02 per monthly active user, free under 5,000. MFA, account linking and multi-tenancy are paid add-ons with a $100 a month floor, self-hosted too. BuildBase has a Free plan to 10,000 users, then Launch at $19 for 25,000.
SuperTokens costs nothing to run. That is not a marketing line, it is the
licence: the core is Apache 2.0, you host it next to your app, and there is no
cap on how many people sign in. If that is the whole of your problem, go and
install it.
The interesting part is what happens after that.
### The one-paragraph answer
Pick SuperTokens if you want to own the deployment, your team is happy running
a service and its database, and your requirements stop at the sign-in box. Pick
BuildBase if sign-in is the small half of the problem and the real work is
workspaces, subscriptions, quotas and the mail that goes with them. The money
question is not free against $19, though, because SuperTokens charges for
multi-factor sign-in, account linking and multi-tenancy on self-hosted installs
too, and the first two carry a $100 a month minimum whatever your user count.
### Where each fits
SuperTokens is built out of recipes you compose: email and password,
passwordless by one-time code or magic link, social login, passkeys, unified
login through an OAuth2 provider, machine-to-machine tokens, multi-factor
authentication with step-up, and enterprise login with multi-tenancy. You run
the core yourself or let them run it. The backend SDKs are Node.js, Python and
Go, and the front end is React or the framework-agnostic web-js package. That
Python and Go support matters more than it sounds: it is the reason SuperTokens
turns up in stacks where the API is not JavaScript at all.
BuildBase starts somewhere else. The centre is the workspace, not the session.
A person signs in, belongs to workspaces with roles, and each workspace carries
a plan, quotas, credits and invoices. Authentication is the front door to that
and one of 20 modules in a single instance, rendered on a hosted sign-in page.
You do not assemble recipes; you tick the methods an app offers and the page
draws them.
So the two products answer different questions. SuperTokens asks how sign-in
should work and gives you a lot of rope. BuildBase assumes sign-in is solved
and asks what the account does once it exists.
### Sign-in methods
BuildBase ships email and password, magic links, email codes, phone codes,
passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, one OpenID Connect or
OAuth 2.0 provider of your own, and Ethereum and Solana wallets. Phone sign-in
uses text-message codes through your own Twilio account or a signed webhook.
Around those sit Google One Tap, usernames, guest users and device code sign-in
for CLIs and televisions. Two-step sign-in is an authenticator app with
single-use backup codes, or text-message codes through that same provider,
under one policy for the organization that is off, optional or required, and an
authenticator app or a passkey is the stronger choice. Separately, every app is
an OAuth 2.0 authorization server, which is how agents and third-party apps get
access.
SuperTokens covers the same ground at the sign-in box and goes further past it,
with step-up authentication and an attack protection suite. The difference is
not the list. It is that multi-factor sits behind a paid add-on there and
inside the plan here.
### Pricing, verified 30 October 2026
SuperTokens publishes two ways to run it. **Self-hosted** is free and open
source with no limit on monthly active users. **SuperTokens Cloud** is $0.02
per monthly active user, free under 5,000 MAU, and past that threshold the rate
applies to every active user rather than only the ones above the line, which
their own worked example confirms.
Then the add-ons, which apply to both:
- Multi-factor authentication, $0.01 per MAU, minimum billing $100 a month
- Account linking, $0.005 per MAU, minimum billing $100 a month
- Dashboard users, 3 free, then $20 per user per month
- Multi-tenancy and organisation support, priced on request
Unified login across domains, machine-to-machine auth, multi-availability-zone
infrastructure with uptime SLAs, the attack protection suite and implementation
help are all contact-only.
Read that $100 as a floor under the bill rather than a charge per add-on. The
worked example on their pricing page puts 5,000 MAU with account linking at
$125 a month, which is the per-user rates added together and compared against
the floor, not stacked on top of it. Below 5,000 users the same example lands
on a flat $100.
BuildBase publishes four plans: **Free** at $0 with 10,000 monthly active
users, **Launch** at $19 a month with 25,000, **Grow** at $49 with 100,000, and
**Scale** at $99 with 500,000. Free stops at its allowance rather than billing.
The paid plans start with a 7-day trial that does not ask for a card, and yearly
billing is ten months for twelve.
At list price, with multi-factor sign-in switched on in both:
| Monthly active users | SuperTokens Cloud, core only | Cloud plus the MFA add-on | BuildBase |
| -------------------- | ---------------------------- | ------------------------- | ------------ |
| 2,500 | $0 | $100 (the floor) | $0 (Free) |
| 5,000 | $100 | $150 | $0 (Free) |
| 25,000 | $500 | $750 | $19 (Launch) |
| 100,000 | $2,000 | $3,000 | $49 (Grow) |
Three things keep that table honest. The MFA column is only the right column if
you actually need a second factor, and plenty of products do not. The rows above
10,000 MAU are list price before any discount, and SuperTokens openly invites a
conversation there, so treat $2,000 as an opening number rather than a bill.
And self-hosting moves the core to $0 at every row, at the cost of running it,
though the add-on rows do not move at all.
That last point is the one worth sitting with. Self-hosting is free; the
features a B2B product reaches for are not. A team on a self-hosted install
with 800 users and a second factor is paying the $100 minimum for MFA on top of
infrastructure they maintain themselves.
| Feature | BuildBase | SuperTokens |
| --- | --- | --- |
| Free tier | Free plan to 10,000 MAU; 7-day trial on paid plans | Self-hosted core free at any scale; cloud free under 5,000 MAU |
| At 25,000 MAU, core only | $19/mo (Launch) | $500/mo (cloud) or $0 self-hosted |
| Second factor | Authenticator app, backup codes or text-message codes, in the plan | Add-on at $0.01/MAU, minimum $100/mo |
| SAML and enterprise SSO | Not available | Via multi-tenancy, a paid add-on, price on request |
| Where the data lives | Our instance, or a per-organization database | Your database if self-hosted, theirs if cloud |
| Backend languages | JavaScript and TypeScript | Node.js, Python and Go |
| Front-end coverage | Next.js, Vite, React Router / Remix, TanStack Start | React, plus a framework-agnostic web-js package |
| Billing, workspaces, email, workflows | Included, 20 modules in one instance | Not part of the product |
> **Where SuperTokens wins:** SuperTokens wins several of these outright, and if one of them is on your list
> the comparison is already settled.
>
> **You can run it yourself, for nothing.** The core is Apache 2.0 and the
> self-hosted tier has no user ceiling. No vendor can take that away from you,
> and no pricing change next year can either. We have nothing equivalent to
> offer, and for a team whose first requirement is owning the deployment, that is
> the end of the conversation.
>
> **SAML and per-tenant user pools.** Enterprise login lives inside SuperTokens'
> multi-tenancy feature: tenants created from your own backend with a few API
> calls, isolated user pools, optional separate databases per tenant, and
> providers including Okta, Active Directory, Google Workspaces, GitLab and
> Bitbucket alongside a generic SAML option. We do not ship SAML. If a security
> review asks for it, pick them.
>
> **Python and Go.** Their backend SDKs cover all three major server languages.
> Ours is for JavaScript and TypeScript backends. A Django or Go API is a
> straightforward SuperTokens install and not a BuildBase one.
>
> **Free at any scale, if you host it.** The self-hosted core costs nothing
> however many people sign in. Our Free plan stops at 10,000 monthly active
> users and 50 workspaces, and past that you pay for a plan.
>
> **Machine-to-machine tokens and unified login.** OAuth2 client credentials for
> service-to-service calls, and one login shared across web, mobile and desktop
> apps, are documented products there.
### How to decide
Ask what you are optimising for, because the two answers barely overlap.
If it is control, cost at scale, or a server language that is not JavaScript,
SuperTokens is the better instrument, and the self-hosted tier is as free as it
claims to be. Budget for the add-ons you will actually switch on, since that is
where the published price and the real one diverge. The same reasoning applies
to any vendor in this shape, which is what [self-hosted vs open
source](/blog/self-hosted-vs-open-source) and [the real cost of self-hosting
against a managed service](/blog/self-host-vs-managed-cost) both work through
in more detail.
If what you are really buying is the account system behind the login - teams
that invite colleagues, plans that run out, invoices that have to agree with
entitlements - then the auth decision is the small half, and a free auth server
does not help with the big half. That is the case BuildBase is built for.
[Best auth for B2B SaaS](/compare/best-auth-for-b2b-saas) sorts the field by
whether you need SSO yet, and the [Clerk](/compare/clerk-vs-buildbase) and
[WorkOS](/compare/workos-vs-buildbase) comparisons make the same trade from the
managed side.
And if you are weighing either against writing it yourself, [the cost of
building auth yourself](/blog/cost-of-building-auth-yourself) has that
arithmetic.
### Sources
SuperTokens figures verified 30 October 2026 on SuperTokens' own pages:
[supertokens.com/pricing](https://supertokens.com/pricing) (the self-hosted and
cloud tiers, the $0.02 per MAU rate, the free allowance under 5,000 MAU, the
MFA and account linking add-ons with their $100 minimums, dashboard users at
$20, and the volume-discount invitation above 10,000 MAU),
[the enterprise login overview](https://supertokens.com/docs/authentication/enterprise/overview)
(SAML and OIDC, tenant creation from your backend, isolated user pools and the
built-in providers),
[the backend SDK reference](https://supertokens.com/docs/references/backend-sdks/reference)
(Node.js, Python and Go) and
[supertokens-core on GitHub](https://github.com/supertokens/supertokens-core)
(Apache 2.0, with the `ee/` directory under a separate licence). BuildBase
plans are our published pricing, last checked against the pricing page on
31 October 2026 (PLAN_FACTS).
---
## Stytch vs BuildBase: the auth decision you cannot reverse cheaply
> Stytch is an auth vendor you add to a stack. BuildBase is a backend that includes auth. The difference that matters is what it costs to change your mind later.
- Source: https://www.buildbase.app/compare/stytch-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-21
- Updated: 2026-10-22
### In short
Stytch sells auth on its own, with organizations, RBAC, SSO and MFA and 10,000 users free. BuildBase includes auth as one of 20 modules beside billing, email and workflows, with SSO on Enterprise only and a Free plan to 10,000 users. Pick Stytch if your backend works. Pick BuildBase if it does not.
Most comparisons in this category argue about features, and features are the
part you can change. Here is the thing that does not change: whichever vendor
holds your users' identities is the one you cannot leave on a quiet afternoon.
Billing you can swap. Email you can swap in a day. Auth holds the records every
other table in your product joins against, and the password hashes may not be
yours to export. Ask any auth vendor, us included, how you get your users out
before you put them in. Stytch answers that question on its own pricing page,
which is more than most do. That asymmetry, not the feature grid, is what this
decision is actually about.
### The one-paragraph answer
Pick Stytch if your backend exists and works and the missing piece is
authentication. Adding a dedicated auth vendor to a working stack is an additive
change, and additive changes are reversible in a way that architectural ones are
not. Pick BuildBase if you are standing up the backend itself - if auth,
workspaces, roles and billing are all still on the list - because those four
systems have to agree about who a user is and what an organization is, and
having them agree by default is worth more than any single one of them being
best in class.
### What each one is
Stytch sells authentication as its own product. You keep your database, your
billing and your application code, and Stytch holds the identity layer and the
flows around it. For B2B that layer is not thin: organizations, role-based
access control, SSO and per-organization MFA controls are all part of it.
BuildBase includes auth as one of 20 modules on a single instance. A user
belongs to a workspace, the workspace has roles, the roles gate permissions, and
the subscription that defines what the workspace can do lives in the same system.
None of those four things have to be taught about each other.
So the difference is not who has organizations and roles. Both do. It shows up
at the join between identity and everything that is not identity. With Stytch,
their organization is the tenant and your application owns the mapping from it
to the subscription, the usage quota and the emails that tenant receives. You
maintain that mapping for as long as the product lives. With a bundle, the
workspace that signs in is the same record that gets billed, and there is no
mapping because there are not two systems.
That is the same trade every bundle makes, and it cuts both ways. Fewer
agreements to maintain, less freedom to replace one part.
### Pricing
Stytch figures verified 19 October 2026 against
[stytch.com/pricing](https://stytch.com/pricing).
Stytch starts at $0. The always-free tier covers 10,000 monthly active users,
unlimited organizations, 5 SSO or SCIM connections and 1,000 machine-to-machine
tokens. Past that you pay for what you use, and their page is explicit that
there are no hard caps and no pricing cliffs. An additional SSO or SCIM
connection is $125. Removing their branding from emails and the login
experience is $99. Enterprise is custom. The per-user rate past 10,000 sits
behind a calculator rather than a published number, so it is not quoted here.
Our side, which does not need re-verifying because it comes from our own
published plans, verified 31 October 2026: a Free plan at $0 with 10,000 monthly
active users, 50 workspaces, 1 GB of storage and 2 team seats, which stops at
its allowance rather than billing. Launch is $19 a month and includes 25,000
monthly active users, 1,000 workspaces, 10 GB of storage and 3 team seats, after
a 7-day trial that does not ask for a card. Grow is $49 and Scale is $99. On the
paid plans, workflow runs, web analytics events and storage bill over the
allowance (storage at $0.10 per GB-month); everything else is a hard allowance.
Put those side by side honestly. Up to 10,000 users both cost $0, but
Stytch's free tier gives away unlimited organizations and five SSO
connections, where ours stops at 50 workspaces and has no SSO. Past 10,000,
we cost $19 a month for Launch. That $19 is not buying auth. It is buying the
other 19 modules, and if you do not need them it is the wrong $19 to spend.
| Feature | BuildBase | Stytch |
| --- | --- | --- |
| Scope | Auth inside a 20-module backend | Authentication as its own product |
| Free tier | Free plan: 10,000 MAU, 50 workspaces | 10,000 MAU, unlimited organizations |
| Entry paid plan | $19/mo (Launch), 25,000 MAU, 7-day trial | $0 base, usage billed past the free tier |
| Auth methods | 8, dashboard toggles (SSO on Enterprise) | Magic links, OTP, passwords, OAuth, SSO |
| SAML and MFA | SAML on the Enterprise plan only, via your own WorkOS account. MFA by authenticator app | Both. 5 SSO or SCIM connections free, then $125 each |
| Billing, email, workflows | Included, same system as auth | Not part of the product |
| Organizations and RBAC | Included, same system as billing | Included, unlimited organizations |
### What you get on our side of the table
User-facing sign-in methods, all toggled from the dashboard rather than
configured in code: Email/Password, Magic Link, Email Code, Phone Code,
Passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, Custom OIDC, Ethereum
Wallet, Solana Wallet and, on the Enterprise plan, Enterprise SSO through your
own WorkOS account. Turning one on is a switch, not a deploy, which
means [adding magic link](/guides/magic-link-login-nextjs) does not touch your
Next.js code at all. [Adding passkeys](/guides/passkeys-nextjs) does not either,
though it does make you settle your auth domain first.
Sessions run 30 days by default, configurable per session and capped at 180
days. A role change in the dashboard is enforced on the next request, and
changing someone's org role signs them out so they return with the new one.
When a change seems not to apply, the cause is usually an open tab or a cached
API key, and [that has its own guide](/guides/permission-change-not-taking-effect).
Every BuildBase app is also a full OAuth 2.0 authorization server, with dynamic
client registration, token introspection, revocation and PKCE. That matters more
than it used to, because it is what lets an AI agent hold scoped access to a
user's account without holding their credentials.
> **Where Stytch wins:** **Their SSO starts free, and ours does not.** That is the honest headline
> here. Stytch includes five SSO or SCIM connections on its free tier, and its
> MFA has per-organization controls, where ours is an authenticator app under
> one policy for the whole app. Our SSO is on the Enterprise plan only, through
> a WorkOS account you pay per connection. If your buyer is an IT department
> with a security questionnaire, SSO is on it, and without the Enterprise plan
> we lose that deal on the first page. Check their current list against your
> requirement before you read anything else on this page.
>
> **For auth alone their free tier gives more away.** Both are free to ten
> thousand users, but theirs includes unlimited organizations and SSO, and ours
> stops at 50 workspaces. If authentication is the only thing you are shopping
> for, that decides it.
>
> **Adopting them is reversible; adopting us is not.** Bolting an auth vendor onto
> a working stack changes one layer. Moving to a bundled backend changes the shape
> of your application. If your stack already works, the bundle is asking you to
> pay an architectural cost to solve a component-sized problem, and that is a bad
> trade whoever is selling it.
>
> **We have a ceiling and they do not have ours.** Our connection-pool architecture
> tops out at roughly 1,000 organizations before it becomes the constraint, which
> is [documented rather than
> hidden](/guides/connection-pool-exhausted-multi-tenant). A dedicated auth
> service is not carrying our multi-tenant database model, so it does not inherit
> that particular wall.
### When each one is wrong
Stytch is the wrong call if authentication is one of several backend systems
you still have to build. It will give you users, organizations and roles, and
give you them well. You would still be writing subscriptions, usage metering,
transactional email and the automation around all three, and then keeping each
of them in agreement with an organization that lives in someone else's system.
[The cost of building auth yourself](/blog/cost-of-building-auth-yourself) works
through that arithmetic, and auth is rarely the expensive line.
BuildBase is the wrong call if your backend is built and running. Replacing a
working identity layer to get bundled workspaces is the same mistake in the
other direction. The bundle pays off while you are choosing the pieces, not
after you have chosen them.
And both are the wrong call if the real question is enterprise identity. Neither
a mid-market auth vendor comparison nor this post answers "what do we do when
the buyer's IT team sends a questionnaire", and choosing on price when that is
the actual requirement is how teams end up migrating twice.
### If you are choosing more broadly
This is a two-name comparison, and the auth field is wider than two names.
[Best auth for B2B SaaS](/compare/best-auth-for-b2b-saas) sorts the field by
whether enterprise single sign-on is on your path yet, which is the question
that actually splits it. If the shortlist is really about the whole backend
rather than auth alone, [best multi-tenant
backend](/compare/best-multi-tenant-backend) is the closer comparison.
---
## The best Clerk and Stripe combination, and when to skip it
> Clerk plus Stripe is two vendors and three jobs. Which combination fits which app, what the seam between them costs you to own, and when a bundled backend is the better call.
- Source: https://www.buildbase.app/compare/clerk-stripe-combination
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-10
- Updated: 2026-10-22
### In short
Clerk plus Stripe is two vendors and three jobs. Auth knows who the user is, Stripe knows who paid, and the layer deciding what a paying user can actually do is the one you end up owning. Take the pairing when your pricing is flat and stable. Skip it when quotas, credits or metered usage are the product.
The reflex answer to "how do I charge for this" is Clerk plus Stripe, and it holds up until the first customer downgrades mid-cycle. Clerk knows who the user is. Stripe knows who paid. The part in between is yours: you write it, and then you own it for as long as the product exists.
### The short answer
Take the pairing if you are selling seats at a price that does not move. The integration is short, and each vendor stays replaceable: swap one and the other never notices.
Skip it if what you sell is measured rather than counted: credits, API calls, per-run charges, per-workspace quotas. In that shape the glue between the two vendors stops being an afternoon of webhook handling and becomes a reconciliation job you own for the life of the product.
And if you are picking a stack from scratch rather than migrating off one, the first question is not which two vendors. It is whether you want to own the seam between them at all.
### The seam you end up owning
A card declined at 2am is the whole problem in one event. Stripe knows within seconds. Your auth vendor does not, because in the two-vendor shape nobody tells it. Your app does not either, until a webhook lands and something in your database changes.
So you write a webhook receiver. Then a plan-state table, because reading subscription status from Stripe on every request is too slow. Then gating checks that read that table. Then a reconciliation job, because webhooks get missed and a customer sitting on a plan they stopped paying for is a bug nobody reports.
None of that is difficult. All of it is yours forever, and none of it was in the estimate. We put building auth alone at 3 to 6 weeks. The seam is smaller than that, and unlike auth it never finishes.
> **Key takeaway:** Auth is identity. A processor is money movement. The layer that turns "this person paid" into "this workspace can create another project" is the one you end up owning, and it is where the maintenance actually lives.
### Two ways to combine them, and they are not the same decision
Both shapes work. They differ in one thing, which is where your plan catalog lives, and that is what sets the price of leaving.
The first shape is the one most people mean: auth vendor for auth, Stripe Billing for subscriptions, your app in the middle holding plan state. You own the webhooks. In exchange, your plan catalog lives in Stripe, where most tools you will ever buy can read it, and leaving either vendor is a bounded piece of work.
The second shape is a billing layer sold by the auth vendor, pitched as riding on top of your own Stripe account and buying away the webhook work by holding the plan catalog for you. The question to ask before you take that trade is where the catalog physically lives, because if the vendor holds it and Stripe never sees it, the saving on day one is a bill on the day you leave: a catalog Stripe never saw is one you recreate by hand, subscription by subscription. If it is mirrored into your Stripe account, the trade is close to free.
Clerk Billing is the second shape, and Clerk's own docs answer the question without being asked: "Clerk Billing is a separate product from Stripe Billing; Plans and Subscriptions made in Clerk are not synced to Stripe." Your Stripe account moves the money and holds nothing else. The plan catalog and every subscription against it live in Clerk, which is exactly what makes the webhook work disappear, and exactly what you rebuild if you leave. Clerk charges 0.7% of billing volume for that, on top of processing. Its answer on metered billing is equally direct: "Not yet, but usage-based billing is a top priority on our roadmap." Per-seat plans did ship, in June 2026, so the roadmap is moving - just not on the axis this section is about. (Both quotes still live on Clerk's own pages, verified 12 October 2026.)
So pick by how permanent your pricing is. Selling the same three plans in two years? Take the convenience. Expecting to keep changing what you charge for, and how, and to whom? Hold the catalog where the most tools can read it, and pay the webhook tax.
### Where each fits
| Feature | BuildBase | Clerk + Stripe |
| --- | --- | --- |
| Vendors on the critical path | One instance, 20 modules | Two, plus the glue code you write between them |
| Entitlement state | Feature flags with workspace, user and audience targeting; toggles without a deploy | A table in your database, kept in sync by your webhooks |
| Quotas and credits | Credit ledgers, per-plan quota limits, overage billing, balance alerts | Whatever your processor records, mapping it to in-app limits is your code |
| Webhook handling | Delivery logs, retries and HMAC verification, 5-minute max age | Yours to build, monitor and replay |
| Stripe account | Your own keys, per organization; we take no cut of revenue | Your own account |
| Auth methods | Built in: email/password, magic link, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC provider, Ethereum and Solana wallets, enterprise SSO (Enterprise plan) | Email code, email link, SMS code, password, passkeys, social OAuth connections, enterprise SSO and Web3 wallets |
| SSO against a customer identity provider | Not offered on Launch, Grow or Scale; Enterprise plan, via your own WorkOS account | Yes. Pro ($25/mo) and Business ($300/mo) each include one SSO and one directory sync connection; $75/mo each for connections 2-15, $60/mo to 100 |
| Free tier | Free plan: 10,000 MAU. Launch is $19/mo, after a 7-day trial with no card | Hobby is free to 50,000 monthly retained users per app. Pro is $25/mo |
Our side of that table is not a pitch, it is the constants file. Free is $0 and includes 10,000 monthly active users, 50 workspaces, 1 GB of storage and 2 team seats. Launch is $19 a month and includes 25,000 monthly active users, 1,000 workspaces, 10 GB of storage and 3 team seats. Grow is $49 with 100,000 users and 8 seats. Scale is $99 with 500,000 and 50.
Three quotas bill over on the paid plans: workflow runs at $0.25, $0.15 or $0.10 per 1,000 on Launch, Grow and Scale, web analytics events at $2 per 100,000, and storage at $0.10 per GB-month. Everything else is a hard allowance, on purpose, and Free never bills over at all, so nobody gets a surprise invoice. Yearly is ten months for twelve. (Verified against the live plans 31 October 2026.)
One row matters more than any of the price rows: you connect your own Stripe keys, per organization. We are not a merchant of record and we take no percentage of what you bill. Clerk Billing takes 0.7% of billing volume, and Stripe Billing takes the same 0.7% if you run subscriptions through it directly, so the two-vendor route costs a slice of revenue whichever way you assemble it. That is the axis worth checking hardest, because a percentage of revenue is the one line on a bill that grows with your success rather than your usage. At $50,000 billed in a month it is $350, and it keeps going.
### Where the pairing genuinely wins
> **Where Clerk wins:** Four things, and none of them are small.
>
> **Enterprise SSO is cheaper to reach on Clerk.** If a buyer's security review asks you to authenticate their staff against their own identity provider, that is not offered on our Launch, Grow or Scale plans. It is on our Enterprise plan, and it runs through your own WorkOS account, so it is a second vendor relationship either way. Clerk includes one enterprise connection over SAML or OIDC on Pro at $25 a month, then $75 a month each for connections 2 to 15 and $60 a month from 16 to 100. Pro bundles a directory sync connection at the same price, which is the other half of that security review; ours sits on the same Enterprise plan and the same WorkOS account. For a team closing its first enterprise deal on a small budget, that is the clearest reason on this page to keep auth with a specialist.
>
> **Two vendors means two independent replacements.** If billing stops working for you, you swap billing. Auth never notices. A bundled backend gives you one vendor, one release cadence and one outage window, and buying it is a bet that it stays good at both halves.
>
> **Clerk's free tier is bigger.** Our Free plan covers 10,000 monthly active users, and paid plans start at $19 a month with a 7-day trial that never asks for a card. Clerk's Hobby tier is free to 50,000 monthly retained users per app, five times ours and more free users than most products ever reach. Before you have revenue that is the number that decides, and it does not decide our way.
>
> **Our SDK covers a fixed list of web frameworks:** [Next.js](/guides/buildbase-on-nextjs), [Vite](/guides/buildbase-on-vite), [React Router / Remix](/guides/buildbase-on-react-router), [TanStack Start](/guides/buildbase-on-tanstack-start), [Express](/guides/buildbase-on-express), [NestJS](/guides/buildbase-on-nestjs), [Fastify](/guides/buildbase-on-fastify), [Hono](/guides/buildbase-on-hono) and [Astro](/guides/buildbase-on-astro). If you are outside that list, this is a hard stop rather than a trade-off.
### When to skip both
Your invoice line decides this, not your architecture diagram.
"5 seats x $20" and the two-vendor split is fine. Seats change rarely, and a stale entitlement is the kind of bug a human spots before a customer does.
"1,847 API calls" or "312 credits consumed" and you should look harder. Every request now has to check a balance, decrement it, and hold up when two of them land at once. That check cannot cross a vendor boundary on every call, so it lives in your database, which makes your database and your billing vendor two copies of one number. Reconciling two copies of a number that moves thousands of times a day is the job. A bundled backend deletes the job by keeping one copy.
That is what our credits and billing modules are for: ledgers, per-plan limits on any metric, overage, and metered usage synced to Stripe from the same place that enforces the limit. Our own defaults are written down rather than discovered in production: a session re-reads its user every hour, and a webhook signature older than 5 minutes is rejected.
The other signal is how many products sit on one account. One product with one pricing model? Two vendors is a fine trade, and the glue stays small enough that one engineer holds all of it in their head. Five products sharing one identity and one balance is five copies of that glue, drifting apart at different speeds.
### If you are already on Clerk
Do not rip it out because a post told you to. Migrating auth is the highest-risk change you can make to a live product, and "we consolidated our vendors" is not a feature any customer noticed.
The honest trigger is pricing pressure or a shape change: you are moving from seats to usage, or you have started writing reconciliation jobs, or the entitlement table has grown a special case per plan. If none of that is true, the pairing is doing its job.
Worth reading alongside this: [Clerk vs BuildBase](/compare/clerk-vs-buildbase) for the head-to-head with figures, [Clerk alternatives](/compare/clerk-alternatives) for which complaint each option actually fixes, and [the real cost of Clerk plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost) for what the stack costs once it is four vendors instead of two.
---
## The best way to add billing to a Next.js app depends on where entitlements live
> Four ways to add billing to a Next.js app, compared on what you still have to build after checkout works: entitlements, quota enforcement and seats.
- Source: https://www.buildbase.app/compare/best-way-to-add-billing-nextjs
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-09
- Updated: 2026-10-22
### In short
Four ways to add billing to a Next.js app: wire Stripe yourself, start from a template, bundle it with your auth provider, or use a platform that enforces limits. The transaction fee is not the deciding variable. Where entitlement state lives is, because a webhook-fed table is stale right when a customer upgrades.
Every guide to adding billing to a Next.js app finishes in the same place. Checkout works, the webhook fires, a row in your database flips to `active`, and the tutorial ends. That is the easy half. The half that shapes your codebase starts on the very next request, when some route handler has to decide whether this workspace is allowed to do the thing it just asked for.
### The one-paragraph answer
If your pricing is one flat amount per interval and you want money moving this week, take `nextjs/saas-starter` and stop reading. Already on Clerk for auth? Clerk Billing bolts plans and per-seat pricing onto gating you have already written. If you sell into the EU and tax is the thing keeping you awake, wire Stripe yourself and add Stripe Tax, because nothing bundled comes close to its coverage. And if what you need is a limit that refuses a request rather than a flag that permits one, none of those three do that. Comparing them on transaction fee will never tell you so.
### Four routes, and what each one leaves you holding
**Wire Stripe yourself.** A Checkout session, a webhook handler, a subscriptions table, and a `hasPro` check that ends up written three times: once in `middleware.ts`, once in a server component, once in the route handler you forgot. Stripe has since added Entitlements, which removes some of that bookkeeping: when a subscription becomes active, Stripe creates an active entitlement for each feature attached to the product. Read the object before you plan around it. Its fields are `id`, `object`, `feature`, `lookup_key` and `livemode`. No quantity, no counter, no balance. Provisioning is by webhook plus a list API, which Stripe's own guidance describes as the way to execute feature provisioning.
**Start from a template.** The current one is `nextjs/saas-starter`, which replaced Vercel's `nextjs-subscription-payments` when that repo was sunset. Check which you are looking at, because the old one still ranks. The new template gives you a pricing page wired to Stripe Checkout, subscription management through the Stripe Customer Portal, Owner and Member roles, and a webhook handling two subscription events: `customer.subscription.updated` and `customer.subscription.deleted`. Its README calls it "intentionally minimal and to be used as a learning resource", which is the most honest sentence in this entire category. The template it replaced was blunter about where the ceiling is: Stripe Checkout "currently supports pricing that bills a predefined amount at a specific interval", and "more complex plans (e.g., different pricing tiers or seats) are not yet supported". Lemon Squeezy's `nextjs-billing` sits in the same place, handling `subscription_created` and `subscription_updated`, which its README says are "enough to get a billing system in place". Both are good starting points. Neither has a concept of a limit.
**Bundle it with your auth provider.** Clerk Billing adds plans, per-seat pricing with seat limits, a base fee and free trials, and gates on them with the same `has()` helper and `` component you already use for roles. Clerk's docs describe that helper as checking whether the user has been granted a role, permission, feature or plan, and returning a boolean. Which is the point: it is the Stripe Entitlements shape with a nicer developer experience on top. One thing to be clear about, because the naming invites the mistake: Clerk Billing is its own product, not a wrapper over Stripe Billing. Clerk's docs say plans and subscriptions created in Clerk are not synced to Stripe, which is only used for payment processing. Clerk charges 0.7% of billing volume for it, on top of Stripe's processing fees paid directly to Stripe.
**Use something that holds the counter.** This is where BuildBase sits, and it is worth being precise about what that means, because we are not an alternative to Stripe. The billing module runs on your own Stripe account. What it adds is the piece none of the three routes above ship: `bb.usage.record(workspaceId, { quotaSlug: 'api-calls', quantity: 1 })` returns the remaining balance in the same response, and on a plan without overage enabled the call fails rather than recording the increment. One await, inside the request that has to answer. Metering and enforcement are one operation, which is the only arrangement in which they cannot drift apart.
### An entitlement is a boolean. A quota is a counter.
These are two different questions and the industry has quietly agreed to only answer one of them.
"Is this customer on Pro" is a boolean. It changes a handful of times in a customer's life, it is cheap to cache, and a webhook is a perfectly reasonable way to learn about it. Stripe Entitlements answers it. Clerk's `has()` answers it. Every `hasPro` check in every SaaS codebase answers it. It is worth being clear that this boolean is [not a feature flag](/blog/entitlements-are-not-feature-flags), even where the same component renders both, because the two have different owners and fail in opposite directions.
"Has this workspace used its 10,000 API calls" is a counter. It changes on every request, it is worthless the moment it is stale, and no webhook will ever deliver it to you in time. Stripe is explicit that its meters are eventually consistent: meter events are processed asynchronously and may not be immediately reflected in aggregates, and meter event summaries are described in the API reference as an eventually consistent view of reported usage. That is the correct design for producing an accurate invoice. It is the wrong design for a route handler deciding, right now, whether to return a 429.
> **Key takeaway:** Every billing provider will answer "is this customer entitled". Almost none of
> them will answer "how much do they have left" in time to act on it. If your
> pricing has a limit in it, that gap is your code, whichever provider you pick.
So the real question for a Next.js codebase is not which provider takes the money. It is whether a counter lives somewhere your route handler can read and decrement in one round trip, or whether you are going to [build that yourself](/blog/cost-of-building-usage-metering-yourself) on top of a table a webhook fills in.
### Where Next.js makes the staleness visible
Here is the bug, and it always arrives the same way. A customer upgrades. Stripe redirects them back to your success page. That page is a server component, so it renders on the server, reads your database, and finds the row the webhook has not written yet. Your happiest customer of the week sees the free plan.
You can fix it, and the fixes are all fine: read the subscription from Stripe directly on the success path instead of from your own table, or render that page from a pending state and let the client poll, or make the success route the one place that does not trust the cache. The first of those is what `nextjs/saas-starter` quietly does, and it is the best thing in the template: its Checkout `success_url` points at a route that fetches the session and writes the subscription before the page renders, so the happy path never waits on a webhook at all. What you cannot do is not decide. Every route in your app that reads plan state from a webhook-fed table has a window where it is wrong, and the App Router makes that window most visible on exactly the page a customer is most excited to be looking at.
I should be straight about where we have a version of the same problem. The per-metric quota check described above is synchronous and has no webhook in it, so it does not have this window. Our org-level check, the separate question of whether an organization is entitled to the platform at all, is a different code path with a short-lived cache in front of it, and it is not instant after a payment lands. Two questions, two mechanisms. Only one of them sits in the request path with nothing cached in front of it, and anyone claiming their billing state is globally instant is describing a design they have not shipped.
| Feature | BuildBase | Stripe |
| --- | --- | --- |
| Entitlement shape | Counter with a remaining balance | Boolean feature grant, no quantity field |
| Delivery to your app | Read and decremented in the request | Webhook plus a list API |
| Behavior at the limit | Fails unless overage is on; trials always cap | Meters it; the block is yours to write |
| Tax determination | Stripe Tax on your own Stripe account, switched on per organization; checkout collects the address and tax ID | Stripe Tax, calculated and collected |
| Languages and frameworks | Next.js, Vite, React Router / Remix, TanStack Start, Express, NestJS, Fastify, Hono, Astro | Any language with an HTTP client |
| Scope | 20 modules including auth, workspaces and RBAC | Payments and billing |
> **Where Stripe wins:** Stripe Tax is not a feature we have a smaller version of. It is Stripe's
> product, and we have no tax engine of our own. Stripe calculates and collects
> tax across the EU, the UK, Norway, Switzerland, every US state, Australia,
> Japan, Singapore, the UAE and more. What we add is the switch: Stripe Tax runs
> on your own Stripe account, turned on per organization in the console, and
> checkout then collects the billing address and tax ID and every invoice shows
> its tax. So the honest version is that we have no tax engine of our own, not
> that using us costs you Stripe Tax. Revenue Recognition is the same story for
> accrual-basis reporting. Stripe is also language-agnostic. Our SDK covers six
> JavaScript frameworks, so a Django or Rails team can use Stripe Billing today
> and cannot use BuildBase at all.
### How to actually decide
Write down your pricing page first, then read it back as questions your code has to answer. If every line is a flat monthly amount, all four routes work and you should take the fastest one, which is the template. If a line says "up to 10,000 API calls", you have a counter, and you should decide now where it lives rather than discovering in month four that it lives in four places. Decide at the same time whether that counter is [an allowance that resets or a balance the customer bought](/blog/quotas-are-not-credits), because the two carry different behavior at renewal. If a line says "per seat", you need a seat count checked against a plan limit on every invite, which is app-layer work no matter who processes the card. And if a line mentions VAT, start from Stripe Tax and fit the rest around it.
Our own pricing starts with a Free plan at $0, then $19 a month for Launch, with 25,000 MAU included, and every paid plan carries a 7-day trial that does not ask for a card. Three quotas bill past their limit on the paid plans: workflow runs (from $0.25 per 1,000 on Launch), web analytics events ($2 per 100,000) and storage ($0.10 per GB-month). Free and everything else hard-stops, which is the whole argument above applied to ourselves. Card details are handled entirely by Stripe and never stored on our servers.
Once you have picked a route, the implementation posts are the next stop: [charging per seat in Next.js](/guides/charge-per-seat-nextjs) covers the invite-button case in code, and [charging per API call in Next.js](/guides/charge-per-api-call-nextjs) covers the meter-and-enforce loop in a single route handler. If the question underneath all this was really which metering vendor to buy, [best usage-based billing tools](/compare/best-usage-based-billing-tools) argues that one on its own terms. And if your pricing page opens with a trial rather than a plan, [running one without a credit card](/guides/free-trial-without-a-card-nextjs) is the case where the entitlement check has to admit a status that is not `active`.
A note on sourcing. Stripe's Entitlements object shape, the webhook-plus-list-API provisioning guidance and the eventual consistency of meters all come from Stripe's own documentation, checked on 9 September 2026. The `nextjs/saas-starter`, `nextjs-subscription-payments` and `nextjs-billing` quotes were read directly from each repository on the same day, as were the Clerk lines, from Clerk's own docs and pricing page. No Stripe Billing rate appears above, and that is deliberate: the figure could not be read off Stripe's pricing page today, and Clerk's 0.7% is Clerk's own fee for a separate product rather than a second reading of Stripe's. Base Stripe processing fees and Clerk's plan pricing are absent for the same reason. A stale fee is worse than no fee. BuildBase figures come from `PLANS` and `PLAN_FACTS` in `packages/shared/src/constants/platform-stats.ts`, verified 31 October 2026 against the live plans, and the enforcement behavior from the metered-usage service in `server/src/payment/`.
---
## Best backend for an API product
> Supabase, Firebase and Hasura are built for apps with a database behind them. An API product needs API-key auth and usage-based billing per call - here's what each actually gives you.
- Source: https://www.buildbase.app/compare/best-backend-for-an-api-product
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-08
- Updated: 2026-10-12
### In short
The best backend for an API product isn't decided by database or auth alone - it's whether API-key auth and usage-based billing work as one system. Supabase, Firebase and Hasura give you a database or a GraphQL layer, but none bills your own downstream customers per call. That part stays DIY on every one of them.
Ask what the best backend for an API product is, and every roundup answers with the same three names: Supabase, Firebase, Hasura. All three are good backends. None of them is built for a product that is itself an API - one where a customer signs up, gets a key, and pays you by the call. That's a narrower problem than "pick a database," and it's the one this comparison actually answers.
### The one-paragraph answer
If your product exposes a database or a GraphQL layer to end users through your own app, Supabase, Firebase or Hasura are still the right shortlist, and the decision comes down to SQL versus document store versus a generated GraphQL API over what you already run. If your product _is_ the API - customers call it directly, get a key, and get billed by volume - none of the three meters or bills that for you. You wire together an auth layer for issuing keys, a counter for usage, and Stripe for the invoice yourself, on all three of them. BuildBase ships API tokens, per-call usage tracking and Stripe billing as one module, at the cost of a database you never touch directly.
### What "backend" means once your product is the API
Every BaaS in this comparison was designed to sit behind an app: a mobile client, a web dashboard, something with a logged-in user clicking around. Auth in that world means a session - a cookie or a JWT that says who's currently looking at the screen.
An API product flips that. There's no screen. A customer's server calls your server, presents a key instead of a login, and does that thousands of times a month. The question isn't "who is this user" so much as "which customer issued this key, what plan are they on, and have they used their quota this cycle?" Session auth answers the first question fine. It has nothing to say about the other two.
> **Key takeaway:** A BaaS built for logged-in users gives you session auth. An API product needs
> key-scoped auth tied to a plan and a running usage count - a different
> problem, and one that Supabase, Firebase and Hasura all leave unsolved.
### Where each one fits
**Supabase - Postgres, open, and DIY on the metering.** [Supabase vs BuildBase](/compare/buildbase-vs-supabase) already covers Supabase's database, storage and auth in full; the part that matters here is the keys. Supabase issues project-level publishable and secret keys, plus a separate end-user JWT layer from Supabase Auth. A publishable key maps to the `anon` or `authenticated` Postgres role and is governed by row-level security; a secret key maps to `service_role`, which carries `BYPASSRLS` and skips policies entirely. Supabase's own docs draw the line this post is about: "An API key doesn't distinguish between users but between applications." Neither key is a per-customer credential you'd hand to someone paying you by the call, and nothing in Supabase counts a request against a plan or reports it to Stripe. Full SQL, extensions like pgvector, and a free tier to start on are genuine strengths - just not ones that touch billing.
**Firebase - the same gap, on Google's infrastructure.** Firebase Auth is built for end users signing into an app, and Blaze's pay-as-you-go pricing meters _Firebase's own_ services against you, not your customers' usage of your API against them. If Firestore and Cloud Functions are already your stack, staying there is reasonable. Monetizing calls to your own API on top of it is a separate build either way.
**Hasura - a GraphQL layer, not an auth or billing decision.** Hasura doesn't authenticate anyone itself. It runs in JWT mode or webhook mode, where some other service validates the request and hands Hasura session variables to enforce permissions with. Clean separation of concerns for a GraphQL API over an existing database - and it means the auth-plus-billing question this post is about gets punted somewhere else, not answered.
**An auth provider plus Stripe, wired by hand - the default everyone assembles.** Most teams don't pick a single vendor for this. They add an auth provider to issue keys, a counter or a Redis key for usage, and Stripe's metered billing API for the invoice, then maintain the glue between all three for as long as the product exists. [The cost of building usage metering yourself](/blog/cost-of-building-usage-metering-yourself) puts a number on that maintenance load, and it doesn't shrink after launch - a new plan tier touches all three systems again.
**BuildBase - tokens, metering and billing as one module.** API tokens are scoped to an org, named, and can be activated or revoked, and the billing module tracks usage against any metric - API calls included - tracked in real time and synced to Stripe, billing overage automatically once a plan's allowance runs out. Imejis, one of the six products running on BuildBase, is itself an API product: a template-based image generation API for marketers, built on BuildBase's user auth, API token management, billing and team collaboration - the same pieces this post is about, not a bolt-on. The trade is the one you'd expect: no direct database access. Pricing starts with a Free plan you can build the first version on, and Launch is $19 a month with a 7-day trial that doesn't ask for a card.
| Feature | BuildBase | Supabase |
| --- | --- | --- |
| API key model | Scoped tokens, per org, named and revocable | Project-level publishable/secret keys scoped to an app, not a customer, plus separate end-user JWTs |
| Per-call metering | Built in - any metric, tracked in real time and synced to Stripe | None - counting requests against your own customers is DIY |
| Billing your customers | Overage billed automatically once a plan allowance is used | Not provided - wire Stripe yourself against your own counter |
| Database access | None - API and SDK only | Full Postgres, SQL, extensions like pgvector |
| Pricing | Free plan, then $19/mo flat (Launch), published | Free tier, then usage-based |
> **Where Supabase wins:** If your API product needs a real database underneath it rather than access
> through a fixed set of endpoints - vector search with pgvector for an AI
> product, full-text search, or just SQL you can query directly while you build
> - Supabase gives you that and BuildBase does not. BuildBase's self-hosted
> stack runs on MongoDB, not Postgres, and even there you work through the API
> and SDK rather than a database console. Supabase is also open source with a
> real free tier, so you can build and test the whole metering-and-billing layer
> yourself before paying anyone. BuildBase has a Free plan too, but open source
> is a different kind of free: you can read, fork and self-host every line.
> That's a genuine advantage early on, even though building that layer is the
> exact work this comparison is about avoiding.
### The one honest gap
BuildBase's usage metering is per workspace plan, not per API key. Tokens are scoped to an org, not to an individual key, while usage limits and overage belong to each workspace's plan. If two of your own customers need different limits, that isn't a dial on a single key - it means putting each customer in a separate workspace, on its own plan. Worth knowing before the shape of your data model depends on it.
### How to actually decide
Start with what your product actually is. If people click through screens in something you built and a database happens to sit behind it, Supabase, Firebase or Hasura are still the right shortlist - nothing above changes that. If people, or their servers, call your API directly, get a key, and pay by volume, the real question is whether key auth and billing exist as one system or three you maintain yourself. [Best metered-billing tools for AI products](/compare/best-metered-billing-tools-for-ai-products) goes deeper on the metering half alone, if billing infrastructure - not the backend around it - turns out to be the actual gap.
A note on sourcing. Every BuildBase figure above - the token model, the metering behavior, the Free plan, the $19/mo Launch price and the 7-day trial on paid plans - comes from `PLANS` and `PLAN_FACTS`, re-read 31 October 2026, plus the authentication and billing module entries in `packages/shared/src/constants/`. The competitor claims were re-read off the vendors' own pages on 12 October 2026: supabase.com/pricing and Supabase's API keys guide, firebase.google.com/pricing, and Hasura's authentication docs. Nothing in the shape of any of the three had moved since the previous check: Supabase still ships publishable and secret keys over `anon`, `authenticated` and `service_role`, Firebase still splits a no-cost Spark plan from pay-as-you-go Blaze, and Hasura still states that "actual authentication is handled outside Hasura", in JWT mode or webhook mode. No competitor dollar figure appears above by choice, not by accident - all three meter something above the headline plan, so a single monthly number would be a floor rather than a price, and the shape of each model moves less often than its numbers do. Check the vendor's own page before you budget against any of them.
---
## Best metered-billing tools for AI products, sorted by what the meter actually counts
> Metronome, Orb, Lago and Stripe Billing compared for AI products on what the billing unit actually is: a token, a credit, or an event nobody dimensioned for AI.
- Source: https://www.buildbase.app/compare/best-metered-billing-tools-for-ai-products
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-07
### In short
For AI products, the best metered-billing tool depends on what the meter counts. Orb prices tokens, seats and outcomes in one config. Lago ships an SDK that wraps your LLM client and streams token usage. BuildBase enforces a credit balance synchronously, but the unit is a flat credit, not a token.
Ask Stigg, Orb or any of the other vendors ranking for "AI billing software" what stops a runaway session from blowing through a customer's budget, and the honest answer buried in most of their own posts is: nothing in the billing tool itself. [The general version of that gap](/compare/best-usage-based-billing-tools) - metering tells you what happened, enforcement stops what's about to happen - already has its own comparison. This one is narrower: for an AI product specifically, what does the meter actually count? A token, a credit, a seat, or an event nobody bothered to dimension for AI at all?
### The one-paragraph answer
If the cost driver is genuinely multi-dimensional - input tokens, output tokens, seats and an outcome-based fee all in the same invoice - Orb is the one built for exactly that shape, with fractional per-token rates as a native pricing primitive. If the product already calls an LLM directly and wants usage pushed to billing with minimal glue code, Lago's Agent SDK wraps that call and streams token counts on its own, on top of a self-hosted edition that costs nothing. Want accurate per-token billing before a request even runs? None of Metronome, Orb or Stripe's Meters API do that natively today. They price and invoice usage; they don't gate it. And if the requirement is a balance that gets checked and decremented before the operation completes, a credit ledger like BuildBase's does that, with an honest caveat: it enforces a number, not specifically a token.
### Where each tool's AI story actually differs
**Metronome, the one that metered OpenAI before Stripe bought it.** Before its acquisition, Metronome was the metering layer behind OpenAI's and Databricks' own billing, which is real pedigree for extreme-scale usage ingestion. Stripe now owns Metronome outright and separately runs its own waitlisted per-token pricing preview inside Stripe Billing (more on that below), so evaluating Metronome today means evaluating two overlapping products from the same company, not one.
**Orb, dimensioned for AI specifically.** Orb markets itself explicitly around AI billing, and the pitch holds up past the marketing page: it supports fractional, sub-cent per-token rates and names four billing units built for this category - tokens, agent runs, outcomes and credits - combinable in one pricing config. That is a genuinely different shape from a generic per-unit metering engine bolted onto an AI use case after the fact.
**Lago, the one with an SDK for your LLM call.** [Lago's Agent SDK](/compare/lago-vs-buildbase), published for Python and TypeScript, wraps an LLM client and pushes token usage to Lago as it happens, which is a concrete integration convenience none of the others on this list ship. It sits on top of Lago's usual model: the Community edition is open source and free to self-host, with Premium features like dunning and a customer portal sold separately, quote-only.
**Stripe Billing, generic today with an AI feature in preview.** The base Meters API aggregates usage events for an end-of-cycle invoice and has no AI-specific primitive of its own. Stripe has previewed a feature that auto-syncs per-token pricing for major model providers, but it's waitlist-gated as of this writing, not something every Stripe Billing account can turn on.
> **Key takeaway:** Every vendor here can invoice AI usage accurately. What actually differs is
> the unit: Orb and Lago's SDK price and track tokens directly, while BuildBase
> enforces a balance before it's spent but counts a generic credit, not a token.
> Nobody on this list does both today.
### BuildBase's honest limit here
BuildBase's credit module enforces synchronously: consuming credits checks the balance and fails closed, before the calling operation completes, so two concurrent requests can't overdraw the same balance. That part is real and it's the piece missing from Metronome, Orb and Stripe Billing's own descriptions of themselves. But the unit BuildBase enforces is [a flat credit](/blog/quotas-are-not-credits), not a token or a specific model's rate. Wiring a token-denominated LLM cost into that ledger means deciding your own conversion rate from tokens to credits, then updating it yourself every time a model's price changes. [That upkeep is exactly the line item building usage metering in-house costs you](/blog/cost-of-building-usage-metering-yourself) - BuildBase does not track per-model token pricing the way Orb's native units do.
| Feature | BuildBase | Orb |
| --- | --- | --- |
| Native AI billing units | One flat credit unit | Tokens, agent runs, outcomes, credits, combinable |
| Request-time enforcement | Synchronous balance check, fails closed | Meters and invoices; no native pre-request gate |
| Per-token rate tracking | Not built in; convert tokens to credits yourself | Native fractional per-token pricing |
| Pricing | Free plan, then $19/mo flat (Launch), published | Custom quote, no public price list |
| Scope | 20 modules: billing, auth, workspaces, RBAC, one instance | Metering and billing only |
> **Where Orb wins:** If tokens, seats and an outcome fee genuinely need to live in one pricing
> config, Orb's native support for that shape is a real advantage BuildBase does
> not match - BuildBase's credit ledger has one dimension, not several
> combinable ones. For a product whose entire cost structure is multi-input AI
> usage, that specialization is worth the tradeoff of a quote-only price and a
> metering-only scope.
### How to actually decide
Start with what the invoice actually needs to reflect. Genuinely multi-dimensional AI usage points to Orb - its native units save you from building that pricing logic yourself. If the product already talks to an LLM client directly, Lago's SDK removes a real integration step. And if the whole point is stopping a request before a customer's balance runs out, check for synchronous enforcement specifically: most of the vendors here don't have it, and the ones that do usually don't tie it to a token. Nobody on this list yet does both a token-native unit and pre-request enforcement in the same product; treat that gap as the actual open problem, not a solved one, whichever tool you pick.
A note on sourcing. BuildBase's figures and the credit-enforcement description come from `PLANS`, `PLAN_FACTS` and the credits module in `packages/shared/src/constants/` plus the credit-balance service in `server/src/services/credit/`, read today. Metronome's OpenAI and Databricks history, Orb's four AI billing units, Lago's Agent SDK and Stripe's per-token preview all trace to each company's own product pages and announcements, also read today - but none of their dollar pricing appears above as a number, because none of those pricing pages could be reached to re-verify a figure for this edition. This edition still owes a re-verification of Metronome, Orb, Lago Premium and Stripe Billing's current published rates against their own pages once network access allows it, rather than quoting a number nobody checked today.
---
## Best SaaS starter for solo founders: boilerplate you own, or platform you call
> Every "best SaaS starter" roundup compares boilerplates against each other. Here is when a fork-and-own kit is the right pick for a solo founder, and when a hosted SDK is.
- Source: https://www.buildbase.app/compare/best-saas-starter-solo-founders
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-06
- Updated: 2026-11-02
### In short
Boilerplates like ShipFast and MakerKit hand a solo founder code to own and maintain forever. A hosted SDK trades that ownership for zero ongoing integration upkeep. The right pick depends on whether solo means you want full control, or you never want to touch auth again.
Type "best SaaS starter for solo founders" into Google and every result compares the same handful of boilerplates against each other: ShipFast, MakerKit, Supastarter, TurboStarter. Different feature checkboxes, same starting assumption - a starter kit means a repo you fork. Nobody asks who keeps that repo's auth and billing integrations working eighteen months in, when there is still only one of you - the same buy-vs-build question that runs across [every module a SaaS needs](/blog/buy-vs-build-saas-infrastructure), just framed here as a whole starter kit instead of a single line item.
### The one-paragraph answer
A boilerplate like MakerKit is still the right call if you want to own every line of code, plan to heavily customize or eventually flip the product, or are shipping something simple enough that you will never need per-tenant roles. A hosted SDK is the better call if "solo" specifically means you do not want a second job patching an auth library or a Stripe webhook every time one of them changes. BuildBase is built for that second answer. Auth, workspaces, RBAC and billing already run as a service, on a Free plan at $0 and then Launch at $19 a month, with a 7-day trial on the paid plans that does not ask for a card.
### Where each fits
MakerKit, ShipFast and Supastarter are the boilerplate field. Buy one and you get a GitHub repo already wired to a database, an auth library and Stripe, plus, in MakerKit's case, B2B multi-tenancy in the kit itself: workspaces, email invitations and role-based access for products that need per-organization accounts. The code is yours outright.
So is every future decision about it. The day the auth library ships a breaking change, or Stripe deprecates a webhook version, that pull request has your name on it. There is no vendor behind the fork to write it for you.
MakerKit also ships a free kit called Lite, which is worth knowing about before you spend $299. It is Next.js and Supabase only, and it leaves out the three things that make the paid kits interesting for a B2B product: billing, team accounts with roles, and the admin panel. As a way to read the code before buying, it is a genuinely good offer. As a starting point for a product with paying teams, it stops exactly where the hard part starts.
BuildBase is the opposite trade. Twenty modules, including [workspaces and role-based access](/guides/multi-tenant-workspaces-in-an-afternoon), run as a hosted service behind one SDK. You never see the code that handles a Stripe webhook or a magic-link email, which means you also never patch it. What you give up is the boilerplate's biggest asset: if BuildBase disappeared tomorrow, your app would stop working. A forked repo has no such dependency on anyone.
| Feature | BuildBase | MakerKit |
| --- | --- | --- |
| What it is | 20 modules on one hosted instance: auth, workspaces, RBAC, billing, workflows | A Next.js or TanStack Start boilerplate repo you fork and deploy yourself |
| Code ownership | You call the SDK; BuildBase operates the service behind it | You own every file, including the auth and billing wiring |
| Ongoing maintenance | Integration patches and security updates are ours to ship | Yours - the next auth CVE or Stripe API bump is your pull request |
| Multi-tenancy and roles | Workspaces plus org- and workspace-level roles, built in | MakerKit ships workspaces, invitations and RBAC in every paid tier. Not universal across the category - check before you buy |
| Pricing | Free plan at $0, then Launch $19/mo with a 7-day trial and no card required | One-time: $299 Pro or $599 Teams (up to 5 collaborators), lifetime updates. A free Lite kit drops billing and team accounts |
| Infrastructure | Hosted by default, or self-hosted on the same SDK | Your infrastructure from day one, and your choice of database on the Drizzle and Prisma kits |
> **Where MakerKit wins:** Three things a boilerplate genuinely does better, and none of them are close calls.
>
> **Full ownership.** The repo is yours, including the auth and billing code most SDKs hide behind an API call. Read it, fork it, rip out the parts you do not need. Nothing we run sits in the path of your login screen, and nothing about your product depends on us staying in business.
>
> **No recurring platform fee.** Past the one-time purchase, you are not paying a monthly charge for the wiring itself. You still pay Stripe, your database and your host directly, but there is no SDK subscription stacked on top of them.
>
> **Infrastructure freedom from day one.** You pick the host, the framework version and, on the Drizzle and Prisma kits, the database itself - both are explicitly bring-your-own. The Supabase kit is the one exception worth knowing, since it builds on Supabase Auth, Storage and RLS, so that variant does assume a vendor, and Supabase can change its own terms. What nobody can change is the licence on the repo you bought.
### When the boilerplate is still the right call
Buy MakerKit, ShipFast or Supastarter if the code is close to the product itself and you want to keep making the decisions about how auth or billing actually work. Planning to sell the codebase later? Same call - a buyer wants a repo, not an account on someone else's platform. And if the product is a simple, single-user app with no organizations or team seats in its future, a lighter boilerplate is less machinery than workspaces and RBAC you will never touch.
None of that changes once revenue shows up. A boilerplate does not get more expensive to own as the product grows - it gets more expensive to _maintain_, and that cost is time, not a bigger invoice. [What building auth yourself actually costs in hours](/blog/cost-of-building-auth-yourself) puts a number on the maintenance side of that trade, and [the full ShipFast comparison](/compare/shipfast-vs-buildbase) works through the exact one-time-versus-subscription arithmetic for one specific kit.
### Which one to pick
Pick a boilerplate if ownership, resale value, or a genuinely simple product are the actual priorities - the field is real and MakerKit ships B2B workspaces and roles in the kit itself, so it is worth a look if you expect organizations later. Pick a hosted SDK if the honest answer to "what do you want to be doing in eighteen months" is your product, not a patched dependency tree.
A note on sourcing: MakerKit's prices and stack come from makerkit.dev and its pricing page, re-verified 2 November 2026 - $299 Pro and $599 Teams (up to 5 collaborators), still one-time with lifetime updates and still no subscription. Both prices moved since the October check, and down: Pro was $349 and Teams $649. The page now prints each tier as a pair, $349 beside $299 and $649 beside $599, with "/lifetime" attached to the lower figure and no "was" or "sale" label on either, so read the higher number as an anchor and the lower as what you pay. Two other things changed earlier and still hold. MakerKit now sells three kit variants, so the framework list is per kit rather than flat: Next.js and TanStack Start across all three, React Router on the Supabase kit only. And the free Lite kit was not covered the first time round. Multi-tenancy is still in every paid tier, which is why the table now says paid - Lite sits outside that list, as a separate free kit rather than a cheaper tier. Every BuildBase price comes from `PLANS` and `PLAN_FACTS` in `packages/shared/src/constants/platform-stats.ts`, and the module count from `MODULE_COUNT` in `modules.ts` beside it.
---
## Best multi-tenant backend, sorted by who maintains the isolation policy
> Multi-tenant backend options compared by who keeps tenant isolation correct after launch - a row-level security policy you write, or a workspace model that ships it.
- Source: https://www.buildbase.app/compare/best-multi-tenant-backend
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-05
- Updated: 2026-10-12
### In short
Multi-tenant backend comparisons usually stop at shared schema versus database-per-tenant. The real cost is who maintains the isolation policy: Supabase hands you row-level security and the ongoing upkeep, while BuildBase's workspace module ships tenant isolation as a feature you don't write.
Every multi-tenant backend comparison turns into the same argument: row-level security in a shared schema, or a separate database per tenant. That's a real decision, and [shared schema versus database-per-tenant](/blog/database-per-tenant-vs-shared-schema) already works through it in detail. What it skips is the question that actually costs you time after launch - once you've picked a model, who keeps the isolation policy correct as you add tables, ship features, and onboard tenant number two hundred?
### The one-paragraph answer
If you want tenancy enforced by a database you already know, and you're fine writing, testing and re-verifying a row-level security policy for every table you add, Supabase or a self-managed Postgres instance is the honest pick - especially if raw SQL and extensions like pgvector matter to you. If you'd rather isolation ship as a feature you don't maintain, with per-workspace quotas and billing built in and no policy of your own to get wrong, BuildBase's workspaces module is built for exactly that trade, at the cost of never touching the database directly. Appwrite sits in between: its Teams primitive gets you a tenant boundary without hand-rolled RLS, but you're still running or paying for the surrounding infrastructure yourself, and there is no billing or per-tenant subscription layer in it.
### Row-level security is a primitive, not a finished layer
Ask anyone who has shipped multi-tenant SaaS on Supabase what breaks first, and the answer is usually a query that forgot the tenant filter. RLS pushes authorization into Postgres itself: you write a policy and Postgres appends it to every query as an implicit `WHERE` clause.
Two states get confused here, and the difference decides how bad a mistake is. Turn RLS **on** and write no policy, and the table is closed: "no data is accessible through the API when using a publishable key, until you create policies." That is the safe failure. The dangerous one is a table where RLS was never enabled at all, sitting in a schema the API exposes. Supabase's own wording: such a table is "readable and writable by any role with a grant on it." And on an existing project, "a new table in `public` starts with every privilege already granted to all three roles" - `anon`, `authenticated` and `service_role`. So the grant is usually already there. Not just your authenticated users, and not just reads.
There is a subtler version that survives even a correct policy. Grants and policies are separate mechanisms, and a table "protected only by policies still hands `anon` an insert path if you never revoke the grant." Writing the policy is the famous half of the job. Revoking the grant is the half people skip.
Supabase has closed most of this gap, and the honest version of the argument has to say so. Create a table through the dashboard and the Table Editor enables RLS for you. Miss one anyway and Security Advisor raises `0013_rls_disabled_in_public` at ERROR level, in plain language: "Anyone with your project URL can read, edit, and delete all data in this table because Row-Level Security is not enabled." It surfaces in Studio, in `supabase db advisors`, through the Management API and over MCP. An earlier version of this post said the database won't warn you. It does now.
What is left is narrower and still real, and this part is our reading rather than anything Supabase states. The advisor is a report you have to go and read, not a build that fails. The Table Editor's default is documented for tables created in the dashboard, which leaves tables created by a migration or a raw `CREATE TABLE`. And lint `0013` is scoped to RLS being disabled, so the revoked-grant case sits outside it: RLS is enabled there, so it looks correct and reports clean.
So the maintenance job survives, just smaller than it was: someone owns writing a policy for every new table, testing it as two different tenants, revoking the grants policies don't cover, and reading the advisor often enough for it to count. That doesn't go away. It moves from a backend module to your own team's checklist.
> **Key takeaway:** Row-level security is enforcement Postgres runs once you've written the
> policy. Supabase now flags the table you forgot - at ERROR level, in Studio
> and on the CLI - so the old "silent by default" story is out of date. What
> that lint does not look at, as far as we can tell, is a table whose policy
> looks right and whose grants were never revoked.
### Where each one fits
**Supabase - Postgres, plus the responsibility.** Supabase pairs a managed Postgres database with auth, storage and edge functions, and RLS is the standard way to isolate tenants inside it. You get direct SQL, the full range of Postgres extensions, and a free tier to build against before you pay anything. What you don't get is a tenancy primitive - "tenant" is a column and a policy you design yourself, and whether that boundary is the user or the organization is a decision Supabase leaves entirely to you.
**Appwrite - Teams, which you can use as a tenant boundary.** Appwrite's Teams feature gets you a tenant boundary without writing RLS-equivalent policies by hand: a team per tenant, roles on the membership, and `Role.team()` to grant every member access to a resource. Worth being precise about whose framing that is - Appwrite documents Teams as memberships and permissions and never calls it a multi-tenancy layer. Reading it as one is our inference, and a reasonable one, but you won't find a vendor multi-tenancy guide to follow.
Appwrite is BSD 3-Clause licensed, and self-hosting is documented as running "the same features found on Appwrite Cloud" - with the caveat they add themselves, that compliance features and dedicated support route to an enterprise conversation. What it doesn't ship is the billing half: no subscriptions, no per-tenant plans, no workspace-level quotas you can charge against. Its product surface is wider than data and auth, though. Functions, Messaging, Sites, Domains and a firewall are all in there.
**Self-managed Postgres - the same trade as Supabase, without the managed layer.** If you're running your own Postgres instance rather than Supabase's hosted one, the isolation story is identical: RLS policies you write and maintain. You also take on the database operations Supabase would otherwise run for you - backups, upgrades, connection pooling - which is exactly the ops load [database-per-tenant cost math](/blog/database-per-tenant-cost) puts a number on once you're managing more than a handful of instances.
**BuildBase - isolation as a module, not a policy.** The [workspaces module](/guides/multi-tenant-workspaces-in-an-afternoon) isolates data, feature flags, billing and members per workspace as a shipped feature: `bb.workspace.create()` gives you the boundary, and every read the SDK makes is already scoped to it. Per-plan workspace limits are published rather than architectural guesswork - 1,000 on Launch, 25,000 on Grow, 100,000 on Scale - and role permissions run through the separate RBAC module at both the org and workspace level. AgentCenter, one of the six products built on BuildBase, runs its multi-project tenancy on this exact module rather than a hand-rolled RLS layer. The trade is real: there's no SQL console, no direct database connection, and no free plan - every plan carries a 7-day trial that doesn't ask for a card, with Launch starting at $49 a month.
| Feature | BuildBase | Supabase |
| --- | --- | --- |
| Isolation model | Isolated per workspace, shipped as a feature | Shared Postgres tables, enforced by your own RLS policy |
| Tenant limits | 1,000 to 100,000 workspaces by plan, published | No tenant primitive - defined entirely by your schema |
| Database access | None - API and SDK only | Full Postgres, SQL, extensions like pgvector |
| Pricing | Free plan, then $19/mo flat (Launch), published | Plan fee, plus hourly per-project compute, plus overages |
| Scope | 20 modules: auth, billing, RBAC, workflows, one instance | Database, auth, storage, functions - no billing layer |
> **Where Supabase wins:** **You can assert an RLS policy in CI. You cannot assert our isolation.** Because a policy is just SQL, it is testable: `supabase test new` scaffolds a pgTAP test, `supabase test db` runs it, and their docs ship a GitHub Actions workflow that runs it on every pull request. So you can write a test that authenticates as an owner, a non-member and an outsider, and fail the build the day someone widens the boundary. We have no equivalent. Our isolation is enforced inside the module, which means you cannot write an assertion against it that breaks your build - you are trusting our tests rather than running your own. If proving the isolation boundary is the thing you need, to an auditor or to yourself, that is a real argument for the policy you maintain.
>
> **Raw SQL and extensions.** Supabase wins both and it isn't close. Our workspace isolation is enforced partly by never exposing the database at all, so you can't query it directly, run your own migrations against it, or reach for an extension we don't support. That's the same decision that removes the policy-maintenance job.
### How to actually decide
Start with who is going to own the isolation policy once you ship. If that's a team that already knows Postgres and wants direct SQL access badly enough to write and maintain RLS policies as the schema grows, Supabase is the right tool and the free tier means you can try it before committing to anything. If nobody on the team wants that job, or you'd rather it not exist, a workspace model where isolation, quotas and billing already ship together removes it - at the cost of database access you'll never get back without migrating off.
Tenant count matters too. Under a few hundred tenants, either model works fine on its own merits. Past roughly 1,000 tenants, the constraint that decides it stops being which backend you picked and starts being the connection-pool ceiling both [what database-per-tenant actually costs](/blog/database-per-tenant-cost) and [buy vs build for SaaS infrastructure](/blog/buy-vs-build-saas-infrastructure) already put a number on.
If the actual gap is auth and workspace roles rather than the database layer itself, [Supabase alternatives](/compare/supabase-alternatives) covers Firebase, Appwrite, Nhost and PocketBase as direct database-first swaps, none of which add billing or tenancy roles either.
A note on sourcing, since roundups are where stale numbers sneak in. Every BuildBase figure above - workspace limits, plan prices, the trial terms - comes from `PLANS` and `PLAN_FACTS` in `packages/shared/src/constants/platform-stats.ts`, re-read 31 October 2026, and the workspaces module entry in `modules.ts`. The Supabase claims - the free tier and the plan-plus-compute pricing shape - came off supabase.com/pricing, and the RLS behavior with and without a policy, the Security Advisor lint and the pgTAP workflow off the Supabase row-level-security, database-advisors, tables and local-testing docs. The Appwrite claims - Teams roles, the absent billing layer and self-hosted parity - came off the Appwrite products, Teams and self-hosting docs, and the BSD 3-Clause licence off their repository. All verified 12 October 2026. Appwrite's pricing page is deliberately not in that list: it would not render on the day of checking, so no claim above rests on it. No competitor dollar figure appears above on purpose: neither vendor's price decides this comparison, and a number that nobody re-checks is exactly how a roundup goes stale.
This pass corrected two things rather than just moving the date. The post used to say an unprotected table is open to any authenticated user, which conflated RLS-on-no-policy with RLS-never-enabled and understated the second case. And it used to say nothing warns you, which stopped being true when Security Advisor started flagging it at ERROR level. Both are fixed above. Recording the correction rather than quietly editing it is the point of carrying a verification date at all.
---
## Best auth for B2B SaaS, sorted by whether you need SSO yet
> Best auth for B2B SaaS compared by the question that actually decides it: do you need enterprise SSO this quarter, or organizations and roles first.
- Source: https://www.buildbase.app/compare/best-auth-for-b2b-saas
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-04
- Updated: 2026-10-22
### In short
Most 'best auth for B2B SaaS' roundups assume day-one enterprise SSO. Most early B2B teams don't have that buyer yet - they need organizations, roles and workspace isolation. Auth0, Clerk, WorkOS and Kinde sell SSO self-serve; BuildBase keeps it for its Enterprise plan. Here is which tool fits which stage.
Every "best auth for B2B SaaS" roundup on page one was written by a company that sells enterprise SSO. Naturally, they all rank providers on how well each does enterprise SSO. Fine axis, if a security questionnaire is already on your desk. Wrong one if you're still building the product and don't have an enterprise buyer yet.
### The one-paragraph answer
If an enterprise buyer's security review already has SAML or SSO on it, pick Auth0, Clerk, WorkOS or Kinde - all four sell it self-serve, and arguing around that wastes a sales cycle. If you're earlier than that - shipping organizations, roles and workspace isolation for a B2B product that hasn't fielded an enterprise security review yet - BuildBase covers that shape on its Launch, Grow and Scale plans, and none of them include SSO. When the buyer does arrive, BuildBase's Enterprise plan adds SAML and OIDC sign-in and SCIM through your own WorkOS account, which bills each connection to you. Two vendors and a conversation, not a toggle.
### Two different jobs wearing the same label
"B2B SaaS auth" gets used for two things that aren't the same problem. One is multi-tenancy: organizing customers into isolated accounts, each with its own members and permissions, so a support rep at Acme can't see Widgets Inc's data. The other is enterprise SSO: letting a customer's own identity provider, Okta or Entra ID or Google Workspace, authenticate its employees into your app on the customer's terms.
Every B2B SaaS product needs the first one on day one. Most don't need the second until an enterprise deal is already in motion - and by then, whether SSO is a checkbox you have or a checkbox you're missing is usually decided already, months earlier, by which auth provider got wired in first.
> **Key takeaway:** Multi-tenancy (organizations, roles, isolated data) is a day-one requirement
> for B2B SaaS. Enterprise SSO is usually a later one, tied to a specific
> buyer's security review, not to launch. Sorting the field by which stage each
> tool actually serves beats sorting by SSO depth alone.
### Where each one fits
**Auth0 - the deepest identity platform, if SSO is already the ask.** [Auth0](/compare/auth0-vs-buildbase) is the most protocol-complete option here: SAML, OIDC, and a B2B product line with per-connection enterprise pricing. It's priced by monthly active users starting on a free tier, with B2C and B2B tiers priced separately. If identity itself is the product's hard problem, Auth0's depth shows.
**Clerk - fast to ship, SSO from the first paid tier.** [Clerk](/compare/clerk-vs-buildbase) pairs a polished, framework-native SDK (including React Native and Vue, which BuildBase does not support) with an Organizations product for B2B membership. One enterprise SSO connection is included starting on its Pro plan, with additional connections billed per connection. Clerk also added a Stripe-backed billing product this year, though it remains an add-on rather than a bundled quota-and-metering system.
**WorkOS - narrow, and built for exactly this.** [WorkOS](/compare/workos-vs-buildbase) does one thing: enterprise identity. SSO, SCIM directory sync, audit logs, and a self-serve Admin Portal a customer's own IT admin can configure without your team in the loop. Its free User Management product covers a large free tier of monthly active users before the enterprise-connection pricing kicks in. It has no billing and no workspace model beyond its organizations, though AuthKit does support custom roles and permissions scoped to an organization. Billing and anything workspace-shaped stay separate vendor problems.
**Kinde - SSO included earlier than most.** [Kinde](/compare/buildbase-vs-kinde) is an auth provider with subscription billing features bolted on, priced on the monthly active users you authenticate through it. It includes one enterprise SSO connection on its free and Pro tiers - unusually early compared to the field - with unlimited connections on its higher paid tier. If the roadmap includes both SSO and basic subscription billing without adding a third vendor for either, Kinde is worth a closer look before reaching for a bundle the size of BuildBase.
**BuildBase - organizations and roles first, SSO on Enterprise.** BuildBase ships sign-in by email and password, magic links, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, an OpenID Connect provider of your own, Ethereum and Solana wallets, and enterprise SSO, alongside multi-tenant workspaces and role-based access control with org-level and workspace-level roles, custom permissions and API token scoping - one piece of a 20-module bundle that also covers billing, workflows and email in the same instance. Enterprise SSO is the catch. Enterprise SSO (SAML and OIDC) and Directory Sync (SCIM) are on the Enterprise plan only, and they run through your own WorkOS account: the customer's IT admin connects their identity provider from a setup link, verified domains send each person to their company's sign-in, and WorkOS bills each connection to you on top of the BuildBase plan. If SSO is the next problem on your list and a custom plan isn't, one of the four above gets you there with one vendor.
| Feature | BuildBase | WorkOS |
| --- | --- | --- |
| Enterprise SSO / SAML | Not offered on Launch, Grow or Scale; Enterprise plan, via your own WorkOS account | Core product, self-serve Admin Portal for customer IT admins |
| Organizations / workspaces | Built in, isolated data, billing and settings per workspace | Basic "Organizations" concept, not a full workspace model |
| Role-based permissions | Built in, org- and workspace-scoped roles | Custom roles and permissions, org-scoped |
| Subscription billing | Built in: plans, credits, usage quotas | Not included, bring your own Stripe |
| Sign-in methods | Password, magic link, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC provider, Ethereum and Solana wallets, enterprise SSO (Enterprise plan) | Email/social sign-in via User Management, plus SSO |
| Pricing shape | Flat: Free $0, Launch $19/mo, Grow $49/mo, Scale $99/mo | Free to a large MAU ceiling, then priced per SSO/SCIM connection |
> **Where WorkOS wins:** **Enterprise SSO, SCIM and a self-serve Admin Portal, done by specialists.** WorkOS, and to a lesser extent Auth0, Clerk and Kinde, all sell SAML or enterprise SSO connections self-serve. BuildBase's own enterprise SSO is WorkOS underneath: it runs through your WorkOS account, hands the customer's IT admin WorkOS's Admin Portal, and is only on BuildBase's Enterprise plan. So if a buyer's security team has SSO on a questionnaire this quarter and you are on Launch, Grow or Scale, every one of the other four gets you there with one vendor and no plan change, and there is no way to argue around that.
### How to actually decide
Don't start from the feature list. Start from whether an enterprise security review is already scheduled. If it is, the choice is between Auth0, Clerk, WorkOS and Kinde on how they each price and package SSO, or BuildBase's Enterprise plan with a WorkOS account of your own - not whether to buy it at all - and [Auth0 vs BuildBase](/compare/auth0-vs-buildbase), [Clerk vs BuildBase](/compare/clerk-vs-buildbase) and [WorkOS vs BuildBase](/compare/workos-vs-buildbase) each carry the current published figures for that comparison, re-verified against the vendor's own page on the date each was written.
If no enterprise buyer has asked yet, the more useful question is how many other systems you're about to wire together around whichever auth provider you pick - billing, workspace isolation, role permissions, [quota enforcement](/guides/enforcing-quotas-in-react). Auth0, Clerk, WorkOS and Kinde each answer identity well and leave some or all of the rest to other vendors. BuildBase answers the rest, and leaves SSO to its Enterprise plan and your own WorkOS account. Whichever gap you'd rather have on your desk twelve months from now is the actual decision, not which provider's login screen looks best today.
A note on sourcing: no dollar figure for Auth0, Clerk, WorkOS or Kinde appears above - only the shape of each plan, which was re-checked against each vendor's own pricing page on 24 September 2026. Each vendor's actual numbers are re-verified on the date printed on its own comparison post - 20 August 2026 for Auth0, 14 August 2026 for Clerk and Kinde, 6 October 2026 for WorkOS - and quoted there, not repeated here. Check the linked post, or the vendor's own page, before budgeting against any of them. BuildBase's own figures come from `PLANS` and `PLAN_FACTS` in `packages/shared/src/constants/platform-stats.ts`, verified 9 September 2026.
---
## Best usage-based billing tools, sorted by what happens at the limit
> Usage-based billing tools compared by what actually differs now: real-time enforcement versus invoice-only metering, not the charge-model checklist.
- Source: https://www.buildbase.app/compare/best-usage-based-billing-tools
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-09-03
### In short
Usage-based billing tools mostly support the same charge models now, so that is not the real choice. What differs is whether a tool only invoices after usage, like Metronome, Orb and Stripe Billing, or enforces limits at request time, the way BuildBase does for every metric but storage.
Every "best usage-based billing tools" roundup ranks the same five names on the same axis: which charge models does each one support. Per-unit, tiered, graduated, package pricing - by now nearly all of them check every box. That axis stopped deciding anything. The question that actually separates these tools is what happens the moment a customer's usage crosses a limit: does the tool just note it and bill later, or does it stop the request?
### The one-paragraph answer
If you are metering hundreds of millions of events a day and raw ingestion throughput is the whole problem, Metronome is still the deepest tool built specifically for that job - just know you are evaluating a Stripe product now, not an independent vendor. If the cheapest possible metering with code you can read matters more, Lago's self-hosted edition is free. If a public rate card matters more than raw depth, Stripe Billing and Chargebee both publish one, tied to a percentage of what you bill. And if you actually need enforcement, not just invoicing - stopping a request at the limit instead of surprising a customer with an overage line next month - most of the big names here do not do that natively. Metronome and Stripe Billing both meter and bill after the fact; neither stops a request at your app layer without a separate entitlements product bolted on.
### Metering and enforcement are different jobs
Ask any of these vendors whether they do "real-time usage tracking" and they will say yes, and mean it. What they mean is that a usage event shows up in your dashboard within seconds, not that anything stopped a request. A metering engine counts what happened and produces an accurate bill. An enforcement layer decides, before your API returns a response, whether this specific request is even allowed to happen.
Most usage-based billing tools are metering engines, and that is not a knock. Metering at Metronome's or Orb's throughput is genuinely hard, and getting the invoice right matters more to plenty of teams than blocking a request ever will. But if your actual problem is a free-tier user about to burn through ten times their allowance before the invoice even generates, a metering engine alone does not solve it. Something has to check the balance synchronously, in the request path.
That is the part of BuildBase's billing module that does not show up on a feature-checklist comparison. The quota is checked synchronously, in the same call that records the usage. Overage is on by default, so usage past the plan's included allowance is billed as overage rather than refused. Turn overage off for a quota, or put the workspace on a trial, and the record call fails at the limit instead - a hard stop in the request path, not a line on next month's invoice.
> **Key takeaway:** Metering tells you what happened. Enforcement stops what is about to happen.
> Most usage-based billing tools do metering well; check separately whether the
> one you are picking also enforces at request time, because most of the big
> names do not.
### Where each tool fits
**Metronome - the deepest metering engine, now inside Stripe.** Metronome built its reputation ingesting usage at extreme scale for companies like OpenAI, Anthropic and Nvidia, and Confluent's own case study on Metronome's infrastructure describes it streaming billions of events a day and processing more than 10,000 invoices per second. Stripe completed its acquisition of Metronome in January 2026, so you are evaluating a Stripe product now, not an independent vendor. Pricing is quote-only; there is no public rate card to check today. Per Stigg's published analysis of Metronome, it tracks usage balances but does not enforce them at the request level - you would add a separate entitlements layer for that.
**Orb - a similar pitch, a different acquirer.** Orb's story runs parallel to Metronome's: a dedicated usage-metering and billing engine, also quote-only, also no longer independent. Adyen closed its acquisition of Orb in mid-2026 and runs it today as a subsidiary. [Lago alternatives](/compare/lago-alternatives) has the fuller rundown of both acquisitions and what they mean for a metering-engine buyer.
**Lago - the free, source-published option.** Lago's self-hosted Community edition costs nothing and its code is public under AGPLv3 - genuinely free, not free-until-you-need-a-feature. What that edition drops (customer portal, automatic dunning, tax integrations) sits behind Lago Premium, priced by conversation rather than a published number. [Lago vs BuildBase](/compare/lago-vs-buildbase) covers it in more depth, including where it beats BuildBase outright.
**Stripe Billing - if you already live on Stripe.** Stripe's own subscription and invoicing layer charges a percentage of billing volume on top of standard processing fees, with a Meters API for usage-based charges. It is metering and invoicing, not enforcement - nothing in Stripe Billing stops a request at your app layer on its own. [Stripe Billing alternatives](/compare/stripe-billing-alternatives) has the current published rate, verified there rather than repeated here, since percentage pricing moves and that post checks it independently.
**Chargebee - subscription and dunning maturity.** Chargebee leans harder into revenue recovery than anything else on this list: automated dunning sequences, retry logic and quote-to-cash tooling built out over years of subscription-billing specialization. Pricing runs on a published rate card tied to billing volume, with an enterprise tier quoted by conversation. If the actual pain is failed payments and recovery rather than usage enforcement, Chargebee's depth there is real.
**BuildBase - billing as one module, not one vendor.** The billing module runs on your own Stripe account and adds subscription plans with versioning, trials, usage-based and seat-based billing, a credit ledger, and the hard-stop enforcement described above. It is one of 20 modules in the same instance as auth, workspaces and RBAC, not a standalone billing product. There is a Free plan at $0 for 10,000 MAU, and Launch is $19 a month for 25,000 MAU; every paid plan carries a 7-day trial that does not ask for a card.
| Feature | BuildBase | Metronome |
| --- | --- | --- |
| Limit behavior | Hard-caps at request time (all quotas but storage) | Meters and invoices; enforcement needs a separate layer |
| Pricing | Free plan, then $19/mo flat (Launch), published | Custom quote, no public price list |
| Event throughput | Not built for extreme-scale ingestion | Billions of events/day, 10k+ invoices/sec |
| Scope | 20 modules: billing, auth, workspaces, RBAC, one instance | Metering and billing only |
| Ownership | Independent (Jagodana LLC) | Part of Stripe since January 2026 |
> **Where Metronome wins:** If you are metering at the volume OpenAI, Anthropic or Nvidia-scale customers
> do, Metronome is built for exactly that in a way a bundled billing module is
> not. Confluent's own case study on Metronome's infrastructure describes it
> streaming billions of events a day and processing more than 10,000 invoices
> per second - the ceiling of a system whose only job is metering, not one of 20
> modules sharing a database with auth and workspaces. If your metering volume
> is anywhere near that scale, the specialization is real, and it is the honest
> reason to pick Metronome over a general-purpose platform.
### How to actually decide
Start with what actually breaks today, not the feature list. If a free-tier user blowing through their quota before the invoice even generates is a support ticket you have gotten, you need enforcement, and that narrows the field to tools that check the request path, not just the event log. If the problem is closer to accurate bills but messy dunning and recovery, that is Chargebee's actual strength, not a metering engine's. And if the honest answer is that billing was never the only integration you needed to replace, that is the case for a bundled platform, priced against [what building the pieces yourself costs](/blog/cost-of-building-usage-metering-yourself) rather than against a metering specialist's rate card.
If entitlements and packaging experiments are the real axis, not raw metering throughput, that is a closer fit for [Stigg vs BuildBase](/compare/buildbase-vs-stigg) than for anything on this page.
A note on sourcing, because roundups like this one are where stale numbers sneak in. Every BuildBase figure and the enforcement behavior above come from `PLANS`, `PLAN_FACTS` and the metered-usage service in `packages/shared/src/constants/platform-stats.ts` and `server/src/payment/stripe/services/metered-usage.service.ts`, checked 3 September 2026, with the plan prices re-read 31 October 2026. Metronome's acquisition date traces to Stripe's own announcement, and the throughput figure to Confluent's own case study on Metronome's infrastructure, both checked today. One gap remains, and it is worth naming rather than papering over. Metronome, Orb and Chargebee's current dollar pricing is not quoted anywhere above, because their pages could not be reached to re-verify it for this edition. That is deliberate: this post describes each one's pricing model rather than printing a number nobody checked today. [Lago alternatives](/compare/lago-alternatives) and [Stripe Billing alternatives](/compare/stripe-billing-alternatives) carry the rates each of them verified on their own publish day.
---
## Outseta alternatives: what actually replaces the CRM and the help desk
> Most "Outseta alternatives" lists drift into HubSpot and Salesforce, tools Outseta never competed with. Here is what actually replaces its no-code login, paywall and help desk.
- Source: https://www.buildbase.app/compare/outseta-alternatives
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-25
- Updated: 2026-10-22
### In short
Most Outseta alternatives lists mix in generic CRMs like HubSpot, never really what Outseta replaced. The closer no-code peers are MemberSpace and Memberstack, paywall and membership tools for Webflow-style sites without a bundled CRM or help desk. BuildBase fits once the product is a real codebase, not a page builder.
Search "outseta alternatives" and roughly half the results point to HubSpot, Salesforce and Pipedrive. Those are real CRMs, and they are not what anyone paying for Outseta is actually trying to replace.
### The one-paragraph answer
Cost is the most common complaint, and the fix sits close by: MemberSpace and Memberstack gate content and collect payments the same way Outseta does, minus the CRM and help desk, which is also why they tend to read cheaper against a small contact list. A thin CRM is a different complaint entirely. Pair a simpler paywall tool with a real CRM instead - nothing in this post replaces Outseta and HubSpot at once. And if the site has quietly turned into a product with a codebase behind it, BuildBase is built for that shape, though it drops the CRM and help desk too.
### What "Outseta alternative" actually means
Outseta's own pitch is one login for a handful of jobs a no-code SaaS or membership site needs: gated content, subscription billing, a lightweight CRM, email, and a help desk with live chat and tickets, wired into Webflow, Squarespace and Framer through embeddable forms. Most alternatives content ignores that bundle and ranks by whatever review site happens to list Outseta under "CRM software," which is how a search for a no-code paywall tool ends up recommending Salesforce.
The two tools that actually compete for the same reader are MemberSpace and Memberstack. Both live in the same "gate a Webflow site and take payments" category Outseta does. Neither ships a CRM or a help desk, which is the trade every reader leaving Outseta for one of them is making, whether or not the comparison says so out loud.
### Where each one fits
**MemberSpace - the simplest swap for pure content gating.** It plugs into Webflow, Squarespace and other builders the same way Outseta does, and its whole job is member accounts and paywalled pages rather than a wider business toolkit. If the only Outseta features actually in use are the login and the paywall, MemberSpace does that narrower job without the CRM and support-desk weight sitting unused behind it.
**Memberstack - more control over the login itself.** Memberstack leans further into letting a Webflow Designer own the styling of the signup and login modals directly, plus supports more custom logic around gated content than a simpler paywall tool. It is a closer fit for someone who wants member accounts to feel native to their site's design rather than dropped in as a widget.
**BuildBase - once the page builder is the constraint, not the destination.** [Outseta vs BuildBase](/compare/outseta-vs-buildbase) covers this trade in more depth, but the short version: BuildBase assumes code from the start. Auth, subscription billing, [multi-tenant workspaces](/guides/multi-tenant-workspaces-in-an-afternoon) and role-based access ship as `@buildbase/sdk`, called from inside an app you are writing rather than a page you are building. It has no CRM module and no help desk module across its 20 modules - the same gap MemberSpace and Memberstack leave, just on the other side of the no-code line.
| Feature | BuildBase | Outseta |
| --- | --- | --- |
| Integration model | SDK called from your own codebase | Embeddable JS forms plus a REST API |
| No-code page builder support | Not the target use case | Native Webflow integration, works with Squarespace and Framer |
| CRM | Not a module - user and audience management only | Built in, tracks contacts and deals |
| Help desk / support tickets | Not a module | Built in, live chat and tickets |
| Team memberships | Workspaces with per-member roles - a core module | Team mode - multiple users share one membership |
| Auth methods | Built in: email/password, magic link, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC provider, Ethereum and Solana wallets, enterprise SSO (Enterprise plan, through your own WorkOS account) | Email/password and social sign-in via embedded forms |
> **Where Outseta wins:** The bundle itself is the genuine advantage, and none of the three alternatives in this post fully replace it. Outseta is the only one of the four that ships a CRM and a help desk behind the same login as billing and content gating - MemberSpace and Memberstack skip both, and BuildBase has neither in its 20-module catalog either. It also supports Team mode, where several people share one membership, which is closer to how a small B2B customer actually buys than an individual paywall account. If the CRM and the support desk are pulling their weight already, replacing Outseta means adding two more vendors back, not fewer.
### Pricing, as far as it can be verified today
Every price quoted for Outseta, MemberSpace or Memberstack in third-party roundups disagreed with at least one other source we checked while researching this post - not by a rounding error, but by whole tiers. That is the sign to describe the shape instead of a number nobody re-verified against the vendor's own page today.
Outseta prices by contact-list size rather than by seat: a handful of tiers, unlimited team members on each, and a transaction fee that falls as the tier goes up. MemberSpace and Memberstack both price by member count with a similar declining-transaction-fee shape as an account grows. Exact tier prices and fee percentages are deliberately left out here rather than repeated from a roundup: each vendor's own pricing page is the only source current enough to quote.
BuildBase prices differently again: a flat monthly fee against monthly active users rather than contacts or members, with no transaction fee. Free is $0 for 10,000 MAU, Launch is $19/mo for 25,000 MAU, Grow is $49/mo for 100,000 MAU, and Scale is $99/mo for 500,000 MAU - full detail, including workspace and storage allowances, at [/pricing](/pricing). Free has no trial and stops at its allowance; every paid plan starts with a 7-day trial that does not ask for a card. On the paid plans three quotas bill overage: workflow runs at $0.25, $0.15 or $0.10 per 1,000 on Launch, Grow and Scale, web analytics events at $2 per 100,000, and storage at $0.10 per GB-month beyond the plan allowance.
Contact-based or member-based pricing and flat MAU pricing are not comparable line by line. A list-heavy, revenue-light product reads cheaper on the MAU model; a high-revenue product with a short contact list can read cheaper on a percentage-of-revenue model. Whichever shape you are actually comparing against, check the vendor's own pricing page the day you decide - the discrepancies we hit researching this post are the reason, not a hedge.
### How to actually decide
Ask what is actually being used today. If it is the login and the paywall and nothing else, MemberSpace or Memberstack does that narrower job without paying for CRM and help-desk weight sitting idle. If the CRM and the support inbox are load-bearing, none of the three alternatives here are a real swap - the honest move is pairing a simpler paywall tool with a dedicated CRM, which is close to rebuilding what Outseta already bundles, just from separate vendors. And if the site has turned into a product with real users, teams and roles rather than a page with a login on it, that is the point BuildBase starts from, not Outseta's.
We priced what assembling a stack from separate point tools costs in [the real monthly cost of Clerk plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost) - the arithmetic holds whether the vendor list starts with Outseta or something else. Our own numbers live at [/pricing](/pricing); Outseta's, MemberSpace's and Memberstack's live on their own sites, and are worth checking before any of them go into a budget.
---
## Lago alternatives, sorted by what you are actually trying to avoid
> Lago alternatives compared by what they replace: a metering engine now owned by Stripe or Adyen, a subscription specialist, or billing bundled into your own backend.
- Source: https://www.buildbase.app/compare/lago-alternatives
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-24
- Updated: 2026-10-26
### In short
Leaving Lago usually means picking a replacement: Metronome and Orb, now owned by Stripe and Adyen, for deeper usage metering; Chargebee for subscription and dunning maturity; or a bundled platform like BuildBase if billing was never the only integration you needed to replace.
Search "Lago alternatives" and the same five names come back on every list: Stripe Billing, Chargebee, Metronome, Orb, maybe Recurly. What none of those lists mention is that two of the five just changed hands. Stripe closed its purchase of Metronome in January. Adyen closed its purchase of Orb in July. If part of why you are leaving Lago is not wanting your metering engine's roadmap decided by someone else's acquisition, half of the standard answer just became exactly that.
### The one-paragraph answer
If raw metering depth and event throughput is the whole problem, Metronome and Orb are still the deepest tools for it. Just know you are now evaluating a Stripe product and an Adyen subsidiary, not an independent vendor either way. If subscription maturity and dunning tooling at scale is the actual gap, Chargebee is built for that specifically. And if the real reason billing felt like a second job is that you were also going to need auth, workspaces and role permissions from somewhere else anyway, BuildBase bundles all of it into one instance, at the cost of the metering depth a specialist engine gives you.
### What Lago actually is
Lago is an open-core usage-metering and billing engine. The self-hosted open-source edition is free and published under AGPLv3, and it handles event ingestion and seven charge models: standard, graduated, graduated percentage, package, percentage, volume and dynamic, which is the full `charge_model` enum in Lago's own API reference. What it does not include for free is the customer portal or credit notes - those sit behind Lago Premium, and automatic dunning, tax integrations and progressive billing are add-ons on top of it. Premium is sold as managed cloud or self-hosted and priced by talking to sales rather than a public rate card. See [Lago vs BuildBase](/compare/lago-vs-buildbase) if you want the full side-by-side rather than the roundup version here.
### Where each alternative fits
**Metronome - deep metering, now inside Stripe.** Metronome built its name on orchestrating billing for complex usage models, with customers including OpenAI, Anthropic and Nvidia by Stripe's own account. Stripe completed the acquisition on 14 January 2026, reportedly near $1B, and Metronome now operates as part of Stripe rather than as a standalone company.
The metering capability has not gone anywhere. What has changed is who owns the roadmap and, eventually, how it gets bundled with Stripe's own Billing product.
**Orb - deep metering, now inside Adyen.** Orb's pitch was similar to Metronome's: a dedicated engine for translating complex usage contracts into invoices, used by companies like Vercel and Replit. Adyen announced the deal in June 2026 at $335 million in cash and closed it on 1 July. Orb runs today as an Adyen subsidiary under what Adyen calls an incubator model.
Pricing for both Metronome and Orb is quote-only across every tier, so there is no public number to compare here even before the acquisitions - that part has not changed.
**Chargebee - subscription and dunning maturity.** Chargebee's Flow plan is priced against the billing volume you run through it, and unlike Lago Premium the rate card is public: $0 platform fee plus 0.80% of monthly billing value pay-as-you-go, or $99/mo plus 0.65% if you commit monthly, both including 100M usage events a month. Enterprise is quoted by conversation.
The percentage is the part that scales against you. What it buys is depth: Chargebee's dunning and revenue-recovery tooling, plus its quote-to-cash add-ons, go further than anything Lago, BuildBase or a from-scratch Stripe integration ships out of the box.
**Stripe Billing - if you already live on Stripe.** Stripe's own subscription and invoicing layer charges 0.7% of billing volume on top of standard processing fees, with a Meters API for usage-based charges and Smart Retries for automated dunning. The percentage applies to recurring volume billed on and off Stripe, and one-off invoices are excluded.
See [Stripe Billing alternatives](/compare/stripe-billing-alternatives) for the fuller breakdown of that side of the field.
**BuildBase - billing as one module, not one vendor.** The billing module runs on the org's own Stripe account and adds subscription plans with versioning, trials, usage-based and seat-based billing, a credit system with ledger tracking, and per-workspace invoicing - it is not a standalone metering product, it is one of 20 modules in the same instance as auth, workspaces and RBAC.
There is a Free plan with 10,000 MAU that stops at its allowance, and paid plans from $19/mo: Launch covers 25,000 MAU, and Grow and Scale raise every ceiling from there. Every paid plan starts with a 7-day trial that does not ask for a card.
| Feature | BuildBase | Lago |
| --- | --- | --- |
| Self-hosted, free tier | Not free - Docker self-host on a paid plan | Free under AGPLv3, self-hosted |
| Entry paid plan | $19/mo (Launch), flat | Lago Premium, quote-only |
| Charge models | Usage and seats with graduated or volume tiers, add-ons (one-time, lifetime, recurring) and credits, on your own Stripe | Seven models: standard, graduated, package, volume, and more |
| Ownership | Independent (Jagodana LLC) | Independent - unlike Metronome (Stripe) and Orb (Adyen) |
| Scope | 20 modules: billing, auth, workspaces, RBAC, one instance | Billing and metering only |
> **Where Lago wins:** Two things Lago does better, and neither is close.
>
> **Metering throughput.** ClickHouse's own case study on Lago's migration to ClickHouse Cloud describes one customer's ingestion needs approaching a million events per second. Read the top figure as a demonstrated ceiling for one customer rather than a guarantee, but the shape is real - a bundled billing module is not going to out-throughput a system built for exactly this job.
>
> **A genuinely free, source-published self-hosted tier.** Lago's self-hosted edition costs nothing and the code is public under AGPLv3 on GitHub. Lago has stopped branding it the "Community edition" on its own pricing page, but the free self-hosted route is still there, as a "Deploy open source" link straight to the repository. BuildBase's self-hosted option runs on your own infrastructure too, but it is not free and it is not published under an open license - you are paying for the platform either way.
### How to actually decide
Ask what you were actually leaving Lago for. If the honest answer is "I need Premium features and don't want a quote-only price," Metronome and Orb hand you the same problem under a different logo now that both are quote-only subsidiaries of larger payment companies. Chargebee and Stripe Billing at least publish a number, and both of those numbers are a percentage of what you bill - run that rate against [the crossover point where it costs more than a flat plan](/blog/billing-platform-revenue-tax) before assuming either one is cheap at your revenue level.
If the honest answer is "billing was never the only integration I needed," that's the case for a bundled platform, and the tradeoff is giving up the metering depth a dedicated engine gives you in exchange for not building auth, workspaces and RBAC as three more vendor relationships. We priced what that separate-vendor stack costs in [the real monthly cost of Clerk plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost), and what wiring workspaces and RBAC looks like on its own in [multi-tenant workspaces in an afternoon](/guides/multi-tenant-workspaces-in-an-afternoon).
And if the honest answer is "entitlements and packaging experiments are the actual axis, not raw metering throughput," that's a closer fit for [Stigg vs BuildBase](/compare/buildbase-vs-stigg) than for anything else on this page.
Both completion dates above trace to the acquirer's own announcement: Stripe's newsroom post for Metronome, Adyen's press release for Orb. Adyen states its $335 million figure directly; Stripe has not officially disclosed Metronome's deal size, so the ~$1B figure here is a widely reported estimate, not a vendor-confirmed one. Every BuildBase figure comes from `PLANS` and `PLAN_FACTS` in `packages/shared/src/constants/platform-stats.ts`, verified 9 September 2026. The Chargebee and Stripe Billing rates were read off chargebee.com/pricing and stripe.com/billing/pricing, verified 26 October 2026, and neither had moved. Lago's licence was read off its GitHub repository and its charge models off its own API reference on the same date. Percentage pricing moves, so check both before budgeting against them.
---
## Stripe Billing alternatives, sorted by what they actually replace
> Stripe Billing alternatives compared by what they replace: a metering engine like Lago or Orb, a merchant of record like Paddle, or billing bundled into the rest of your backend.
- Source: https://www.buildbase.app/compare/stripe-billing-alternatives
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-23
- Updated: 2026-11-02
### In short
Stripe Billing alternatives split into three shapes: metering engines like Lago and Orb where you stay merchant of record, platforms like Paddle that take over tax and compliance as merchant of record, and bundled options where billing rides on your own Stripe account alongside auth and workspaces.
Every "Stripe Billing alternatives" list on the first page is written by a billing vendor putting itself near the top of its own roundup. That's a conflict of interest hiding in plain sight, and it also skips the question that actually decides which alternative fits: are you replacing the billing engine, or replacing who is legally selling to your customer? Those are different problems, and most of what ranks answers only the first one.
### The one-paragraph answer
Complex usage-based pricing - dimensional charges, prepaid credits - points to Lago or Orb, both billing-layer tools built for exactly that, with your own Stripe account still underneath. Tax and compliance overhead across regions is Paddle's job: it and similar merchant-of-record platforms take that off your plate entirely, at the cost of becoming the seller of record instead of you. Dunning and revenue-recovery sophistication for a subscription business at scale is where Chargebee's add-ons live.
And if the real gap was never billing alone - if auth, workspaces and role permissions were always going to be separate purchases too - BuildBase bundles billing into the same instance, running on the Stripe account you already have. It has none of the automated dunning or revenue-recognition tooling the billing specialists sell as their core product, though.
### What Stripe Billing actually is
Stripe Billing is the subscription and invoicing layer Stripe added on top of its payment processing: recurring plans, usage-based pricing via its Meters API, a customer portal, and automated dunning with machine-learning-optimized retry timing. Its default shape is 0.7% of billing volume on top of standard card-processing fees, so the cost of the billing layer alone scales with how much you invoice - [the crossover math for when that kind of fee costs more than a flat plan](/blog/billing-platform-revenue-tax) shows how fast that scaling adds up. There is a flat-fee escape, but it is a sales conversation rather than a self-serve toggle: a one-year contract at $620, $1,500, $2,950 or $5,750 a month covering up to $100,000, $250,000, $500,000 or $1,000,000 of monthly billing volume, with 0.67% above the cap. If you are reading this page you are almost certainly on the 0.7%. Stripe has changed this pricing shape before, so check stripe.com/billing/pricing before you budget against it.
### Where each alternative fits
**Lago - the open-core metering engine.** Lago's self-hosted edition is free and published under AGPLv3 on GitHub. It handles usage-based billing and event ingestion in more depth than a bundled module attempts, but Lago Premium, offered as managed cloud or self-hosted, is priced by talking to sales rather than a public rate card. See [Lago vs BuildBase](/compare/lago-vs-buildbase) for the full breakdown - that comparison is worth reading directly before assuming a quoted Premium number holds today - or [Lago alternatives](/compare/lago-alternatives) if Lago itself is what you're trying to replace.
**Orb - built for complex usage pricing.** Orb has started publishing a number, which it did not do when this post first ran. Its page now shows two tiers rather than three: Business, self-serve at $6.00 per credit with volume discounts and 100 free credits to test on, and Enterprise by quote. A credit is not a billing-volume percentage, it is consumed across dimensions - billings processed, events ingested - and the page's own FAQ puts one credit at "0.60% of billing volume, plus event ingestion and other metered dimensions" without reconciling that against the $6.00, so the headline is a starting point rather than a bill you can compute. What is public either way is the shape: volume discounts, multi-axis pricing, prepaid credits and threshold billing, aimed at products whose pricing model is itself complicated enough to need a dedicated engine. If Lago's open-core model doesn't fit your deployment preference, Orb is the other name that comes up for the same underlying problem.
**Chargebee - dunning and quote-to-cash at scale.** Chargebee's self-serve billing plan, now named Flow, is priced two ways: pay-as-you-go at 0.80% of monthly billing value with no platform fee, or $99/mo plus 0.65% of monthly billing value. Its own slider marks the crossover at $66,000 of monthly billing value, which is where the platform fee starts paying for itself. Revenue recognition and the growth tooling are separate products with their own quotes, aimed at more complex, contract-heavy billing than a startup's first pricing page. That specialization is real, and it's also the fairness beat below - it's a capability neither BuildBase nor a from-scratch Stripe integration ships out of the box.
**Paddle - merchant of record, tax handled.** Paddle takes over as the legal seller of your product, which means it also takes over sales tax, VAT and GST compliance across every region it operates in, along with fraud protection and chargeback handling. The tradeoff for handing over that surface area is 5% + 50¢ per checkout transaction rather than a flat subscription price, which is the most expensive shape on this page per dollar collected and the only one that buys you out of filing tax returns.
**BuildBase - billing as one module, not one vendor.** BuildBase's billing module runs on the org's own Stripe account and adds subscription plans with versioning, free trials, usage-based and seat-based billing with graduated or volume tiers, add-ons (one-time, lifetime or recurring), a credit system with ledger tracking, and per-workspace invoicing - see [charging per API call in Next.js](/guides/charge-per-api-call-nextjs) for what the usage-based half looks like in a route handler. It's built to replace hand-rolled Stripe wrapper code, not Stripe itself. There's a Free plan at $0 that stops at its allowance rather than billing, and paid plans start at $19/mo for Launch with 25,000 MAU; Grow and Scale raise every ceiling from there. The paid plans open with a 7-day trial that doesn't ask for a card.
The tradeoff for the bundle is depth: none of Stripe's Smart Retries, no dedicated revenue-recognition module, no merchant-of-record option. If billing was the only system you needed replaced, a specialist on this page beats us on that dimension specifically.
| Feature | BuildBase | Stripe Billing |
| --- | --- | --- |
| Scope | 20 modules: billing, auth, workspaces, RBAC, one instance | Billing and invoicing only, part of the Stripe payments platform |
| Payment processor | Runs on the org's own Stripe account | Is the payment processor |
| Pricing shape | Flat monthly/yearly/quarterly plan price | 0.7% of billing volume, plus processing fees |
| Failed-payment recovery | Owner notices and Workflows on a failed payment, a warning 30 days before a card expires, and a retention offer or pause at cancel | Smart Retries - ML-optimized automatic retry timing |
| Auth and workspace RBAC | Included | Not provided - Stripe Billing is billing only |
> **Where Stripe Billing wins:** Stripe Billing ships Smart Retries and automated revenue recognition as part of the same product, and BuildBase has neither. A failed payment in BuildBase fires a workflow event you can react to - send an email, start a dunning sequence yourself - but there's no built-in machine-learning model deciding when to retry a declined card, and no revenue-recognition reporting for teams that need ASC 606-style numbers. If failed-payment recovery at scale or accounting-grade revenue recognition is the actual requirement, that's a real gap in the bundle, not a missing feature we'd frame as a non-issue.
### How to actually decide
The three buckets above are three different maintenance burdens, and picking one means naming which you're actually stuck with. Metering depth means pricing out [Lago vs BuildBase](/compare/lago-vs-buildbase) or getting Orb on a call. If entitlements and packaging experiments are the actual axis rather than raw event throughput, [Stigg vs BuildBase](/compare/buildbase-vs-stigg) is the more relevant comparison. Tax and compliance load means Paddle - no billing-layer tool on this page, BuildBase included, takes that off your plate. And if auth, workspace roles and a workflow engine were always going to be separate purchases too, [the real cost of wiring a stack together yourself](/blog/auth-billing-stack-cost) prices out what that adds up to.
Every vendor figure on this page was read off the vendor's own pricing page and verified 2 November 2026: Stripe Billing at 0.7% of billing volume pay-as-you-go, Chargebee Flow at 0.80% pay-as-you-go or $99/mo plus 0.65%, Paddle at 5% + 50¢ per checkout transaction, and Lago free to self-host under AGPLv3 with Premium quote-only. One figure moved and it moved into existence: Orb published a self-serve price for the first time, $6.00 per credit on a Business tier, where this post previously recorded no public number at all. Percentages move without an announcement, so re-check before you budget. Our own numbers come from `PLANS` in `packages/shared/src/constants/platform-stats.ts`, verified 31 October 2026.
---
## Supabase alternatives: Firebase, Appwrite, Nhost, PocketBase and when none of them are the fix
> Supabase alternatives compared by what they actually replace - the database, the auth layer, or the billing and workspace layer Supabase never had in the first place.
- Source: https://www.buildbase.app/compare/supabase-alternatives
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-22
- Updated: 2026-11-02
### In short
Firebase, Appwrite, Nhost and PocketBase are the direct Supabase swaps - same category, different database tradeoffs, none with built-in billing or workspace roles. If that is the actual gap, BuildBase bundles billing, RBAC and workflows alongside auth in one SDK, against a database you never touch directly.
Every "Supabase alternatives" list sorts by the same axis: relational versus document store, managed versus self-hosted, SQL versus GraphQL. That question matters if the database is what's bothering you. It says nothing if what's bothering you is that Supabase, like every name on these lists, never shipped a billing product or a workspace.
### The one-paragraph answer
Leaving Supabase for a different database shape? Firebase, PocketBase and Appwrite are the honest picks, each trading Postgres for something else - Firestore, embedded SQLite, or a fuller self-hosted stack. Nhost keeps you on Postgres and swaps in Hasura's GraphQL layer instead, which is a narrower bet worth making only if GraphQL was already the plan. None of the four add subscription billing or workspace roles. They replace the database, not what sits above it. If that layer is the actual gap, BuildBase is worth a look for the same reason it belongs on the [Firebase alternatives](/compare/firebase-alternatives) list: 20 modules including billing and per-workspace RBAC, bundled into `@buildbase/sdk`, against a database you never touch directly.
### What Supabase actually leaves you to build
Supabase leaves you to build billing and workspace roles entirely on your own, and every alternative on this list does too. Supabase itself is a managed Postgres instance with auto-generated REST and GraphQL APIs, realtime subscriptions on table changes, and its own auth, storage and edge functions on top. The database is the product - everything else exists to make it easier to reach from a client app. Every alternative here inherits that gap. None of them are SaaS platforms, so a Postgres row has no idea what a subscription plan is. You model billing and workspace membership yourself, then keep that logic in sync by hand, every time the product changes, which is more of a maintenance job than anyone signs up for. See [Supabase vs BuildBase](/compare/buildbase-vs-supabase) for the full breakdown, feature by feature.
### Where each alternative fits
**Firebase - the mobile-first swap.** Firestore trades Postgres rows for a document store, paired with Firebase Auth, Cloud Functions and native client SDKs across iOS, Android, Flutter and Unity. If mobile reach or offline-first sync is the actual requirement, this is the only name on this list built for it - see [the full Firebase comparison](/compare/firebase-vs-buildbase) and the [Firebase alternatives roundup](/compare/firebase-alternatives) for where it sits against the others. Pricing is the Spark free tier or Blaze, which is pure pay-as-you-go metered against Google Cloud rates rather than a monthly plan. It carries the same absence of billing and workspace RBAC that sent you looking in the first place.
**Appwrite - open source, self-hosted from day one.** Appwrite covers database, auth, storage and functions, and its managed cloud runs the same code you'd run on your own servers. That's a direct answer to vendor lock-in - self-host the exact stack you'd otherwise rent, and the hosting bill is whatever your own servers cost. On the cloud side there's a free tier and a paid Pro plan; check appwrite.io for its current price, which its pricing page did not state when we last looked. RBAC and billing don't disappear either way, though. Appwrite hands you the primitives, not the feature.
**Nhost - Postgres plus GraphQL, if that's the stack.** Nhost is the closest like-for-like Supabase swap on this list: managed Postgres, auth, storage and serverless functions, with Hasura's GraphQL layer sitting in front instead of Supabase's own API generator. There's a free Starter tier, and Pro is from $25/mo with $15 of compute credits included and the excess billed per vCPU on top, so the headline price is a floor rather than the bill. Worth choosing over Supabase itself mainly if GraphQL specifically, not REST, is what the team already wants.
**PocketBase - the single-binary option.** PocketBase is a different shape entirely: one self-hosted binary with embedded SQLite, built-in auth, realtime subscriptions and an admin UI, and no managed cloud product at all. It's free because there's no vendor charging for it - your only cost is wherever you run the binary. That also means no roadmap to depend on, and no support line to call when something breaks at 2am. It is still pre-1.0, on v0.41.1 as of 2 November 2026, which is worth knowing before it goes under something that has to stay up.
**BuildBase - when the SaaS layer was the actual gap.** If none of the four above solves the real problem - a paying customer needs a workspace, a workspace needs members, a member needs a role, and a plan change has to update all three at once - that's the layer none of them sell. BuildBase bundles [subscription billing and credit metering](/guides/charge-per-api-call-nextjs), [workspaces with RBAC](/guides/multi-tenant-workspaces-in-an-afternoon), workflow automation and user-facing sign-in by email/password, magic link, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, an OpenID Connect provider of your own, Ethereum and Solana wallets, and enterprise SSO on the Enterprise plan through your own WorkOS account, plus API tokens for server-to-server calls, into `@buildbase/sdk`.
There's a Free plan at $0 for 10,000 MAU, 50 workspaces and 1GB storage, which stops at its allowance rather than billing. Paid plans start at $19/mo for Launch, with 25,000 MAU, 1,000 workspaces and 10GB storage, after a 7-day trial that doesn't ask for a card; Grow and Scale raise every one of those ceilings. PocketBase still costs nothing at all, at any size you can host. Current numbers live at [/pricing](/pricing).
| Feature | BuildBase | Supabase |
| --- | --- | --- |
| Entry price | Free plan, then Launch at $19/mo - 7-day trial without a card | Free tier, then Pro at $25/mo with MAU, disk and storage metered above the included allowance |
| Database | Not a product feature - bring your own | Managed Postgres, direct SQL access |
| Subscription billing | Built in, credit metering included | Not provided - wired to your own Stripe account |
| Workspace RBAC | Built in, roles and permissions per workspace | Not a feature - modeled in your own schema |
| Self-hostable | Proprietary SaaS, self-hosted deployment available | Self-hostable end to end (see Fairness note below) |
| Realtime | Real-time Slack alerts on events; audience segments update periodically | Realtime subscriptions on raw table changes |
| Auth methods | Built in: email/password, magic link, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC provider, Ethereum and Solana wallets, enterprise SSO (Enterprise plan, through your own WorkOS account) | Email, magic links and social providers on your own Postgres row |
> **Where Supabase wins:** Three things Supabase does that BuildBase genuinely does not, and none are close calls. Supabase gives you a real Postgres instance you can run arbitrary SQL against, install extensions on and connect any Postgres client to. BuildBase exposes no database to query directly - everything goes through the SDK instead. Self-hosting is the second one. Supabase is open source and self-hostable from the ground up, database included. BuildBase offers a self-hosted deployment instead, but the platform itself stays proprietary. Realtime is the third: Supabase streams row-level changes straight from Postgres to a client, where BuildBase's realtime story is event-based Slack alerts, not a live feed of your data. Want any of those three? Supabase is built for it and we are not.
### How to actually decide
Match the alternative to the gap you actually hit, not the one every roundup assumes. Want a different database shape - document store, embedded SQLite, or GraphQL over Postgres? Firebase, PocketBase and Nhost answer that directly, and Appwrite adds a fuller self-hosted stack to the same question. Want to remove the vendor entirely and own the infrastructure? Appwrite or PocketBase, depending on how much stack you want to run yourself. And if the real gap was never the database - if it was that a paying customer needed a workspace, a role, and a subscription that stayed in sync, and Supabase was never going to give you any of the three - that's what [Supabase vs BuildBase](/compare/buildbase-vs-supabase) and [the real cost of stitching a stack together yourself](/blog/auth-billing-stack-cost) go into in more detail than a roundup like this one can.
Every competitor figure above was read off the vendor's own pricing page and verified 2 November 2026: supabase.com/pricing, firebase.google.com/pricing, appwrite.io/pricing and nhost.io/pricing. Nothing this post leans on had moved: Supabase Pro still starts at $25/mo, Nhost Pro still at $25/mo with compute on top, Appwrite still prints no price for the Pro plan its own FAQ refers to, and Firebase still splits into the no-cost Spark tier and pay-as-you-go Blaze. PocketBase publishes no pricing at all, because it ships as a self-hosted binary rather than a paid product; it was on v0.41.1 the day this was checked, still short of 1.0. All four of the paid ones meter something above the headline plan - MAU, compute, storage or egress - so treat the monthly number as a floor and check the page yourself before you budget against it. Supabase in full detail is in [Supabase vs BuildBase](/compare/buildbase-vs-supabase), and Firebase in [Firebase vs BuildBase](/compare/firebase-vs-buildbase).
---
## Firebase alternatives, sorted by what you are actually replacing
> Firebase alternatives compared by what they actually replace - the database, the auth layer, or the SaaS layer Firebase never had in the first place.
- Source: https://www.buildbase.app/compare/firebase-alternatives
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-21
- Updated: 2026-11-02
### In short
Supabase replaces Firestore with Postgres; Appwrite self-hosts the stack and now offers Postgres too. Neither adds subscription billing or workspace RBAC, because Firebase never had those either. If that is the gap, the shortlist changes: BuildBase bundles billing and per-workspace roles alongside auth in one SDK.
Most "Firebase alternatives" lists sort by database. Document store or Postgres, managed or self-hosted, and then a feature grid comparing reads and writes. That sorts for the wrong question if the reason you are looking is not Firestore at all - it is that Firebase never shipped a billing product, never modeled a workspace, and never had a concept of a role.
### The one-paragraph answer
If you are leaving Firebase because you want a relational database, self-hosting, or a more open license, Supabase and Appwrite are the honest picks - both replace Firestore and Firebase Auth directly, one managed on Postgres and one self-hostable end to end.
But if the client SDK reach or realtime sync was never the point, and what you actually needed was subscription billing, per-workspace roles and a workflow engine wired to the same auth, that is a different shortlist - and it is one Supabase and Appwrite do not answer either. They replace the database, not the SaaS layer sitting above it. BuildBase belongs on that second list, not as a Firebase clone but as a narrower, more opinionated bet: 20 modules including billing and RBAC, in one SDK, against a data model that already knows what a workspace is.
### What Firebase actually leaves you to build
Firebase is Google's mobile and web backend: Firestore for data, Firebase Auth for identity, Cloud Functions for logic, Hosting for static assets, with Crashlytics, Google Analytics and Remote Config bundled in. Every one of the alternatives below inherits the same shape of gap, because none of them are SaaS platforms either - they are backend-as-a-service, the same category Firebase made mainstream. Firestore has no concept of a subscription plan or a workspace member. You model both yourself, in security rules and Cloud Functions, and you keep that logic in sync by hand every time the product changes. See [Firebase vs BuildBase](/compare/firebase-vs-buildbase) for the full breakdown of what that costs against a bundled SDK, feature by feature.
### Where each alternative fits
**Supabase - the direct Firestore-and-Auth swap.** Supabase pairs a real Postgres database with its own auth service, storage and realtime layer, on a free tier that includes 50,000 monthly active users, plus paid plans that scale with MAU and compute. If the appeal of leaving Firebase is a relational database you can query with SQL instead of security-rule gymnastics, or infrastructure you can eventually self-host, this is the closest like-for-like swap on this list. It still has no native subscription billing or workspace RBAC - see [Supabase vs BuildBase](/compare/buildbase-vs-supabase) for the pricing detail and where that gap shows up in practice. Leaving Supabase itself rather than Firebase? The [Supabase alternatives roundup](/compare/supabase-alternatives) covers the same ground - Firebase, Appwrite, Nhost and PocketBase - from the other direction.
**Appwrite - open source, self-hosted from day one.** Appwrite covers the same ground as Firestore and Firebase Auth - database, auth, storage, functions - and its managed cloud runs the same software you would run on your own servers. That is a direct answer to the complaint Firebase itself invites: if you are worried about being tied to one vendor's pricing and roadmap, self-hosting the exact stack you would otherwise pay for removes the question entirely. Its serverless tier carries no fixed fee and bills per use. One allowance is now printed, $10 of compute credits a month for database usage, but the read and write quotas are still shown as a plan limit with an overage and no number attached, including in the compare-plans table. Since this post first ran, Appwrite has added a managed Postgres product you reach over the ordinary Postgres wire protocol with psql or an ORM, rather than through an Appwrite SDK, which retires the neat shorthand that Supabase is the relational pick and Appwrite the document one. How finished it is depends which Appwrite page you read: the databases overview labels PostgreSQL beta, while the Postgres product page prints no stage at all. Treat it as beta and confirm before you build on it. The tradeoff is that subscription billing and workspace roles are no more a product here than they are in Firebase - Appwrite gives you the primitives to build them, not the feature itself.
**Nhost - Postgres plus GraphQL, if that is the stack.** Nhost bundles a managed Postgres database behind Hasura's GraphQL layer, with auth, CDN-backed storage, and functions alongside it. It is a narrower bet than Supabase - you are opting into GraphQL as the query interface rather than choosing it later - but for a team that already wants Hasura, it collapses "database plus GraphQL API plus auth" into one bill instead of three.
**BuildBase - when the SaaS layer was the actual gap.** If none of the above solves the real problem - a paying customer needs a workspace, a workspace needs members, a member needs a role, and a plan change needs to update all three at once - that is the layer none of these tools sell, ourselves included in the "database" sense, since we are not one. BuildBase bundles [subscription billing and credit metering](/guides/charge-per-api-call-nextjs), [workspaces with RBAC](/guides/multi-tenant-workspaces-in-an-afternoon), workflow automation and user-facing sign-in by email/password, magic link, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, an OpenID Connect provider of your own, Ethereum and Solana wallets, and enterprise SSO on the Enterprise plan through your own WorkOS account, plus API tokens for server-to-server calls, into `@buildbase/sdk`.
There is a Free plan with 10,000 MAU, and paid plans from $19/mo: Launch covers 25,000 MAU, 1,000 workspaces and 10GB storage, and Grow and Scale raise every one of those ceilings. The paid plans start with a 7-day trial that does not ask for a card. Current numbers live at [/pricing](/pricing).
| Feature | BuildBase | Firebase |
| --- | --- | --- |
| Database | No general-purpose database - Collections stores custom schemas, read by slug over a token-authenticated REST API | Firestore, document store with realtime listeners |
| Subscription billing | Built in, credit metering included | Not provided - you wire up your own payment provider |
| Workspace RBAC | Built in, roles and permissions per workspace | Not a feature - modeled in Firestore security rules |
| Self-hostable | Proprietary SaaS, self-hosted deployment available | Not currently - Google-managed only |
| Mobile / native client SDKs | Web-focused: Next.js, Vite, React Router / Remix, TanStack Start, Express, NestJS, Fastify, Hono, Astro | iOS, Android, Flutter, Unity, C++, Web |
| Realtime data sync | Not a product feature | Firestore realtime listeners with offline support |
> **Where Firebase wins:** Two things Firebase does better than every alternative on this page, BuildBase included, and neither is small. Its client SDKs cover Apple, Android, Flutter, Unity and C++ on top of the web - if you are shipping a mobile app or a game, that platform reach is not something a Postgres swap or a bundled SaaS SDK replicates. And on Apple, Android and web, Firestore caches the data your app is actively using so the app keeps working offline, then syncs local changes back when the device reconnects. Worth being precise there, because the offline story is easy to read more into than Firebase actually claims. The docs say persistence is supported "only in Android, Apple, and web apps", so it follows the platform rather than the framework: a Flutter app gets it on Apple, Android and web, and the offline pages say nothing at all about Unity or C++. On the web it runs in Chrome, Safari and Firefox only. And when two clients edit the same document, Firebase's own words are "last write wins", with no merge strategy on offer. Even so, that is the part of offline-first software most teams get wrong on a first attempt. If your product's core value is mobile reach or live collaborative data, stay on Firebase - this post is about what to reach for once that is no longer the deciding factor.
### How to actually decide
Match the alternative to the gap you actually hit, not the one every roundup assumes. If it is the database - you want SQL, or you want the option to self-host - Supabase or Appwrite replace Firestore directly, and now that both can put Postgres under you, the choice between them is how much of the stack you want to run yourself rather than relational versus document. Want GraphQL specifically? Nhost is worth a look before the other two. And if the real gap was never the database at all - if it was that a paying customer needed a workspace, a role and a subscription that stayed in sync, and Firebase was never going to give you any of the three - that is the question [Firebase vs BuildBase](/compare/firebase-vs-buildbase) and [the real cost of stitching a stack together yourself](/blog/auth-billing-stack-cost) answer in more detail than a roundup like this one can.
Exact dollar figures for Firebase and Supabase are deliberately left out of the body above - re-check them in [the full Firebase comparison](/compare/firebase-vs-buildbase) and [Supabase vs BuildBase](/compare/buildbase-vs-supabase), each of which carries its own verification date against the vendor's own pricing page. Every competitor figure in this post was read off the vendor's own pricing page and verified 2 November 2026: supabase.com/pricing, appwrite.io/pricing, nhost.io/pricing and firebase.google.com/pricing. No price or quota this post leans on had moved: Supabase still includes 50,000 monthly active users on its free plan, Firebase Auth still includes 50,000 on Spark, Appwrite's dedicated databases still read from $10/mo per database, Appwrite still prints the $10 monthly compute credit for database usage, and Appwrite still does not print a price for the Pro plan its own FAQ refers to. The PostgreSQL stage is unresolved: the databases overview says beta, the product page says nothing. Firebase's page splits Firestore into Standard and Enterprise editions, so a quota you look up there has to be read against the right one. Nhost prints Pro as from $25/mo with $15 in compute credits included and the excess billed past them, so treat the headline as a floor rather than the bill, and note that compute is priced separately per vCPU core, $15 a month shared or $50 dedicated. Read appwrite.io/pricing and nhost.io/pricing directly before you budget against either. Firestore's per-operation rate is not on Firebase's own pricing page even in the linked comparison, since it defers to Google Cloud pricing, which sets reads, writes, deletes and storage by location - Firebase's own billing doc says exactly that, which is why no per-operation figure appears anywhere in this post.
---
## Auth0 alternatives: the point-solution trap nobody mentions
> Every Auth0 alternatives list compares login boxes. The cost nobody counts is the three or four other tools you still have to stitch on separately.
- Source: https://www.buildbase.app/compare/auth0-alternatives
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-20
- Updated: 2026-10-22
### In short
Most Auth0 alternatives - WorkOS, Clerk, SuperTokens, Kinde - are just other identity providers, swapping one login box for another. The harder question is whether you also need separate billing, workspace and workflow tools, or whether one platform can replace more of the stack at once.
Search "auth0 alternatives" and every result compares the same thing: login boxes. Okta versus Cognito versus Clerk versus WorkOS, ranked by MAU pricing and SSO connectors. Nobody asks the question that actually decides it for most teams leaving Auth0, which is whether auth was ever the only tool they were paying for separately.
### The one-paragraph answer
If your complaint is that enterprise SSO pricing punishes you for having customer volume rather than enterprise customers, look at WorkOS - it separates the free consumer-scale tier from a per-connection charge for SSO and directory sync, so you pay for the enterprise buyers you actually have. If the complaint is that Auth0's integration surface means weeks of custom sign-in UI, Clerk's prebuilt components are the direct answer. If the real objection is vendor lock-in and unpredictable per-user cost as you scale, SuperTokens' open-source core lets you self-host the same code that runs in its managed cloud. If you want the free tier that includes the most rather than the one with the highest ceiling, with MFA and B2B organizations in the box rather than gated behind a paid plan, that's Kinde. And if the honest answer is that auth was never the only separate tool - that billing, workspaces and workflow automation were always going to be their own line items too - BuildBase replaces more of that stack in one instance, though its MFA is not the range of factors Auth0 ships, and its enterprise SSO (SAML and OIDC) is on its Enterprise plan only, through your own WorkOS account, where Auth0 includes a connection on its free plan.
### What actually drives people to look
Auth0's pricing runs on monthly active users, and the jump from the free tier to the first paid plan is where most complaints start. The free plan covers 25,000 monthly active users, but the paid ladder does not begin where it ends - paid plans are quoted from 500 MAU, at $35 a month for B2C Essentials and $150 for B2B Essentials. What that same plan costs at your real user count is a different number entirely, and it is the one worth checking before you plan around the free tier. The features a growing SaaS needs next sit behind that jump too: MFA factors are not on the free plan at all, enhanced attack protection starts at Professional, and enterprise connections beyond the first one included free are a paid tier or a per-connection charge. A private cloud deployment goes further still, into a custom-quoted enterprise tier with no published number.
None of that is unique to Auth0. It's the standard shape of MAU-metered identity pricing, and every alternative in this post prices some version of the same trade-off differently. The difference is _where_ each one draws the line between what's free, what's metered, and what's a separate add-on - and that is the actual comparison, not "which vendor is cheaper." The numbers in this post were checked against each vendor's page on the day it shipped, and they will move; the shape of the trade is the part that lasts.
### Where each alternative fits
**WorkOS - unbundling the enterprise-SSO tax.** WorkOS's core auth product (AuthKit) is free for the first 1M monthly active users, and enterprise features are priced separately, at $125 per SSO or directory-sync connection per month for the first fifteen, rather than folded into a single MAU-based jump. The shape is the point: a team serving a handful of enterprise customers pays for a handful of connections, not for crossing a company-wide user threshold. This is the pick if your actual complaint is that Auth0 charges you for total user volume when the feature you need is really about a small number of enterprise buyers.
**Clerk - the integration-time complaint, directly.** Clerk ships prebuilt, brandable sign-in, sign-up and user-management components, plus an organizations model with SAML and OIDC enterprise connections. The free Hobby plan covers 50,000 monthly retained users and Pro is $25 a month carrying the same 50,000, with one enterprise connection included and additional ones from $75 a month each. If the actual cost you're trying to cut is engineering weeks spent building custom auth UI around Auth0's APIs, this is the alternative that answers it, at the cost of being more opinionated about how your frontend is structured.
**SuperTokens - the lock-in complaint.** SuperTokens' core, covering email/password, passwordless, social login and session management with token rotation, is open source. The managed cloud and a self-hosted deployment run the same code, so choosing managed now doesn't forfeit the option to self-host later. Some features are metered add-ons even when self-hosted: MFA is $0.01 per monthly active user against a $100 monthly minimum, and multi-tenancy is quoted rather than published. Read that line before assuming self-hosting removes cost entirely rather than shifting it to infrastructure and add-on fees.
**Kinde - the most included on the free plan.** Kinde's free ceiling is the lowest of the four here at 10,500 monthly active users, with Pro at $25 a month above that. What it bundles into that plan is the point: MFA and B2B organizations are both in it rather than gated behind a paid tier, which is a direct answer to the complaint that Auth0's free and early paid plans hold back the security features a growing product actually needs. Kinde also includes subscription billing in the same product, which is worth noting for the next section.
| Feature | BuildBase | Auth0 |
| --- | --- | --- |
| Scope | 20 modules: auth, billing, workspaces, workflows, RBAC, one instance | Identity and access management, plus adjacent security tooling |
| Enterprise SSO / SAML | Not offered on Launch, Grow or Scale; Enterprise plan, via your own WorkOS account | 1 free, 3 from B2B Essentials, none on B2C paid |
| MFA | Authenticator app with backup codes, or text-message codes | Available - not on the free plan, paid tiers only |
| Compliance certification | GDPR-ready, CCPA-ready (not independently certified) | Audited SOC 2 and ISO 27001, via parent Okta |
| Free plan | Free up to 10,000 monthly active users; paid plans have a 7-day trial, no card | Free up to 25,000 monthly active users |
| Billing and workspaces | Included as separate modules in the same instance | Not offered - a separate purchase |
### The point-solution trap
Every option above, Auth0 included, is still answering one question: who logs in. None of them touch what happens after that - how you bill the account, how you isolate one customer's data from another's, what fires when a trial converts or a payment fails. Teams on Auth0 are usually also running a separate billing integration, a homemade or third-party multi-tenancy layer, and some workflow tool stitching the two together, because none of the identity-focused alternatives above are trying to be those things either.
That's a real trade, not a knock on any of them - a team that only needs identity gets a more focused product from a specialist. But if the reason you're evaluating alternatives is a broader one, that auth was never the only separate vendor relationship you were maintaining, it's worth pricing the consolidated option alongside the identity swap, not after it. [The real cost of stitching Clerk, Stripe and Lago together](/blog/auth-billing-stack-cost) walks through what that math looks like when you count every tool, not just the login box. And if the alternative on the table is skipping every vendor and building login yourself, [what that costs in engineer-hours](/blog/cost-of-building-auth-yourself) is the other side of the same math.
> **Where Auth0 wins:** Auth0 is covered by Okta's SOC 2 and ISO 27001 certifications, audited by a third party and listed on Okta's security trust page. BuildBase has neither audit; it is GDPR-ready and CCPA-ready, which are readiness claims, not certifications. Auth0 also ships enterprise SSO and SAML on its self-serve plans. BuildBase has SSO only on its Enterprise plan, through your own WorkOS account, and its MFA is an authenticator app with backup codes, with text-message codes as a weaker option. If your buyer's security team requires an audited certificate on file, or your product needs SAML-based enterprise sign-in today without a custom plan, use Auth0 or WorkOS, which is built specifically around that connection model.
### How to actually decide
Match the alternative to the complaint you actually have, not the one most "Auth0 alternatives" posts assume. If it's the enterprise-SSO pricing shape, [WorkOS vs BuildBase](/compare/workos-vs-buildbase) covers WorkOS's per-connection model against a bundled instance in more depth. If integration time on the UI side is the real cost, Clerk's prebuilt components are worth pricing against the engineering weeks they save - see [Clerk alternatives](/compare/clerk-alternatives) for how Clerk itself gets evaluated by people leaving other providers. And if the honest answer is that auth, billing and workspaces were always going to be three separate purchases, not one, [Auth0 vs BuildBase](/compare/auth0-vs-buildbase) is the direct head-to-head rather than the roundup.
Every figure above was read off each vendor's own pricing page and verified 19 October 2026: auth0.com/pricing, workos.com/pricing, clerk.com/pricing, supertokens.com/pricing and kinde.com/pricing. Identity pricing moves faster than most software pricing - Auth0 put SCIM and a first enterprise connection on its free plan partway through writing this - so check the source page before you commit a budget to any of them.
---
## Clerk alternatives: which complaint each one actually fixes
> Clerk's 2026 pricing raised the free tier, added per-organization metering to the B2B add-on and left the UI lock-in alone. Which alternative fixes which complaint, and where BuildBase fits.
- Source: https://www.buildbase.app/compare/clerk-alternatives
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-19
- Updated: 2026-10-26
### In short
Clerk raised its 2026 free tier but left the real complaints standing: a B2B bill that grows with every customer org past 100, and UI components wired deep enough into your app that leaving means a rewrite. WorkOS, Supabase, SuperTokens and Kinde each fix one specifically; this covers which and where BuildBase fits.
Clerk raised its free tier to 50,000 monthly retained users this year. Every "Clerk alternatives" post written before that update is now arguing against a version of Clerk that does not exist anymore - which means the shortlist most people are reading is answering the wrong complaint.
### The one-paragraph answer
If your complaint is what Clerk charges for B2B organizations, look at WorkOS - AuthKit is free to the first million monthly active users, and enterprise features are priced per connection, so you pay for the enterprise customers you have rather than for every customer org you sign up. If your complaint is that Clerk's prebuilt UI components and middleware are wired too deep into your app to leave easily, SuperTokens is the direct answer, because the same code runs self-hosted. If you want auth bundled with the Postgres database you are probably already running, that is Supabase. If you want the most generous free tier with billing and B2B orgs already included, that is Kinde. And if the real gap was never just auth - if it was auth plus billing plus workflows plus RBAC all needing to agree with each other - BuildBase replaces more of the stack at once, though it does not ship the UI kit Clerk is known for, and its SSO is on its Enterprise plan only, through your own WorkOS account.
### What actually changed
Most "Clerk alternatives" content still argues from the old pricing shape: a low free-user ceiling that made Clerk feel expensive the moment a product got real traction. That argument does not hold anymore. As of our last check on Clerk's own pricing (verified 26 October 2026, see [the full breakdown](/compare/clerk-vs-buildbase)), the free Hobby plan covers 50,000 monthly retained users, Pro is $25 a month and Business $300 a month, all three carrying the same 50,000 included before overage kicks in at $0.02 per extra user.
What changed for B2B is the part that actually drives people to look elsewhere. The enhanced B2B add-on is still $100 a month ($85 billed annually), now covering all of your applications, and Clerk also meters organizations: 100 monthly retained organizations are included per app, and each one after that is $1 a month. A team serving five customer orgs pays the add-on and nothing more; a team serving five hundred pays the add-on plus about $400 a month. Enterprise connections are billed on top of both - one included per app on Pro and Business, $75 a month each for connections 2 to 15, $60 each from 16 to 100, and a conversation past that. And Clerk's UI components and session middleware are genuinely good, which is exactly why they are hard to leave - the sign-in flow, the org switcher, the session handling are all wired into your app in a way a simple SDK swap does not undo.
### Where each alternative fits
**WorkOS - the B2B organizations tax.** WorkOS unbundles "enterprise readiness" from the core product. AuthKit is free for the first 1M monthly active users, then $2,500 a month per additional million, and the enterprise pieces are metered as you turn them on: SSO and directory sync are each $125 per connection per month for the first 15, sliding to $100 at 16-30, $80 at 31-50 and $65 at 51-100, with custom pricing past that, and audit log streaming is $125 a month per SIEM connection. The shape is the point. You pay for the enterprise customers you actually have, where Clerk charges for every customer organization past the first 100, enterprise or not.
**Supabase - "I already have Postgres."** Supabase treats auth as one feature of a full backend: database, storage, realtime and edge functions on the same plan. The free plan covers 50,000 monthly active users, Pro is $25 a month with 100,000 included and $0.00325 per MAU after that, and Team is $599 with the same allowance. If the appeal of leaving Clerk is consolidating onto infrastructure you already run rather than adding another point vendor, this is the shape that fits, and it is open enough to self-host if that matters later. If Postgres itself is not the settled part yet, the [Supabase alternatives roundup](/compare/supabase-alternatives) is worth reading before you commit to it as the destination.
**SuperTokens - the lock-in complaint, directly.** SuperTokens' core is open source. The managed cloud and the self-hosted version run the same code, so choosing the managed option now does not forfeit the option to self-host later if the pricing or the relationship stops working. Managed cloud is free to 5,000 MAUs and $0.02 per MAU beyond that; self-hosting the core carries no MAU ceiling and no licence cost. Read the add-on line before you assume self-hosting is free, though: MFA is $0.01 per MAU and account linking $0.005 per MAU, each with a $100 monthly minimum, which is a real floor at small scale. This is the pick for the reader whose actual objection to Clerk is "I do not want my auth logic living inside someone else's components again."
**Kinde - the generous-free-tier pick.** Kinde's free plan includes 10,500 MAUs, B2B organizations and subscription billing, rather than charging a separate add-on for either, which is a direct answer to Clerk's organizations charges. It takes a cut of each transaction if you bill customers through it: 0.7% on Free and Pro, 0.6% on Plus and 0.5% on Scale. Paid plans are Pro at $25, Plus at $75 and Scale at $250, all with the same 10,500 MAUs included. The unbundled-SSO claim holds up on Kinde's own page: enterprise connections are capped at one on Free and Pro, then unlimited at no additional cost from Plus ($75) upward. That is the sharpest single contrast in this post, because on Clerk every connection after the first is billed on its own, from $75 a month. See [Kinde vs BuildBase](/compare/buildbase-vs-kinde) for how it compares to a bundled SDK rather than to Clerk specifically.
| Feature | BuildBase | Clerk |
| --- | --- | --- |
| Scope | 20 modules: auth, billing, workflows, RBAC, one instance | Auth and user management, billing via your own Stripe account |
| B2B organizations | Included | $100/mo enhanced B2B add-on, plus $1/mo per organization past 100 per app |
| Enterprise SSO / SAML | Not offered on Launch, Grow or Scale; Enterprise plan, via your own WorkOS account | 1 connection included per app on Pro and Business, then from $75/mo each |
| Prebuilt UI components | Not a focus - bring your own UI against the SDK | Extensive prebuilt React/Next.js components |
| Framework support | Next.js, Vite, React Router / Remix, TanStack Start, Express, NestJS, Fastify, Hono, Astro | Next.js, React, Vue, Nuxt, Expo/React Native, and more |
> **Where Clerk wins:** Clerk's prebuilt UI components are the best in this category, and that is not a small thing. The sign-in and sign-up flows, the org switcher, the user profile screen - they drop into a Next.js app in minutes and look finished immediately, which is a real head start every one of the alternatives in this post, BuildBase included, asks you to build more of yourself. If fastest time-to-first-login is what you are optimizing for and you are not yet running into the organizations pricing or the lock-in it creates, Clerk is still a genuinely good choice, and this post is not an argument that everyone should leave.
### How to actually decide
Match the alternative to the complaint you actually have, not the one everyone else is writing about. If it is cost at your current B2B shape, price out [WorkOS vs BuildBase](/compare/workos-vs-buildbase) side by side with WorkOS's own connection-based model. If it is "I don't want to be locked into anyone's components again," SuperTokens' open-source core solves that more directly than any hosted vendor can. If the honest answer is that auth was never the only piece you were short - that billing and workspaces and workflow automation were always going to be separate purchases too - [Clerk vs BuildBase](/compare/clerk-vs-buildbase) and [Supabase vs BuildBase](/compare/buildbase-vs-supabase) cover that comparison from two different starting points, Clerk's and Supabase's.
Every figure above was read off each vendor's own pricing page and verified 26 October 2026: clerk.com/pricing, workos.com/pricing, supabase.com/pricing, supertokens.com/pricing and kinde.com/pricing. Nothing had moved since the September check; the only correction was to how this post described Clerk's own SSO connection tiers, which step from $75 to $60 at 16 connections and go to a quote past 100. Auth pricing moves faster than most software pricing, and Clerk's own 2026 change is the proof, so check the source page before you commit a budget to any of these.
---
## Outseta vs BuildBase: no-code toolkit or an SDK you own
> Outseta bundles no-code signup, billing, CRM and a help desk for Webflow and Squarespace sites. BuildBase is an SDK for auth, billing, workspaces and RBAC inside your own product. Where each one fits.
- Source: https://www.buildbase.app/compare/outseta-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-18
- Updated: 2026-10-26
### In short
Outseta bundles signup, billing, a CRM and a help desk into one no-code login for Webflow, Squarespace and Framer sites, with no first-party SDK. BuildBase is an SDK: auth, billing, workspaces, RBAC and workflows as code in your own product, with no bundled CRM. Pick by page builder or codebase.
Outseta and BuildBase both promise to replace a pile of vendors with one login. They are not competing for the same reader.
Outseta is built for someone assembling a site in Webflow or Squarespace who needs signup, billing and a CRM without writing a line of backend code. BuildBase is built for someone already writing a product who wants auth, billing, workspaces and permissions to be code they own, not forms embedded on top of a page. Confuse the two and you land in one of two bad spots. Either you pay for a no-code layer you will fight to customize, or you write your own auth from scratch when a form embed would have shipped the same afternoon.
### The one-paragraph answer
If you are launching on Webflow, Squarespace or Framer and want gated content, subscriptions and a lightweight CRM live today, use Outseta. It is purpose-built for exactly that, and no amount of custom code beats an embed you can drop into a page builder this afternoon. If you are already writing a product in Next.js or another React web framework and want auth, billing, RBAC and workflows as part of your own codebase, not a widget sitting on top of it, that is what BuildBase is for. Neither one is trying to be the other.
### Where each one fits
Outseta replaces the stack a no-code founder would otherwise stitch together by hand: a payment page, a members-only content gate, an email tool, and a lightweight CRM to track who signed up and why. It plugs into Webflow directly and hands you embeddable JavaScript forms for everything else, which is the right shape for a team that is not writing backend code at all.
BuildBase replaces the stack a developer would otherwise wire together: OAuth and session handling, Stripe subscriptions and [usage metering](/guides/charge-per-api-call-nextjs), multi-tenant workspaces, and role-based permissions, shipped as `@buildbase/sdk` and called from inside your own app. Nothing renders on your page unless you build the component that calls it. That is slower on day one and it is also why AgentCenter and PlugNode, two of our own products, can add a new billing rule or a new role without touching a third-party embed anywhere in the flow.
### Feature comparison
| Feature | BuildBase | Outseta |
| --- | --- | --- |
| Integration model | SDK called from your own codebase | Embeddable JS forms plus a REST API |
| No-code page builder support | Not the target use case | Native Webflow integration, works with Squarespace and Framer |
| CRM | Not a module - user and audience management only | Built in, tracks contacts and deals |
| Help desk / support tickets | Not a module | Built in, live chat and tickets |
| Email marketing | Email Campaigns module, drip sequences via Workflow Automation | Built in, part of the same login |
| Auth methods | Built in: email/password, magic link, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC provider, Ethereum and Solana wallets, enterprise SSO (Enterprise plan, through your own WorkOS account) | Email/password and social sign-in via embedded forms |
| Multi-tenant workspaces and RBAC | Workspaces is a core module, RBAC an additional one - both built in | Not the product - single-account CRM model |
> **Key takeaway:** Outseta and BuildBase overlap on almost nothing except the pitch. On one side,
> a no-code site gets a CRM, a help desk and a payment form in one login. On the
> other, a real codebase gets auth, billing, workspaces and RBAC it can extend.
> Where they overlap - billing and basic sign-in - is a small slice of what
> either product actually does.
### Pricing, verified 26 October 2026
BuildBase has four published plans: Free at $0, Launch at $19/mo, Grow at $49/mo and Scale at $99/mo, plus a custom Enterprise tier. Free covers 10,000 monthly active users, has no trial and stops at its allowance. Every paid plan starts with a 7-day trial, and none of them require a card. On the paid plans three quotas bill overage: workflow runs at $0.25, $0.15 or $0.10 per 1,000 on Launch, Grow and Scale, web analytics events at $2 per 100,000, and storage at $0.10 per GB-month beyond the plan allowance.
Outseta prices by contact-list size rather than by seat, with unlimited team members on every tier and a transaction fee that falls as you move up. It renamed and rebuilt its tiers since this post first ran, so the shape below is worth re-reading even if you priced it earlier in the year. Start is $47/mo for up to 1,000 contacts at a 2% transaction fee. Scale is $127/mo for 10,000 and Pro $247/mo for 25,000, both at 1%, and Max is $897/mo for 100,000 contacts with no transaction fee at all. Billing yearly brings those to $37, $97, $197 and $697 a month, which the page advertises as around 25% off.
The two models are not comparable line by line, and that is the useful part. Outseta bills against how many contacts you hold and, on every tier but the largest, takes a cut of what you charge them. We bill a flat monthly fee against monthly active users, with no transaction fee, so what you charge your customers is not our business. Which is cheaper depends entirely on whether your list is big and your revenue small, or the reverse. Check outseta.com/pricing before you commit either way, because a screenshot of a pricing page is stale the moment a vendor changes it - the tier rename above is exactly that happening.
> **Where Outseta wins:** Two things Outseta does that BuildBase flatly does not.
>
> **A built-in CRM and help desk.** Outseta tracks contacts and deals and handles support tickets and live chat, all behind the same login as billing and content gating. BuildBase has no CRM module and no ticketing module in its 20-module catalog - if you need those, you are adding a separate tool either way.
>
> **Zero-code deployment on a page builder.** Native Webflow integration plus forms that work on Squarespace and Framer mean a non-developer can have paid membership live on a marketing site in an afternoon. BuildBase assumes you are writing code from the first step; there is no page-builder path at all.
### How to actually decide
Ask where your product lives. If it is a Webflow site and the person building it is not writing backend code, Outseta's embed-and-go model wins outright - you would be reinventing a CRM and a payment gate to compete with it, and that is a bad trade. If Outseta itself is the problem rather than the no-code approach, [the wider Outseta alternatives roundup](/compare/outseta-alternatives) covers MemberSpace and Memberstack, both closer no-code peers than BuildBase is. Flip the scenario and the answer flips too. When your product is a real codebase and the reader signing up needs a role, a workspace and a permission set that means something to your application logic, an embedded form cannot express any of it - you are back to writing the glue code yourself the moment you outgrow it.
We priced what that glue code costs when you assemble it from point tools instead in [the real monthly cost of Clerk plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost) - the same math applies whether the vendor list starts with Outseta or something else. And if workspaces and role-based access are the part you are trying to avoid building by hand, [here is what that looks like wired up in an afternoon](/guides/multi-tenant-workspaces-in-an-afternoon).
Our numbers live at [/pricing](/pricing). Outseta's live on their own site - check both before you commit, because a bundled tool changes its tiers about as often as we change ours.
---
## Lago vs BuildBase: a billing engine or the whole backend?
> Lago is a deep, open-source usage-metering and billing engine. BuildBase bundles billing with auth, RBAC and workspaces. Where each one actually fits.
- Source: https://www.buildbase.app/compare/lago-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-17
- Updated: 2026-10-26
### In short
Lago is an open-source billing engine: free to self-host, seven charge models, built for real scale. BuildBase bundles billing with auth, RBAC and workspaces as one instance. If metering depth is the whole problem, Lago wins it. If billing is one of several systems you still have to build, the bundle is cheaper.
Every "Lago alternatives" post on the first page compares Lago against
[Stripe Billing](/compare/stripe-billing-alternatives), Chargebee, Orb,
Metronome, the rest of the metered-billing field. We ran our own pass at that
same field, including the two acquisitions most of those lists still haven't
caught up to, in [Lago alternatives](/compare/lago-alternatives). None of them
ask the question that actually matters to a team wiring billing into a new
product: are you buying a billing engine, or trying to avoid building the four
systems that sit next to it?
Lago answers the first question extremely well. BuildBase is built around the
second.
### The one-paragraph answer
Lago is a dedicated billing and metering engine, open source, and free to
self-host. If usage metering is your hard problem - complex charge models,
high-volume event ingestion, invoicing you want full control over - Lago is
built for exactly that and does it deeper than a bundled module ever will. If
your actual problem is that billing is the fourth or fifth vendor you're about
to add next to auth, workspaces and RBAC, BuildBase ships all of it as one
instance, and the cost of stitching those pieces together is what you're
really paying when you pick point solutions one at a time.
### What each one replaces
Lago replaces the billing engine specifically: Stripe's usage-based limits,
or a hand-rolled events table and a cron job that reconciles it monthly.
Nothing else. You still bring your own auth, your own workspace model, your
own RBAC.
BuildBase replaces more of the stack around billing, not instead of it.
Subscriptions, trials, credits and usage metering sync to Stripe the same way
Lago's does, but it sits inside a platform that also ships authentication
(from passwords and passkeys to social, phone and wallet sign-in, and enterprise SSO on the Enterprise plan), multi-tenant workspaces, role-based permissions and
workflow automation.
Twenty modules, one SDK, one instance - a quota belongs to a workspace, a
workspace has members, and that relationship is not glue code you write
yourself.
### Pricing and openness, verified 26 October 2026
Lago's open-source edition is free, self-hosted, and published under AGPLv3 on
GitHub. The paid product is Lago Premium, offered as managed cloud or
self-hosted, and priced by talking to sales rather than by a public rate card.
| Feature | BuildBase | Lago |
| --- | --- | --- |
| Self-hosted, free tier | Not free - Docker self-host on a paid plan | Free under AGPLv3 |
| Entry paid plan | $19/mo (Launch) | Lago Premium, quote-only |
| Trial | 7 days on paid plans, no card required | Not published for Lago Premium |
| Charge models | Usage and seats with graduated or volume tiers, add-ons (one-time, lifetime, recurring) and credits, on your own Stripe | Seven models: standard, graduated, package, volume, and more |
| Scope | 20 modules, one instance | Billing and metering only |
BuildBase has a Free plan now: $0, 10,000 monthly active users, and it stops at
its allowance rather than billing. The paid plans start with a seven-day trial
with no card needed. Neither is the same offer as Lago's free self-hosted
edition, which has no allowance to stop at: you run it, you pay for the
servers.
### Where the models actually diverge
Lago exists to be the best possible billing engine, full stop, and that focus
shows in the charge-model list. Standard, graduated, graduated percentage,
package, percentage, volume and dynamic - seven ways to shape a price, as the
`charge_model` enum in Lago's own API reference lists them, versus BuildBase's
usage-based and seat-based billing riding on top of Stripe's own pricing
primitives.
If your pricing model is genuinely unusual, Lago gives you more knobs. The
same question shows up one comparison over: if entitlements and packaging
experiments are the actual hard part rather than raw metering throughput,
[Stigg's pricing layer goes deeper on that specific
slice](/compare/buildbase-vs-stigg) than either of us.
What Lago does not give you is the rest of the product. Metering has to know
who the user is, which workspace they belong to, and whether their role even
allows the action being metered. That's three systems Lago assumes you already
have.
We built [the metering module](/guides/charge-per-api-call-nextjs) to answer
straight into [workspaces and RBAC](/guides/multi-tenant-workspaces-in-an-afternoon)
for exactly this reason. PlugNode, one of our own products, runs its usage-based
credit metering on top of BuildBase auth and team workspaces with RBAC
already in place - the meter never has to ask a second system who the user
is or what they're allowed to do. Bolt a metering engine on after the fact
and you're wiring that question yourself, every time, for every product.
> **Where Lago wins:** Two things Lago does better, and they're not close.
>
> **Metering depth and scale.** ClickHouse's March 2026 case study on Lago's
> migration to ClickHouse Cloud describes moving from 10,000-20,000 events per
> second to a claimed one million. It is a vendor case study, so read the top
> number as a ceiling rather than a guarantee - but the shape is real. That is a
> purpose-built ingestion pipeline, and a bundled billing module is not going to
> out-throughput a system whose entire job is ingesting metering events.
>
> **A genuinely free tier with the source published.** Lago's self-hosted
> edition costs nothing and the code is public under AGPLv3. BuildBase's
> self-hosted option runs on your own infrastructure too, but it does not ship
> under an open license, and it is not free - you're paying for the platform
> either way.
### How to actually decide
Ask what breaks first. If it's "our pricing model is too complex for a
standard usage-based charge," that's a Lago problem, and you should go build
on the tool whose only job is solving it.
If it's "we need billing, and also auth, and also workspaces, and also a way
to tell who's allowed to see what," that's four separate integrations sitting
behind four separate vendor relationships, and the cost of wiring them
together is the number nobody puts on a pricing page. We priced one version of
that stack in
[the real monthly cost of Clerk plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost).
Our numbers live at [/pricing](/pricing). Lago's self-hosted edition lives on
GitHub, and Lago Premium lives behind a sales conversation - check both
before you commit, because neither one sits still for long.
---
## Firebase vs BuildBase: primitives or a SaaS backend
> Firebase gives you auth, Firestore and hosting free to start. Here is what it does not bundle - billing, RBAC, workspaces - versus BuildBase.
- Source: https://www.buildbase.app/compare/firebase-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-15
- Updated: 2026-10-22
### In short
Firebase is Google BaaS: Firestore, Auth, Cloud Functions and Hosting, free to start and strong for mobile and realtime apps. It has no built-in subscription billing, workspace RBAC, or workflow automation. BuildBase bundles those into one SDK, trading Firebase mobile reach for a backend already wired together.
Firebase will get an app talking to a database in an afternoon. It will not tell you who owns that data once two people are paying for it.
### The one-paragraph answer
If your app is mobile-first, needs offline sync, or you just want a database and auth working before lunch, Firebase is the right tool - its client SDKs cover iOS, Android, Flutter, Unity and the web, and Firestore's realtime listeners are a genuinely hard problem it has already solved. If your app is a SaaS product with paying customers, teams, and roles, Firebase hands you the primitives and leaves the SaaS part to you: no subscription billing, no workspace RBAC, no workflow engine. BuildBase starts one layer up, with those already wired to the same auth and data model.
### What each one actually is
Firebase is Google's mobile and web app platform: Firestore for data, Firebase Auth for identity, Cloud Functions for backend logic, Hosting for static assets, plus Crashlytics, Analytics and Remote Config bundled in. It's infrastructure primitives with client SDKs across five platforms - the pitch is "build your backend out of these pieces," and for a huge range of apps that pitch works.
BuildBase is narrower in scope and more opinionated about the shape of the result. It bundles user-facing sign-in by email/password, magic link, email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, an OpenID Connect provider of your own, Ethereum and Solana wallets, and enterprise SSO on the Enterprise plan through your own WorkOS account, plus API tokens for server-to-server calls, [workspaces with RBAC](/guides/multi-tenant-workspaces-in-an-afternoon), subscription billing and [credit metering](/guides/charge-per-api-call-nextjs), workflow automation, and transactional email - 20 modules total, running against `@buildbase/sdk` in one instance. A subscription belongs to a workspace, a workspace has members, a member has a role. That relationship is already modeled; in Firebase you write it.
Where this actually bites: the day a Firebase app needs "team A pays for team A's usage, and team A's admin can invite team B's contractor with read-only access." Firestore has no concept of a workspace or a plan. You build both in security rules and Cloud Functions, and you keep them in sync by hand every time the product changes.
### Pricing, as far as it can be verified today
Firebase is pay-as-you-go past a free tier; BuildBase is flat per plan. That's the shape of the difference, and it matters more than any single rate.
Firebase's two tiers are Spark and Blaze. Spark is free, with fixed quotas: 1 GiB of Firestore storage, 50K document reads, 20K writes and 20K deletes per day, 50K monthly active users on Auth, and 10 GB of Hosting storage with 360 MB/day of transfer. Blaze keeps those allowances at no cost and bills only past them, Hosting at $0.026/GB stored and $0.15/GB transferred. There's no seat price. The bill scales with usage.
One wrinkle on the Firestore line. Those read and write numbers are the Standard edition row, and Firebase now prints a second row for Enterprise edition that counts the same budget in units rather than documents: 40K write units and 50K read units per day, plus 50K real-time update units. So a Firestore quota you find quoted in an older comparison may not be the row your project is actually on. Check which edition you picked before trusting the number.
File storage is the exception, and this post had it wrong in its first version: it listed 5 GB of Cloud Storage among the Spark quotas. That has not been true since September 2024, nearly two years before this post went up, so call it our error rather than a price change. Cloud Storage for Firebase requires Blaze even for a default bucket. A Spark project has no bucket access at all, and Firebase's own documentation is blunt about what that looks like in practice: calls return 402 or 403. So the moment your product stores a user avatar, you are on a billing plan, not on the free tier until you outgrow it.
The rate depends on when the bucket was made. Buckets created before September 2024 (`PROJECT_ID.appspot.com`) keep their original no-cost level of 5 GB stored and 1 GB/day downloaded, then bill at $0.026/GB stored and $0.12/GB downloaded. Anything provisioned since (`PROJECT_ID.firebasestorage.app`) follows Google Cloud Storage rates, with 5 GB-months of storage and 100 GB/month of downloads at no cost. Read that second allowance twice before assuming the change was a downgrade: 100 GB a month is far more headroom than 1 GB a day, so a new project on a download-heavy app is better off than a legacy one. The catch is regional. Those no-cost quotas apply only in `us-central1`, `us-west1` and `us-east1`, so a bucket in Europe or Asia pays from the first byte.
Firestore's per-operation rates are the one figure Firebase doesn't print on its own pricing page: it defers to Google Cloud pricing, where reads, writes, deletes and storage are priced per region. Check those for the region you'd actually deploy in rather than trusting a number from a blog post, this one included. (Quotas and rates above verified against firebase.google.com/pricing on 1 October 2026, and the Cloud Storage plan requirement against Firebase's own FAQ for the September 2024 storage changes.)
Free is $0 (10,000 MAU, 50 workspaces, 1GB storage, 2 team members) with no trial, and it stops at its allowance rather than billing. Launch is $19/mo (25,000 MAU, 1,000 workspaces, 10GB storage, 3 team members), Grow is $49/mo (100,000 MAU, 25,000 workspaces, 50GB, 8 members), Scale is $99/mo (500,000 MAU, 100,000 workspaces, 200GB, 50 members), and the paid plans start with a 7-day trial that doesn't ask for a card. Three lines bill over on the paid plans: workflow runs at $0.25, $0.15 or $0.10 per 1,000 on Launch, Grow and Scale, web analytics events at $2 per 100,000, and storage at $0.10 per GB-month beyond the plan allowance - MAU, emails and webhook deliveries are hard allowances that don't bill over. Current numbers live at [/pricing](/pricing).
Worth sitting with before the rest of this post: Spark's 50K free monthly active users is five times what our Free plan includes and twice what Launch includes. If MAU is the number that decides this for you, Firebase wins it outright and nothing below changes that.
| Feature | BuildBase | Firebase |
| --- | --- | --- |
| Free tier | Free: 10,000 MAU; paid plans start with a 7-day trial, no card required | Spark: free - 50K MAU, 50K reads/day, 1 GiB Firestore |
| Pricing model | Flat per-plan: a Free plan, paid plans from $19/mo (Launch) | Blaze: pay-as-you-go per operation past Spark quotas |
| Subscription billing | Built in, credit metering included | Not provided - wired to your own Stripe account |
| Workspace RBAC | Built in, roles and permissions per workspace | Not a feature - modeled in Firestore security rules |
| Workflow automation | Built in workflow module | Not provided - built from Cloud Functions triggers |
| Mobile / client SDKs | Web-focused: Next.js, Vite, React Router / Remix, TanStack Start, Express, NestJS, Fastify, Hono, Astro | iOS, Android, Flutter, Unity, Web |
| Realtime data sync | Not a product feature | Firestore realtime listeners with offline support |
> **Where Firebase wins:** Two things Firebase does better, and they're not small.
>
> **Client SDK and platform reach.** Firebase ships native SDKs for iOS, Android, Flutter and Unity, on top of the web. If you're shipping a mobile app or a game, that reach is not something you replicate by picking a different backend - our SDK is web-focused ([Next.js](/guides/buildbase-on-nextjs), [Vite](/guides/buildbase-on-vite), [React Router / Remix](/guides/buildbase-on-react-router), [TanStack Start](/guides/buildbase-on-tanstack-start), [Express](/guides/buildbase-on-express), [NestJS](/guides/buildbase-on-nestjs), [Fastify](/guides/buildbase-on-fastify), [Hono](/guides/buildbase-on-hono) and [Astro](/guides/buildbase-on-astro)) and we do not cover native mobile.
>
> **Realtime, offline-first data sync.** Firestore's realtime listeners handle conflict resolution and reconnect-sync automatically - the two parts of offline-first software most teams get wrong on the first attempt. We have no equivalent product. If your app's core feature is live collaborative data or offline-first sync, that's Firebase's problem to solve, not ours.
### How to actually decide
If the product is mobile-native, or its core value is realtime or offline data sync, start with Firebase - fighting its strengths to get a SaaS shape out of it costs more than the SaaS features you'd be adding. If the product is a web SaaS app where customers pay for seats or usage, and you already know you'll need workspaces, roles and a workflow engine that reacts to billing events, those pieces cost real engineering time to build correctly on Firestore. BuildBase starts with them already connected. If Firestore itself isn't the deciding factor, [the wider Firebase alternatives roundup](/compare/firebase-alternatives) sorts Supabase, Appwrite and Nhost by what each one actually replaces. [Supabase vs BuildBase](/compare/buildbase-vs-supabase) is the closer comparison if a Postgres-backed BaaS is also on your list, and [the real monthly cost of stitching Clerk, Stripe, Lago and Knock together](/blog/auth-billing-stack-cost) is worth reading if you're pricing out what "just add billing to Firebase" actually costs once you count every piece.
We keep our numbers in one place at [/pricing](/pricing). Check Firebase's own pricing page before you commit - usage-based pricing changes with load, not just with a vendor announcement.
---
## WorkOS vs BuildBase: what you still need to buy after SSO
> WorkOS handles enterprise SSO and SCIM well, but leaves billing, workspaces and email to other vendors. Here is how BuildBase compares.
- Source: https://www.buildbase.app/compare/workos-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-15
- Updated: 2026-10-23
### In short
WorkOS is a developer-focused identity platform built for enterprise SSO, SCIM sync and audit logs. It does not include billing, workspaces or email - teams pair it with Stripe. BuildBase bundles auth, billing, workspaces, RBAC, workflows and email in one SDK, and its own SSO runs on WorkOS, on its Enterprise plan.
Most WorkOS comparisons stop at the login screen, because WorkOS is very
good at exactly that screen. The question worth asking is what a B2B SaaS
team is still assembling around it once SSO works.
WorkOS answers one part of a SaaS backend better than almost anyone. It was
never trying to answer the rest, and the rest is where a second, third and
fourth vendor bill shows up.
### The one-paragraph answer
Pick WorkOS on its own if an enterprise buyer is asking for SAML or SCIM this
quarter and identity is the only system you are missing. Pick BuildBase if
auth is one of several systems you still need - billing, workspaces, roles,
quota enforcement - and you would rather run one instance than add WorkOS on
top of Stripe on top of your own permissions code and [keep all of it in
sync](/blog/auth-billing-stack-cost) by hand. On BuildBase's Enterprise plan
the SSO is still WorkOS, connected to your own account, so the enterprise
part of the bill is WorkOS's either way.
### What each one actually is
WorkOS is a developer-focused identity platform built around one problem:
getting a B2B app to enterprise-ready authentication fast. SSO, SCIM
directory sync, audit logs, and a self-serve Admin Portal that lets a
customer's own IT team configure their SSO connection without WorkOS or your
team in the loop. It is narrow by design, and the depth shows in exactly the
area it targets.
BuildBase is the opposite shape. Twenty modules ship as one instance
behind `@buildbase/sdk` - authentication, billing and subscriptions,
workspaces, role-based access, workflow automation, email. Its sign-in
methods are built in: email and password, magic links, email and phone
codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, an OpenID
Connect provider of your own, Ethereum and Solana wallets, and enterprise SSO,
plus API tokens for server-to-server calls. If the full 20-module bundle is more than you want,
[Kinde sits in between](/compare/buildbase-vs-kinde) - auth with billing
bolted on, short of a whole backend.
The eighth is where the two products meet. BuildBase's enterprise SSO (SAML
and OIDC) and Directory Sync (SCIM) are on its Enterprise plan only, and they
run through your own WorkOS account: BuildBase verifies the customer's domain,
sends their IT admin a setup link into WorkOS's Admin Portal, signs their
people in through WorkOS, and keeps workspaces and roles in step with their
directory. WorkOS bills each connection to you, on top of the BuildBase plan.
> **Key takeaway:** WorkOS optimizes for enterprise identity done right. BuildBase optimizes for
> not needing five vendors to ship the rest of a SaaS product - and when you
> need enterprise SSO on it, that part is WorkOS too.
### Where the two overlap, and where they do not
Both handle sign-in for a B2B app. WorkOS's User Management product covers
email and social sign-in the same way BuildBase's authentication module
does, and both exist as one piece of a larger platform rather than the whole
product.
The overlap ends there, though less completely than it did in August. WorkOS
still has no native subscription billing - the commonly reported pattern is
pairing it with Stripe, and WorkOS now ships its own Stripe add-ons to make
that pairing less manual. Seat counts and entitlements sync across; plans,
invoicing, dunning and tax stay in Stripe. There is no multi-tenant workspace
model past "Organizations", no workflow automation for your own application
logic, and no transactional or campaign email beyond the auth flow itself.
Each of those is a vendor you add, a bill that scales on its own axis, and an
integration that has to agree with WorkOS about who the user is.
Roles are the claim worth correcting. An earlier edition of this post said
WorkOS stopped at organization membership. It does not. AuthKit ships custom
roles scoped to an organization, with named permissions you reference in code
by slug, assignable through SCIM or directory groups, plus a separate
fine-grained authorization product alongside. If RBAC alone were the reason you
were reading this, that gap has closed.
That is not a flaw in WorkOS. It chose depth on one problem over breadth
across many, the same tradeoff [Auth0](/compare/auth0-vs-buildbase) and
[Clerk](/compare/clerk-vs-buildbase) make - WorkOS just specializes further,
into the enterprise-SSO slice specifically rather than identity broadly.
### Comparing the shape of each product
| Feature | BuildBase | WorkOS |
| --- | --- | --- |
| What you get | Auth, billing, workspaces, RBAC and workflows on one instance | Enterprise SSO, SCIM directory sync, audit logs, Admin Portal |
| Enterprise SSO / SAML / SCIM | Not offered on Launch, Grow or Scale; Enterprise plan, via your own WorkOS account | Core product, self-serve Admin Portal for customer IT admins |
| Subscription billing | Built in: plans, credits, usage quotas | Not included; Stripe add-ons sync seats and entitlements |
| Multi-tenant workspaces | Built in | Basic "Organizations" concept, not a full workspace model |
| Permissions / RBAC | Built in, org- and workspace-scoped roles | Custom org-scoped roles and permissions |
| Email | Built in: Google, Mailgun, custom SMTP | Not included |
| Pricing | Free $0, Launch $19/mo, Grow $49/mo, Scale $99/mo | Free to 1M MAU; SSO/SCIM from $125/connection |
### Pricing
Our numbers are published and simple: a Free plan at $0, then Launch at $19 a
month, Grow at $49 and Scale at $99, each with more monthly active users,
workspaces and storage than the last. The paid plans start with a 7-day trial
that does not ask for a card.
Full details are at [/pricing](/pricing).
WorkOS's User Management product, AuthKit, is free for the first 1M monthly
active users, and that includes email and password, social login, passkeys,
MFA and magic auth. Worth stating without a hedge: at the scale most
products actually run at, the auth line on a WorkOS bill is zero, and we
have no answer to that number. Our Free plan stops at 10,000 MAU, and Launch
is $19 a month for 25,000.
The million is a cliff, not a slope. Cross it and AuthKit is $2,500/mo for
each additional 1M MAU, which is worth modelling before you grow into it
rather than after.
What WorkOS mostly bills for is the enterprise part. SSO and SCIM directory
sync are priced per customer connection, and the published bands step down
with volume: $125 each for the first 15, $100 from 16 to 30, $80 from 31 to
50, then $65 from 51 to 100. Past a hundred connections it is quoted custom.
Audit logs price separately again: $125/mo per SIEM streaming connection, and
$99/mo per 1M events retained. There is still no published platform fee,
though a custom domain runs $99/mo and the Scale support tier is $1,000/mo.
(Every WorkOS figure on this page verified against workos.com/pricing on
6 October 2026.)
So the bill tracks how many enterprise logos you land far more than how much
your product is used - until the MAU line catches up with you. That is a
reasonable trade if enterprise SSO is the thing selling the deal. Fifteen
connections at $125 is $1,875 a month, and if those fifteen are enterprise
contracts, that is not the line item anyone is arguing about. It is a stranger
one if most of your customers never ask for SSO at all, because what you pay
for is the connections you hold open, not what your product does. On
BuildBase's Enterprise plan, SSO runs through your own WorkOS account, so
WorkOS bills those connections to you directly.
> **Where WorkOS wins:** **Enterprise SSO and SCIM, done by specialists.** This is WorkOS's entire
> reason to exist, and it shows - which is why ours is built on it rather than
> beside it. On BuildBase it is an Enterprise-plan feature that needs your own
> WorkOS account as well. If a buyer's security team is asking for SSO or SCIM
> this quarter and the rest of your stack is already settled, WorkOS on its own
> is one vendor where we are two, and it wins that deal outright.
>
> **A self-serve Admin Portal, included free.** WorkOS gives a customer's own
> IT admin a portal to configure their SSO or SCIM connection directly, without
> your team or WorkOS's in the loop for routine setup. It ships in every
> account at no extra charge, with setup paths written per identity provider -
> Okta, Entra ID, ADFS, OneLogin, PingFederate, JumpCloud and a long tail
> beyond them. That catalog is the part nobody mentions when they estimate
> building this themselves. BuildBase did not rebuild it: its setup link opens
> the same WorkOS portal, so the provider coverage is WorkOS's, not ours.
### If you are choosing between them
The tell is whether an enterprise security questionnaire is already on your
desk. If it is, and SAML or SCIM is a checkbox you cannot skip, WorkOS
solves that specific problem either way - on its own, or under BuildBase's
Enterprise plan with your own WorkOS account. The real question is whether
you also want billing, workspaces and permissions from the same place.
If you are earlier than that - building the product, still deciding on
[workspaces](/guides/multi-tenant-workspaces-in-an-afternoon) and roles, not
yet fielding enterprise security reviews - WorkOS gets you enterprise-ready
identity you may not need for another year, and leaves billing, workspaces
and permissions as separate problems regardless. [Charging per API
call](/guides/charge-per-api-call-nextjs) or [enforcing usage
quotas](/guides/enforcing-quotas-in-react) on top of WorkOS means building
that layer from scratch either way.
If you landed here comparing WorkOS against several options rather than just
us, [Clerk alternatives](/compare/clerk-alternatives) covers WorkOS alongside
Supabase, SuperTokens and Kinde, each mapped to the specific complaint it
answers.
---
## Kinde vs BuildBase: which parts of the stack do you actually replace?
> Kinde is auth with billing attached. BuildBase is a backend with auth attached. The difference decides which one fits.
- Source: https://www.buildbase.app/compare/buildbase-vs-kinde
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-14
- Updated: 2026-10-19
### In short
Kinde replaces your auth provider and adds billing on top. BuildBase replaces auth, billing, metering, workspaces, RBAC and workflows as one instance. If you need SSO for an enterprise buyer this quarter without a custom plan, pick Kinde. If you are about to wire four vendors together, the bundle wins.
Most "X vs Y" auth posts compare login screens. That is not the decision. The
decision is how many vendors you are going to own the integration between, and
for how long.
Kinde and BuildBase both claim to be more than auth. They mean different things
by it.
### The one-paragraph answer
Kinde is an auth provider that added billing. BuildBase is a backend that
includes auth. If your next problem is "an enterprise buyer wants SAML", pick
Kinde and move on - ours is on the Enterprise plan only, through a WorkOS
account of your own. If your next problem is "I need
metering, quotas, workspaces and RBAC and I am about to buy four things", the
bundle is the cheaper path, and the rest of this post is about why.
### What each one replaces
Kinde replaces [Auth0](/compare/auth0-vs-buildbase) or
[Clerk](/compare/clerk-vs-buildbase), and takes some of Stripe's job with its
billing features. You keep your database, your background jobs, your
notification provider, your metering.
BuildBase replaces more of the middle. Authentication (passwords, passkeys,
email and phone codes, social and wallet sign-in, and enterprise SSO on the Enterprise plan), workspaces with membership and RBAC, subscriptions and credit metering,
workflow automation, email. It ships as `@buildbase/sdk` against one instance,
so the pieces already know about each other. A quota belongs to a workspace, a
workspace has members, a member has a role, and none of that is glue you write.
A bundle is only cheaper if you would have bought the pieces anyway. Need auth
and nothing else, and you are paying for surface you will never use.
### Pricing, verified 19 October 2026
Kinde publishes its numbers, which is more than most of this category manages.
Free is $0 with 10,500 MAU. The paid ladder runs Pro at $25 a month, Plus at
$75, and a Scale plan at $250 that has appeared since we first wrote this. The
MAU allowance does not grow as you climb: it is 10,500 on every tier. Past it,
Pro charges $0.0175 per extra user and Scale $0.0151.
Two lines on that page are newer than this post. Organizations are metered now.
A paid plan includes 50 monthly active organizations and Pro charges $0.50 for
each one after that, though an organization with a single active user is not
counted. Billing through Kinde also costs a cut of every customer transaction:
0.7% on Pro, 0.5% on Scale.
Our side comes out of the repo rather than a web page. Free is $0 with 10,000
monthly active users, Launch is $19 a month, Grow $49, Scale $99. The paid
plans start with a 7-day trial that does not ask for a card. Current numbers
live at [/pricing](/pricing).
| Feature | BuildBase | Kinde |
| --- | --- | --- |
| Free tier | $0, 10,000 MAU | $0, 10,500 MAU |
| Entry paid plan | $19/mo (Launch) | $25/mo (Pro) |
| Per extra MAU | Not MAU-priced | $0.0175 (Pro) |
| Enterprise SSO | Not offered on Launch, Grow or Scale; Enterprise plan, via your own WorkOS account | 1 connection free, unlimited on Plus |
| Scope | 20 modules, one instance | Auth plus billing |
The detail worth noticing is that users on paid subscriptions are not counted as
MAU. Bill your users through Kinde and the MAU meter mostly stops mattering,
with the transaction fee taking its place. Good decision. It removes the usual
reason auth costs surprise people at scale.
### Where the models diverge
Per-active-user pricing is the category default, and BuildBase does not use it.
Not for the sake of being different: MAU is a poor proxy for what a metered
product costs to run. Take a workflow tool where 50 users each trigger 10,000
runs a month. On MAU pricing that account is free. In compute it is not.
That gap is why the metering module exists. If your product charges per run or
per API call, the meter has to be the same system that enforces the quota and
bills the overage. The shape of that is in
[charging per API call in Next.js](/guides/charge-per-api-call-nextjs), and it
is one call. Wiring a separate metering vendor to a separate billing vendor to a
separate auth vendor is where the weeks go.
> **Where Kinde wins:** Where Kinde wins, and none of it is small.
>
> **Enterprise SSO.** Kinde ships SAML and enterprise connections on its
> self-serve plans. Ours is on the Enterprise plan only, and runs through a
> WorkOS account you pay per connection. If an enterprise buyer has SSO on their
> security review and you want it this month on a self-serve plan, this
> comparison is already over and Kinde wins it. One connection is included even
> on Free, and Plus makes them unlimited.
>
> **Maturity and funding.** Kinde is a funded company with a larger team and
> more production mileage than we have. If vendor risk is high on your list,
> that is a real consideration and you should weigh it honestly.
>
> **Focus.** Auth is Kinde's product, not one module out of 20. Breadth costs
> depth, and on any single module that is a price we pay and they do not.
### How to actually decide
Make a list of the systems you expect to need in the next twelve months. Not the
ones you want. The ones a customer will make you build.
If that list is "auth, and maybe subscriptions", Kinde is the better tool, and
price will not settle it: both start free, with Kinde's Pro at $25 against our
Launch at $19. If the list runs to
workspaces, roles, metered billing, quota enforcement and event-driven
workflows, you are choosing between one instance and four vendors, and the
integration cost of the four is the number nobody puts on the comparison page.
We added up one version of that stack in
[the real monthly cost of Clerk plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost).
And if there is no codebase in that list at all - if the plan is a page builder
like Webflow rather than a repo - neither Kinde nor BuildBase is the right
comparison; see [Outseta vs BuildBase](/compare/outseta-vs-buildbase) instead.
Whichever way that goes, re-check both sets of numbers on the day you commit.
Ours are at [/pricing](/pricing).
---
## Stigg vs BuildBase for usage-based billing
> Stigg goes deep on entitlements, credits and usage enforcement. BuildBase bundles metering into a whole backend. Which one you need depends on what else is missing.
- Source: https://www.buildbase.app/compare/buildbase-vs-stigg
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-14
- Updated: 2026-10-22
### In short
Stigg is a dedicated entitlement, credits and metering layer that sits alongside your existing billing, auth and database. BuildBase includes metering, quotas and subscriptions inside a backend that also does auth, workspaces and RBAC. Stigg goes deeper on entitlements; BuildBase means fewer systems to wire together.
Every usage-based billing comparison eventually reaches the same question: is
pricing a product in your stack, or a feature of something bigger?
Stigg's answer is that it is a product. Ours is that it is a feature. So does
a third: [Lago answers it by being nothing but
metering](/compare/lago-vs-buildbase), deeper than either of us on that one
axis and narrower everywhere else. All three answers are defensible and they
suit different teams.
### The one-paragraph answer
Pick Stigg if pricing itself is the thing you iterate on: multiple packages,
frequent packaging changes, entitlements that need to be modelled precisely, and an
existing stack you are happy with. Pick BuildBase if metering is one of several
systems you still have to build, and you would rather have quotas that already
know what a workspace and a role are.
### What each one is
Stigg is a usage and entitlement layer. It holds the model of what each
customer, user or AI agent is allowed to do, meters what they actually use, and
enforces both through their SDK, with credits and wallets on top. You keep
Stripe, your auth and your database exactly as they are.
It used to be fair to describe Stigg as entitlements sitting on top of someone
else's metering. That is no longer true. They ingest and aggregate usage events
themselves now, so the overlap with our metering module is direct rather than
adjacent.
BuildBase includes metering inside its credits module, one of 20 modules on a
single instance. Usage is recorded against a workspace, the quota is checked
in the same call, and the subscription that defines the quota lives in the same
system as the workspace and its members.
The practical difference shows up in the wiring. In Stigg's model, a quota check
has to know which customer this request belongs to, which means your auth system
and Stigg agree on an identifier and you maintain that agreement. In ours, the
workspace is already the unit.
### Pricing, verified 19 October 2026
Stigg bills on two meters. The first is managed entities: any customer, user,
agent or team that Stigg makes an enforcement decision for. The second is usage
events, the raw metering volume.
Build is free with 10,000 managed entities and 5 million usage events a month.
Pro is $399 a month billed annually, or $499 month to month, with the same
10,000 entities and 25 million events included and graduated pricing above
both. Scale is custom. BYOC, which runs Stigg in your own VPC with no event
billing, is custom too, from $40,000 a year.
Our side comes out of the repo rather than off a web page. Free is $0, Launch
is $19 a month, Grow $49, Scale $99. The paid plans start with a 7-day trial
that does not ask for a card. Current figures live at [/pricing](/pricing).
| Feature | BuildBase | Stigg |
| --- | --- | --- |
| Free tier | Free plan: 10,000 MAU, stops at its allowance | Build: 10K entities, 5M events/mo |
| Entry paid plan | $19/mo (Launch) | Pro: $399/mo annual, $499 monthly |
| Billing unit | A plan, not per event | Managed entities plus usage events |
| Self-hosted option | Yes, see /self-hosted | BYOC from $40K/yr |
| Scope | Metering inside a backend | Entitlements, credits and metering |
The row that matters is the billing unit, not the entry price. Stigg's bill
tracks two things you do not fully control: how many entities it enforces for
and how many events you send it. Ours is a plan. We meter usage, which is what
`bb.usage.record` does, but what you pay for does not move with the events you
meter through it. Three of our own quotas bill over on the paid plans: workflow
runs (from $0.25 per 1,000), web analytics events ($2 per 100,000) and storage
($0.10 per GB-month). Which of those you want depends on whether your own
revenue moves with usage too.
### The integration question
Here is the part that decides it for most teams, and it is not about features.
A dedicated entitlement layer is one more system that needs to agree with your
auth about who the customer is, with your database about what a workspace is,
and with Stripe about what was sold. Three agreements you maintain. That is
completely fine when pricing is complex enough to deserve its own product, and
it is overhead when it is not.
Bundled metering removes those agreements by removing the boundary. The cost is
that you get our model of entitlements rather than a richer one.
> **Where Stigg wins:** **Entitlement depth.** This is Stigg's whole product and it shows. Complex
> packaging, add-ons, credit wallets, feature-level entitlements, and a new
> tier or feature shipped without a deploy. If pricing is something you change
> every month, we do not match that and I would not pretend otherwise.
>
> **It works with what you have.** Stigg does not ask you to move your auth or
> your database. Adopting it is additive. Adopting a bundle is a bigger
> decision, and reversing it is harder.
>
> **Event headroom.** 5 million usage events a month on a free tier is past the
> point where most products know whether their pricing model works. Pro includes
> 25 million and graduates up to 500 million, and Stigg says usage is never cut
> off on either plan. That is more metering capacity than most products will need
> in a year.
### When each one is wrong
Stigg is the wrong call if entitlements are the only sophisticated thing about
your billing and you are still missing workspaces, roles and an auth system.
You would be integrating a precise pricing model into a stack that does not
exist yet.
BuildBase is the wrong call if your stack is already built and working. Ripping
out an auth provider that works, just to get bundled metering, is a bad trade.
The bundle pays off when you are choosing the pieces. Not when you are replacing
them.
If you are at the earlier point, the metering side is covered in
[charging per API call in Next.js](/guides/charge-per-api-call-nextjs) and the
UI side in [enforcing quotas in React](/guides/enforcing-quotas-in-react). And
if the real question is whether to skip both of us and build metering from
scratch, [the cost of building usage metering
yourself](/blog/cost-of-building-usage-metering-yourself) runs the arithmetic
on that third option.
And if neither entitlement depth nor bundled metering is actually the
question - if what you're trying to replace is Stripe's own Billing add-on
specifically - the shapes for that are sorted in
[Stripe Billing alternatives](/compare/stripe-billing-alternatives).
---
## Supabase vs BuildBase: how much of the backend do you want to own?
> Supabase gives you direct access to a real Postgres database and lets you build the rest. BuildBase gives you auth, billing, workspaces and RBAC already wired to a database you never touch directly.
- Source: https://www.buildbase.app/compare/buildbase-vs-supabase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-14
- Updated: 2026-10-19
### In short
Supabase is a managed Postgres database with auto-generated APIs and realtime subscriptions - you touch the database directly and build the rest yourself. BuildBase bundles auth, billing, workspaces and RBAC into one backend, and you never query the database directly. Pick based on which one you would rather own.
Every backend-as-a-service comparison collapses into a features table, which
is the wrong first question. The real one: do you want to touch the database
yourself, or not?
Supabase's whole pitch is that you do. BuildBase's is that you shouldn't have
to.
### The one-paragraph answer
Pick Supabase if you want a real Postgres database you can query directly,
run extensions on and connect any Postgres client to, and you are willing to
build auth flows, billing, workspaces and RBAC around it yourself. Pick
BuildBase if you would rather the auth, billing, workspaces and RBAC already
existed and agreed with each other, and you are fine not touching the
database directly. Both are legitimate answers to "how much of the backend
do I want to own."
### What each one actually is
Supabase is a managed Postgres instance with auto-generated REST and GraphQL
APIs, realtime subscriptions on table changes, and its own auth, file
storage and edge functions layered on top. The database is the product.
Everything else exists to make that database easier to use from a client
app. If mobile reach matters more than SQL access, [Firebase](/compare/firebase-vs-buildbase)
is the other primitives-first BaaS worth comparing - Firestore instead of
Postgres, with the same gap once billing and workspaces enter the picture. The
[full Firebase alternatives lineup](/compare/firebase-alternatives) covers
Appwrite and Nhost alongside Supabase, for the same reason. Weighing Supabase
against that wider field rather than against BuildBase specifically? The
[Supabase alternatives roundup](/compare/supabase-alternatives) lines up
Firebase, Appwrite, Nhost and PocketBase by what each one actually replaces.
BuildBase is the opposite shape. Twenty modules ship as one instance behind
`@buildbase/sdk`: authentication, billing and subscriptions, workspaces,
role-based access, workflow automation, email. The database underneath is
ours, not yours - you call `bb.workspace.create()`, not `INSERT INTO
workspaces`. That is a real constraint. It is also why a quota already knows
which workspace it belongs to, instead of you writing the join.
> **Key takeaway:** Supabase optimizes for the database being the thing you touch. BuildBase
> optimizes for the database being the thing you never think about.
### Where the two overlap, and where they don't
Both ship authentication. Supabase Auth gets you email, magic links and
social providers on top of your own Postgres row. BuildBase's authentication
module covers email and password, magic links, email and phone codes,
passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, an OpenID Connect
provider of your own, Ethereum and Solana wallets, and enterprise SSO on the
Enterprise plan - plus API tokens for
server-to-server access, and it is one of 20 modules rather than the whole
product.
Billing, workspaces and workflows are where the overlap stops. Supabase does
not ship subscription billing, usage metering, role-based permissions or
workflow automation. You add Stripe, an entitlements layer and your own
tenancy model on top of the database, the same way you would with any raw
Postgres host. That is not a knock on Supabase. It is a scope decision, and
it rhymes with what [teams assembling Clerk, Stripe, Lago and Knock end up
paying in integration time](/blog/auth-billing-stack-cost) - Supabase just
starts one layer lower, at the database itself.
### Comparing the shape of each product
| Feature | BuildBase | Supabase |
| --- | --- | --- |
| What you get | Auth, billing, workspaces, RBAC and workflows on one instance | A managed Postgres database with auto-generated APIs |
| Database access | Workspace-scoped, through the SDK | Direct SQL access to your own Postgres instance |
| Billing and metering | Built in: subscriptions, credits, usage quotas | Not included, bring your own Stripe integration |
| Workspaces and RBAC | Built in, workspace-scoped roles | Not included, model it yourself in your schema |
| Realtime | Real-time Slack alerts on events; audience segments update periodically | Realtime subscriptions on raw table changes |
| Licensing | Proprietary SaaS, self-hosted deployment available | Self-hostable (see Fairness note below) |
| Pricing | Free $0, Launch $19/mo, Grow $49/mo, Scale $99/mo | Free $0, Pro $25/mo, Team $599/mo |
### Pricing, verified 19 October 2026
Supabase publishes its numbers: $0 for Free, $25 a month for Pro, $599 for
Team, Enterprise by negotiation. Free gives you 500 MB of database, 50,000
monthly active users and 5 GB of egress, and pauses a project after a week of
inactivity. Pro lifts that to 8 GB, 100,000 MAU and 250 GB of egress, then meters what you go
over - $0.125 per extra GB of database, $0.00325 per extra MAU, $0.09 per GB
of egress.
The line that surprises people is compute. Pro includes $10 a month of compute
credits, which covers exactly one Micro instance. Anything bigger is an add-on
and the ladder is steep: $15 a month for Small, rising to $3,730 for 16XL.
Disk performance is its own setting on top: you can provision extra IOPS and
throughput separately, though what you actually get is capped by the compute
size. That is the honest consequence of the database being the product - its size and its
load are your bill, and neither is a number you can read off a plan name.
Our own numbers are at [/pricing](/pricing).
> **Where Supabase wins:** Three things Supabase does that we genuinely do not, and none of them are
> close calls.
>
> **Direct database access.** You get a real Postgres instance you can run
> arbitrary SQL against, install extensions on and connect to with any Postgres
> client. BuildBase does not expose a database to query directly - everything
> goes through the SDK. If you need that level of control, Supabase is built
> for it and we are not.
>
> **It is open source.** Supabase is open source under Apache 2.0 and can be
> self-hosted from the ground up, including the database - its own Docker Compose
> stack runs Postgres as a container you connect to directly. We offer a self-hosted deployment
> (see /self-hosted) - [priced out against the managed
> plans here](/blog/self-host-vs-managed-cost) - but the platform itself is
> proprietary.
>
> **Realtime on raw data.** Supabase streams row-level changes straight from
> Postgres to a client. Ours does not work that way. Slack alerts fire on
> specific events - a signup, a payment - not a live feed of your database.
> Want to watch arbitrary table changes as they happen? That is Supabase's
> model, not ours. Past roughly 3,000 concurrent subscribers on the same changes,
> Supabase's own docs point you from Postgres Changes to Broadcast, which sends
> each change once and fans it out.
### If you are choosing between them
Ask what you are actually building, not what you are technically capable of
building. Needing members and roles on a workspace is usually the tell that
you are building multi-tenant SaaS rather than a single-tenant app with a
database, and [wiring that up from raw tables takes longer than it
looks](/guides/multi-tenant-workspaces-in-an-afternoon). If that raw-tables
path also means a separate database per tenant rather than shared tables,
[price out what that isolation actually costs](/blog/database-per-tenant-cost)
before you commit to it.
If your product is closer to "I need a database with an API and I will build
the product logic myself," Supabase's directness is the right trade. You are
not fighting an opinionated schema, and the open-source option means you are
never fully locked in.
If your product is closer to "I need auth, billing, workspaces and
permissions that already agree with each other," the SDK boundary that feels
like a limitation on day one is the thing that stops you rebuilding the same
systems an assembled stack eventually forces you to build anyway.
Neither answer is universally right. The question is only which parts of the
backend you want to own.
---
## ShipFast vs BuildBase: what $199 once actually buys you
> ShipFast is $199 once for a Next.js repo you own and wire up yourself. BuildBase is an SDK where the auth, billing and email are already running. When each one wins.
- Source: https://www.buildbase.app/compare/shipfast-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-14
- Updated: 2026-11-02
### In short
ShipFast is a one-time $199 Next.js boilerplate: you get a GitHub repo and wire up Stripe, an email provider, a database and hosting yourself. BuildBase is an SDK where auth, workspaces, billing and email already run as a service. ShipFast wins when you want to own every line.
Every ShipFast comparison I can find argues about which boilerplate to buy instead of it. Indie Kit, supastarter, a dozen listicles. None of them ask the question underneath: should you buy a boilerplate at all?
That is the actual fork in the road, and it has nothing to do with feature tables.
### The one-paragraph answer
Buy ShipFast if the code is the product and you want to own every line of it. $199 once, a repo, no vendor sitting in your auth path forever. Buy BuildBase if auth, billing and email are undifferentiated plumbing you would rather not maintain twice. Price is not the difference. The difference is whether you want the wiring diagram or the wiring.
### What each one actually is
ShipFast is a Next.js boilerplate. You pay once, you get access to a GitHub repo in JavaScript or TypeScript, and what you receive is code: Stripe and Lemon Squeezy checkout paths, Mailgun or Resend email, MongoDB or Supabase, Google OAuth and magic links through NextAuth, components, SEO and a blog. ShipFast hosts nothing and runs nothing. Every account behind those integrations is yours to open, configure, pay for and operate.
BuildBase is the other shape. 20 modules run as one instance behind `@buildbase/sdk`: hosted sign-in (passwords, passkeys, email and phone codes, social providers, wallets, and enterprise SSO on the Enterprise plan), [workspaces with RBAC](/guides/multi-tenant-workspaces-in-an-afternoon), subscriptions and [credit metering](/guides/charge-per-api-call-nextjs), workflow automation, email. You call `bb.workspace.create()`. There is no repo to fork, and no Stripe account to reconcile with a user table you also own.
> **Key takeaway:** A boilerplate gives you the code and leaves you the integrations. An SDK gives
> you the integrations and never gives you the code.
Both of those are real trades. Neither is free.
### Pricing, verified 2 November 2026
ShipFast is one-time: $199 Starter, $249 All-in, $299 for the bundle that adds the CodeFast course. Lifetime updates, unlimited projects, and no refunds once you have repo access - which is a reasonable policy for something you cannot un-receive, and worth knowing before you click.
Two things about that pricing page are worth saying out loud.
First, treat $199 as the price rather than a discount. The $100 off is framed as a countdown - "$100 off for the first 8460 customers (15 left)" on 2 November, after reading 8430 (6 left) in September and 8400 (9 left) six weeks before that - which makes the crossed-out $299 anchor price decoration. Three readings over five months, and the counter has gone up rather than down each time.
Second, and more usefully: **the Starter and All-in bullet lists are identical.** Same eleven items, word for word, on both. The $50 difference buys nothing the page describes. That is not a gotcha. It is just worth checking before you pay for the upgrade.
Our own pricing is a Free plan at $0 and then a subscription - Launch $19 a month, Grow $49, Scale $99, current numbers at [/pricing](/pricing), verified 31 October 2026. Free stops at its allowance (10,000 monthly active users, 1 GB of storage, 2 team members), and the paid plans start with a 7-day trial that does not ask for a card. Their page has a countdown on it, so re-check both before you commit to either.
So here is the arithmetic everyone skips. While you fit inside Free, BuildBase costs nothing and ShipFast is still $199. Once you need Launch, at $199 once against $19 a month, BuildBase passes ShipFast in month eleven. Ten months in we are still cheaper, $190 against their $199. A month later we are $209 and they are still $199, and from there the gap only widens in ShipFast's favour, forever.
If that were the whole calculation, this post would be short and would recommend ShipFast.
### What the crossover leaves out
It leaves out the four accounts.
The $199 buys the code paths, not the services they call. You still open Stripe, an email provider, a database and a host, and you pay each of them, and you operate each of them. That is the same assembled stack we [added up at 20,000 users](/blog/auth-billing-stack-cost), except you also wrote the glue by hand instead of buying it.
And it leaves out what happens in month nine. "Lifetime updates" is a promise about a git remote. Once you have been editing the repo since February - and you will have been, that is the entire point of owning the code - an upstream framework major does not arrive as an update. It arrives as a merge conflict against a file you rewrote.
Every fork-once boilerplate has this property. ShipFast is not worse at it than its competitors; it just cannot be better, because the thing you bought was a snapshot.
We build this way ourselves, which is the only reason I have an opinion worth reading here. Six products - OnceBooks, PlugNode, AgentCenter, Imejis, RemoteWait and LinkTracer - run on BuildBase. When the auth module changes, it changes once. If those six were six forks of a boilerplate, it would change six times, and two of them would quietly not get it.
| Feature | BuildBase | ShipFast |
| --- | --- | --- |
| What you buy | A running service you call | A GitHub repo you own |
| Price | Free plan, then $19/mo Launch, $49 Grow | $199 once, $249, or $299 with the course |
| Integrations | Already wired, one instance | Code paths only, you open every account |
| Who runs it | We do, or you self-host | You do, everywhere |
| Updates | Shipped to the SDK | Lifetime, via git merge into your fork |
| Scope | 20 modules including metering and workflows | Auth, payments, email, blog and UI |
| Deployment | Our cloud, or self-hosted Docker | Yours, anywhere you like |
> **Where ShipFast wins:** Three things ShipFast does better, and the first one is not close.
>
> **You own it, completely.** The repo is yours, it deploys anywhere, and nothing we run sits in the path of your login screen. If BuildBase disappeared tomorrow, a ShipFast app would not notice. That is real insurance, and no subscription can sell it to you.
>
> **It is cheaper for a product that never earns anything but outgrows a free tier.** Most side projects do not reach revenue. If yours stays inside our Free plan, it costs nothing with us. If it needs a paid plan and still never earns, $199 once beats $19 a month by simple arithmetic from month eleven on. Anyone telling you otherwise is selling a subscription. Which, to be clear, I am.
>
> **It teaches.** The bundle includes CodeFast, twelve hours of course material. We do not ship anything like it, and for a first-time founder it is worth more than the code.
### How to actually decide
Ask what you want to be maintaining in eighteen months.
If the answer is "my own code, all of it, because the way auth works in my product is a decision I want to keep making" - buy ShipFast. That is a coherent position and the ownership is real, though it's worth knowing [what maintaining that code actually costs in hours](/blog/cost-of-building-auth-yourself) before you commit to owning it forever.
If the answer is "the product, and none of the plumbing under it", then the boilerplate's $199 was never the number that mattered. The number that mattered was the four vendor accounts and the merge conflict in month nine, and neither of those is on any pricing page. Ours included.
---
## Auth0 vs BuildBase: when the MAU bill isn't the real cost
> Auth0 handles auth. BuildBase bundles auth with billing, workspaces and workflows. Here's when the bundle wins and when it doesn't.
- Source: https://www.buildbase.app/compare/auth0-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-13
- Updated: 2026-10-19
### In short
Auth0 is a dedicated identity platform: enterprise SSO, SAML, deep protocol support, priced by monthly active users. BuildBase is a smaller SDK bundling auth with billing, workspaces and workflows, and SSO on Enterprise only. Pick Auth0 for self-serve SSO; pick BuildBase instead of wiring four vendors together.
Most Auth0 comparisons argue about the login screen. That is not where the
decision actually gets made.
The real question is how many vendors you are willing to own the integration
between. Auth0 answers one part of a SaaS backend extremely well. It does not
answer the rest, and the rest is where the weeks go.
### The one-paragraph answer
Pick Auth0 if an enterprise buyer wants SAML this quarter on a self-serve
plan, or if identity is
the single hardest problem in your product and you want the most mature tool
for exactly that job. Pick BuildBase if auth is one of several systems you
still need to build - billing, workspaces, roles, quota enforcement - and you
would rather run one instance than [stitch four vendors
together](/blog/auth-billing-stack-cost) and maintain the seams yourself.
### What each one is
Auth0 is a dedicated identity platform. It does one thing, and the depth
shows: social login, enterprise federation protocols, passwordless flows, a
rules engine for customizing the auth pipeline. Your database, your billing,
your workspace model - none of that is Auth0's job. It never tried to be.
BuildBase takes the opposite bet. Auth is one of 20 modules on a single
instance, sitting next to billing, metering, workspaces and workflow
automation. Its sign-in methods are built in: email and password, magic links,
email and phone codes, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple,
an OpenID Connect provider of your own, Ethereum and Solana wallets, and
enterprise SSO, plus API tokens for server-to-server calls. That covers most
B2B SaaS sign-in flows. The enterprise identity layer is the exception: SSO is
on our Enterprise plan only, through your own WorkOS account - more on that
below.
If the full 20-module bundle is more than you want, [Kinde sits in
between](/compare/buildbase-vs-kinde) - auth with billing bolted on, short of
a whole backend.
The practical difference isn't feature count. It's what happens when the next
requirement lands. Add a billing tier to an Auth0-based stack and you are
reaching for Stripe and wiring a webhook that has to agree with Auth0 about
who the user is. Add one to a BuildBase-based stack and the subscription
already knows what [workspace](/guides/multi-tenant-workspaces-in-an-afternoon)
it belongs to, because that relationship exists in the same system.
### Pricing, verified 19 October 2026
The free tier is the genuinely generous part: 25,000 monthly active users at
$0, which is more headroom than most products need in their first year.
What is worth understanding before you build on that is that the paid ladder
does not begin where the free tier ends. Paid plans are quoted from 500 MAU.
On the B2C ladder that is $35 a month for Essentials and $240 for
Professional. On the B2B ladder - the one most SaaS companies actually need -
it is $150 and $800. What a paid plan costs at your real MAU count is a
different number, and it is the one to check on their page before you plan
around the free tier.
Enterprise SSO no longer starts where it used to. Auth0 moved a single
enterprise connection onto the free plan, alongside self-service SSO and
SCIM, so one SAML connection now costs nothing. Volume is still what you pay
for: B2B Essentials includes three, B2B Professional five, and further
connections are $100 a month each up to thirty. The B2C ladder is the
exception - enterprise connections are not available on B2C Essentials or
Professional at any price, so a consumer-shaped product that lands one
enterprise buyer is talking to sales.
| Feature | BuildBase | Auth0 |
| --- | --- | --- |
| Pricing model | Per-plan pricing, see /pricing | Tiered by monthly active users (MAU) |
| Free tier | $0, up to 10,000 MAU (Free) | $0, up to 25,000 MAU |
| Entry paid plan (B2C) | $19/mo (Launch), 7-day trial | $35/mo at 500 MAU (Essentials) |
| Entry paid plan (B2B) | $19/mo (Launch), 7-day trial | $150/mo at 500 MAU (Essentials) |
| Enterprise SSO / SAML | Not offered on Launch, Grow or Scale; Enterprise plan, via your own WorkOS account | 1 free, 3 from B2B Essentials, +$100/mo each |
| Scope | 20 modules: auth, billing, workspaces, RBAC, workflows | Identity and access management only |
MAU pricing is a reasonable proxy for a product where users log in and that's
mostly it. It's a worse proxy the moment usage and headcount diverge - fifty
users who each trigger ten thousand API calls a month cost Auth0 the same as
fifty users who log in once and leave. If your product bills by usage, the
metering has to live somewhere, and Auth0 was never going to be that place -
see [Stigg vs BuildBase](/compare/buildbase-vs-stigg) if metering is the piece
you're actually solving for.
### Where Auth0 genuinely wins
> **Where Auth0 wins:** **Enterprise SSO and SAML.** Auth0 ships this, and as of September 2026 one
> enterprise connection is included even on the free plan, with three from
> B2B Essentials at $150 a month. Ours is on the Enterprise plan only, and it
> runs through a WorkOS account you hold and pay per connection. If a deal is
> blocked on a security questionnaire asking for SAML and you are on Launch,
> Grow or Scale, Auth0 wins that deal outright, and there's no way to argue
> around it.
>
> **Depth on identity specifically.** Auth0 has spent years on nothing but
> authentication - rules engines, extensive social and enterprise protocol
> support, fine-grained session controls. When identity is the hard part of
> your product, a tool built for exactly that problem beats a bundle that treats
> it as one module among twenty.
>
> **Maturity.** Auth0 has been running production identity infrastructure for
> longer than BuildBase has existed. If vendor risk matters more to you than
> integration cost, that track record is real and worth weighing honestly.
### When each one is the wrong call
Auth0 is the wrong call if you are early and assembling a stack by hand -
auth here, billing there, a workspace model you're writing yourself in
between. You'll integrate Auth0 into a backend that doesn't exist yet, and
pay for each of the other pieces separately.
BuildBase is the wrong call the moment a customer's security review asks for
SAML and you are not ready for our Enterprise plan and a WorkOS account, or if
identity itself is sophisticated enough to
be your product's hard problem. Ripping out a working, mature auth provider
to get bundled billing is a bad trade in that case.
If you're deciding based on what you'll actually build next, [charging per API
call in Next.js](/guides/charge-per-api-call-nextjs) and [enforcing quotas in
React](/guides/enforcing-quotas-in-react) cover the metering side that Auth0
doesn't touch at all.
---
## Clerk vs BuildBase: auth is one module, not a backend
> Clerk added billing this year, but plans and subscriptions live in Clerk, not Stripe. Here is what Clerk vs BuildBase covers once you count metering, workflows and email.
- Source: https://www.buildbase.app/compare/clerk-vs-buildbase
- Section: Comparisons
- Author: Dharmendra Jagodana
- Published: 2026-08-12
- Updated: 2026-10-19
### In short
Clerk is auth and user management with its own billing product that uses Stripe only for payment processing. BuildBase is one SDK bundling auth, billing, email, workflows and RBAC. Clerk wins on enterprise SSO and framework reach. BuildBase wins once you count metering and workflows.
Clerk shipped a billing product this year. It is a real one, with its own plans and subscriptions rather than a thin wrapper over Stripe. It still does not make Clerk a backend.
### The one-paragraph answer
If your problem is "I need enterprise SSO and the widest framework reach," Clerk is the better tool - it ships SAML connections on its self-serve plans, where ours are on the Enterprise plan only, and it supports Vue and React Native, which we do not. If your problem is "I need auth, billing, workflows and RBAC to work together without gluing four vendors," BuildBase is the simpler path, because those pieces already share one workspace model.
### What each one replaces
Clerk replaces your login screen and session management. Organizations, its B2B product, adds role-based membership and domain-verified auto-join on top. Clerk Billing, added this year, turns plans into checkout flows and entitlement checks.
One detail worth getting right, because we got it wrong in the first version of this post: Clerk Billing is not a wrapper around Stripe Billing. You connect your own Stripe account, but Clerk uses it for payment processing only. Plans and subscriptions are Clerk objects, and Clerk's own docs are blunt about what follows - "Can I see Subscriptions in my Stripe account? No." Clerk is not the merchant of record either. If your finance team already reads subscription state out of Stripe, that is a migration, not an integration.
BuildBase replaces more of the middle. It bundles user-facing sign-in by email/password, magic link, email and phone codes, [passkeys](/guides/passkeys-nextjs), Google, LinkedIn, GitHub, Microsoft, Apple, an OpenID Connect provider of your own, Ethereum and Solana wallets, and enterprise SSO on the Enterprise plan through your own WorkOS account, plus API tokens for server-to-server auth, [workspaces with RBAC](/guides/multi-tenant-workspaces-in-an-afternoon), subscriptions and credit metering, workflow automation, and email - all running against `@buildbase/sdk` in one instance. A quota belongs to a workspace, a workspace has members, a member has a role - none of that is glue you write between vendors.
Clerk Billing is real progress for Clerk, worth naming plainly: it removes one integration a Clerk user used to need, and there is more in it than this post gave it credit for in August. Seat-based plans are documented, with seat limits, per-seat pricing and a pool of included seats. So is payment-failure visibility - `subscription.pastDue`, `subscriptionItem.pastDue` and payment-attempt webhooks all exist.
What it still does not do is [usage metering](/guides/charge-per-api-call-nextjs) or [quota enforcement](/guides/enforcing-quotas-in-react). Unit pricing is there, but the docs describe it in terms of seats, not consumption, and nothing documents metered usage. Nor is there workflow automation that reacts to a payment failing: Clerk will tell you the charge failed, and what happens next is still yours to build. Those stay separate purchases. A dedicated metering engine like Lago covers that specific gap in more depth than a bundled module does - see [how Lago's metering compares to ours](/compare/lago-vs-buildbase) if that's the piece missing from a Clerk-plus-Stripe stack.
### Pricing, and what we could not check on 16 September 2026
This section used to quote six Clerk prices. They are gone, and that is deliberate.
Clerk's pricing page would not load for us when we re-checked on 16 September 2026. We could reach Clerk's documentation but not the page the numbers live on, so we cut the figures rather than move the verification date and hope. A competitor price you cannot check is worth less than no price at all, and there is a specific reason to distrust the old ones: the parts of Clerk's billing we _could_ read have visibly moved since August.
Here is the model, from Clerk's own docs on 16 September 2026.
Clerk bills per user, in Monthly Retained Users. An MRU is a user who comes back at least one day after signing up, so a signup that never returns does not bill. That free day is a thoughtful piece of design and we would happily copy it.
The B2B side is what changed. Clerk now meters organizations separately as Monthly Retained Organizations: an organization with at least two members, one of whom is an MRU. Free plans include up to 50 MROs in development and 100 in production. What this post called the "organizations add-on" is now the B2B Authentication add-on, and it reaches further than a rename suggests - it gates linking enterprise connections to organizations, self-serve SSO, and any seat limit above 20 seats.
So a B2B bill on Clerk is a paid plan, Pro or Business, plus that add-on. Two lines, not one. Enterprise connections themselves are free in development and capped at 25 there; in production the docs say the plan covers them and point at the pricing page for the rest. Read [Clerk's pricing page](https://clerk.com/pricing) for the numbers, and treat any Clerk price you find quoted elsewhere, including in this post's history, as needing a fresh look.
BuildBase's model is flat per-plan - a Free plan with 10,000 monthly active users, then Launch at $19 a month, Grow at $49 - and the paid plans' 7-day trial does not ask for a card. Current numbers live at [/pricing](/pricing). For what the wider stack costs once Clerk's own billing is not enough by itself, see [the real monthly cost of Clerk plus Stripe plus Lago plus Knock](/blog/auth-billing-stack-cost).
One more thing the docs are clear about, and it is easy to miss when you are comparing headline rates. Clerk Billing is USD only, does not support refunds, and does not support payment methods that need a 3D Secure challenge, which means those payments simply fail. It is unavailable in Brazil, India, Malaysia, Mexico, Singapore and Thailand. And there is no native mobile checkout: web and Expo web only, with no Apple In-App Purchase or Google Play Billing. If you sell into any of that, the price was never the deciding factor.
| Feature | BuildBase | Clerk |
| --- | --- | --- |
| Free tier | Free plan, 10,000 MAU | Free plan, allowance on their pricing page |
| Entry paid plan | $19/mo (Launch) | Pro, then Business (prices not verified) |
| Billing unit | Flat per plan | Monthly retained users, plus organizations |
| B2B organizations | Included | B2B Authentication add-on, metered as MROs |
| Enterprise SSO / SAML | Not offered on Launch, Grow or Scale; Enterprise plan, via your own WorkOS account | SAML and OIDC, production requires a paid plan |
| Framework support | Next.js, Vite, React Router / Remix, TanStack Start, Express, NestJS, Fastify, Hono, Astro | Next.js, React, Vue, Nuxt, Expo/React Native, and more |
| Scope | 20 modules, one instance | Auth plus its own billing objects |
> **Where Clerk wins:** Two things Clerk does better today, and they are not small.
>
> **Enterprise SSO on a self-serve plan.** Clerk ships SAML against Azure AD, Google Workspace, Okta Workforce or any custom SAML provider, plus OIDC including EASIE, from its Pro plan. Ours is on the Enterprise plan only and runs through a WorkOS account you pay per connection. If an enterprise buyer has SSO on their security review and you want it without a custom plan, this comparison is already over and Clerk wins it.
>
> Clerk also ships self-serve SSO, which this post did not mention in August: your customer's own IT admin claims a domain with a DNS record, picks an identity provider and tests the connection themselves, from a Security tab inside the organization profile. That removes the part of an enterprise deal where someone on your side hand-configures a connection per customer. Ours does the same job in two products: we verify the company's domain with a DNS record, and its IT admin sets up the connection in WorkOS's Admin Portal from a link we send. It works, but Clerk keeps the whole thing in one profile screen.
>
> **Framework reach.** Clerk supports Vue and Expo/React Native alongside the usual web frameworks. Our list is [Next.js](/guides/buildbase-on-nextjs), [Vite](/guides/buildbase-on-vite), [React Router / Remix](/guides/buildbase-on-react-router), [TanStack Start](/guides/buildbase-on-tanstack-start), [Express](/guides/buildbase-on-express), [NestJS](/guides/buildbase-on-nestjs), [Fastify](/guides/buildbase-on-fastify), [Hono](/guides/buildbase-on-hono) and [Astro](/guides/buildbase-on-astro) - narrower by design. If your frontend is Vue, or your app ships as a mobile client, Clerk covers ground we do not.
### How to actually decide
Write down what your next twelve months actually require, not what would be nice to have. If the list is "auth, and maybe an enterprise SSO deal," Clerk is the right tool, and its dedicated focus on auth shows in the product. If the list runs to workspaces, metered billing, workflow automation and RBAC that all need to agree with each other, you are choosing between one instance and the several vendors Clerk still leaves you to wire together. [Kinde vs BuildBase](/compare/buildbase-vs-kinde) is the same shape of decision if Kinde is also on your shortlist, and if a one-time boilerplate is on it instead, [the accounts you still operate after paying once](/compare/shipfast-vs-buildbase) is the other axis of the same question. If you are not writing a codebase at all - if the product is a Webflow or Squarespace site - the comparison that actually applies is [Outseta vs BuildBase](/compare/outseta-vs-buildbase), not this one. And if Clerk itself isn't the fixed point - if WorkOS, Supabase or SuperTokens are also on the list - [Clerk alternatives](/compare/clerk-alternatives) breaks down which complaint each one actually answers.
We keep our numbers in one place at [/pricing](/pricing). Check Clerk's own pricing page before you commit, and do it yourself rather than trusting a number in a comparison post, including this one. Theirs moved this year with the shift to retained-user billing, it has moved again since August, and on the day we went looking we could not load it at all.
---
## How to add enterprise SSO to your SaaS through your own WorkOS account
> Enterprise SSO and SCIM for a B2B SaaS, in order: your WorkOS keys, the IT admin setup link, verified domains, required SSO, workspace bindings and the in-app screen.
- Source: https://www.buildbase.app/guides/add-enterprise-sso-saas-workos
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-11-03
### In short
Enterprise SSO in BuildBase runs through your own WorkOS account: paste its keys once, add each customer company and send its IT admin a setup link. Verified domains route people to their company sign-in, a first sign-in lands them in the workspaces you chose, and Directory Sync blocks leavers. Enterprise plan only.
The SAML handshake is the easy part of enterprise SSO. WorkOS does it, and does
it well. What eats the week is everything around the handshake: which company a
person belongs to, which workspace a new hire lands in, who on the customer's
side owns the connection, and what happens on the day their IT team removes
someone.
That is the part this guide is about. BuildBase does not put its own identity
layer in front of WorkOS. It runs on **your own WorkOS account**: you hold the
keys, WorkOS bills the connections to you, and BuildBase runs the sign-in, the
company records, the workspaces and the screens around it. If all you need is
the handshake, WorkOS on its own covers it, and our [WorkOS
comparison](/compare/workos-vs-buildbase) says so plainly. If you would rather
not hold a WorkOS account at all,
[Frontegg](/compare/frontegg-vs-buildbase) includes SSO connections on its free
plan and carries the vendor relationship for you.
When it works, a customer's employee opens your login page, presses **Continue
with SSO**, types their work email and signs in at Okta, Microsoft Entra, Google
Workspace or any SAML or OIDC identity provider. They come back signed in, inside
the workspaces you chose for their company, with the role you set.
> **Before you start:** A WorkOS account (its staging environment to test, production to go live), a
> BuildBase organization on the Enterprise plan, an auth client with a login
> page, and an owner or admin role in the BuildBase console. Enterprise SSO and
> Directory Sync are not on Launch, Grow or Scale. The in-app screen in step 9
> arrives in the next `@buildbase/sdk` release; 0.0.90 does not have it.
### 1. Connect your WorkOS account
In WorkOS, open the environment's **API Keys** page, copy the client ID
(`client_...`) and create an API key (`sk_...`). In the BuildBase console, open
**Authentication**, then **Enterprise**, paste both and choose **Save and
validate**. BuildBase asks WorkOS whether the key works before it stores
anything.
The tab then shows your **redirect URI**. Add it to the WorkOS application's
**Redirects** and make it the default. Leave AuthKit off in that environment:
BuildBase uses WorkOS for single sign-on only and runs the sign-in itself.
**What you should see:** the key shown only by its first and last characters,
and **Check the key** answering that it works.
One trap costs people an afternoon here. The client ID and the key must come
from the same WorkOS environment. A staging key with a production client ID
passes every check until the first real sign-in, which then fails, because
saving the key checks the key alone.
### 2. Add the customer company
Each company you sell to is an **enterprise**. **Add enterprise** creates a
WorkOS organization for it in your WorkOS account. Two settings come with it:
- **Create accounts on first sign-in**, on by default. An employee signing in
through their company for the first time gets an account even when your public
sign-up is closed, because their identity provider vouched for them.
- **Role for new accounts**, any of your user roles except owner.
**What you should see:** the enterprise, not yet connected.
### 3. Add the company's email domain
In the enterprise's **Email domains**, add the company's domain, say
`example.com`. It shows as **Pending** until the company's IT admin publishes
the DNS record WorkOS asks for, in WorkOS's Admin Portal. WorkOS decides; BuildBase
reads nobody's DNS.
The domain is more than routing. It is the check on every sign-in: the email the
identity provider asserts must be on one of the enterprise's verified domains,
or the sign-in is refused. Consumer domains such as `gmail.com` are refused
outright, and a domain one of your enterprises already holds is never handed to
another.
**What you should see:** the domain move to **Verified**. With your WorkOS
webhook registered from the console that takes seconds. Without it, up to 6
hours: the next time your server reads WorkOS's events. **Refresh from WorkOS**
asks now.
### 4. Send the IT admin their setup link
The customer's IT admin connects their identity provider in the WorkOS setup
portal. They never need a BuildBase account. From the enterprise, either:
- **Invite the IT admin by email.** WorkOS emails them the link. Tick **Domain
verification** and the same email covers step 3 as well.
- **Open the setup portal now**, for when you do it together on a call. The link
lasts 5 minutes. Anyone holding it can change the connection, so never forward
it to the customer by chat or email.
Send them the [page for IT admins](https://docs.buildbase.app/authentication/enterprise-sso-it-admin)
with the invitation.
**What you should see:** the enterprise's **Connection** section turn active.
### 5. Turn it on
Under **Authentication**, **Methods**, add an **Enterprise SSO** method and
attach it to the auth client whose login page should offer it. Then turn
**Sign-in** on in the **Enterprise** tab.
**What you should see:** **Continue with SSO** under the client's other methods.
Pressed, it asks for a work email. It never says up front whether a domain has
SSO: someone whose company is not set up is told so after they continue, so the
button cannot be used to list your customers.
### 6. Choose where their people land
In the enterprise's **Workspaces** section, pick the workspaces its people join,
the role each one joins with, and **Save workspaces**.
Someone joins on their first sign-in through the company, whether the account is
new or an existing one linking up for the first time. After that it is a normal
membership with a memory: a person a workspace admin removes is not put back on
their next sign-in. A workspace belongs to one enterprise, and your plan's member
ceiling and the workspace's seats still apply. A join one of them refuses is
skipped, the person still signs in, and the enterprise shows **Needs a look**
with the reason.
**What you should see:** a test employee signing in and landing in the bound
workspace with the role you set, not on an empty "no workspaces" screen.
### 7. Require single sign-on, if the company wants it
Once the connection is active, the enterprise offers **Require single sign-on**.
With it on, the company's people are refused at every other way in (password,
magic link, email code, passkey, social sign-in and the rest) with a sentence
pointing them at **Continue with SSO**. An app with its own password form gets
`reason: "sso_required"` back from the sign-in call.
Two details we cared about. A wrong password still answers "Invalid email or
password", so the rule is never revealed to someone who does not hold the
credential. And it only holds while single sign-on can work: turning the
enterprise off, or enterprise sign-in off, lets everyone back in at once. That is
your break-glass. Sessions already open are left alone either way.
Order matters here. Turned on before the connection from step 4 is active, it
locks the company's people out completely.
### 8. Let the directory manage people (Directory Sync)
Single sign-on makes an account on first sign-in. It does nothing when someone
leaves. For that, turn on **Provision people from the directory** on the
enterprise and hand the directory step to the IT admin with **Set up
provisioning**. The portal gives them a SCIM endpoint and a bearer token to paste
into Okta, Microsoft Entra, Google Workspace or an HR system.
**What you should see:** the directory shown as **Linked**, with its last sync.
From then on, a person the directory adds gets an account and joins the bound
workspaces. A person it removes is **blocked, not deleted**: signed out
everywhere and taken out of the workspaces the enterprise put them in, with their
history kept. Directory groups can map to roles in the app or in a workspace,
and the highest role any group gives wins. Nobody gets an email about any of it,
because a company provisioning a thousand people would otherwise send a thousand
"you were added" emails.
WorkOS bills Directory Sync to your WorkOS account separately from single
sign-on. The [provisioning docs](https://docs.buildbase.app/authentication/enterprise-provisioning)
cover the group mappings in full.
### 9. Put the Single sign-on screen in your app
Your customer's workspace admins should not have to email you to find out whether
their connection works. From the next `@buildbase/sdk` release, the workspace
settings dialog grows a **Single sign-on** screen while enterprise sign-in is on:
the company's name, the connection's state and when it was checked, a Directory
sync card, a warning before a SAML certificate expires, and **Set up SSO**, which
opens the IT admin's setup for members who can edit the workspace's settings.
It shows on its own inside the settings dialog. To put it on a page of your own:
```tsx
import { EnterpriseAccess } from '@buildbase/sdk/react';
export function SsoPage() {
// The current workspace; pass workspaceId="..." for another one.
return ;
}
```
Or build your own around the headless hook:
```tsx
import { useEnterprise } from '@buildbase/sdk/react';
export function SsoStatus({ workspaceId }: { workspaceId: string }) {
const { status, loading, opening, openSetup } = useEnterprise(workspaceId);
if (loading || !status) return null;
if (!status.available) return
);
}
```
`openSetup()` has to run from a click. The server may first ask the admin to
confirm it is them, so the link is fetched before any tab opens. From your
backend, the same two calls exist on the server client:
```ts
import BuildBase from '@buildbase/sdk';
const bb = BuildBase({ serverUrl, orgId, getSessionId });
const status = await bb.enterprise.status(workspaceId); // { available: false } or the company
const { url } = await bb.enterprise.createSetupLink(workspaceId);
// `url` is a credential: redirect the browser to it, never log or store it.
```
We have not run these three samples against a live tenant for this post; they
match the exports and the README of the SDK release they arrive in.
### What breaks, and how to tell
A refused sign-in sends the person back to your login page with a `reason`. The
ones you will meet first:
| `reason` | What happened | What to do |
| -------------------- | ------------------------------------------------------ | ------------------------------------------------------------- |
| `sso_not_available` | No active enterprise has a verified domain for it | Get the domain verified, or check they typed their work email |
| `sso_email_mismatch` | The identity provider sent an email off the domains | Verify that domain too, or fix the email at the IdP |
| `sso_required` | They used another way in and their company forbids it | Nothing, unless requiring SSO was a mistake |
| `signup_disabled` | First-sign-in accounts are off and nobody invited them | Turn it on, or invite them |
**"Use SSO" with no SSO button.** The auth client they signed in through has no
Enterprise SSO method attached. Attach it to every client the company's people
use.
**"The setup never came back."** Do not count on the WorkOS portal returning the
IT admin to your app. When we tested on WorkOS's staging environment on 14
October 2026, it stayed on "Connection activated" once the connection worked and
never followed the return URL. The SDK screen covers it by reading the status
again whenever the admin returns to the tab, for 30 minutes after opening the
setup.
**Everyone at one company locked out on the same day.** A SAML connection trusts
one signing certificate, and those expire. BuildBase reads WorkOS's expiry
warnings, badges the enterprise in your console, and shows the company's admins
**Renew the certificate** in your app, so their IT admin can fix it before the
date rather than after.
**Your plan changes.** If your BuildBase plan stops including enterprise SSO,
nothing that works stops: people keep signing in and directories keep syncing.
New setup is locked, and the API answers `402` with `FEATURE_NOT_IN_PLAN`.
The full reference, including several identity providers per company, the access
policy and the company's audit trail, is in the [enterprise SSO
docs](https://docs.buildbase.app/authentication/enterprise-sso). The short setup
checklist is [Set up Enterprise SSO](https://docs.buildbase.app/sign-in-setup/enterprise-sso).
```bash
npm i @buildbase/sdk
```
---
## Credits and usage limits for an AI app you built with a prompt
> An AI feature needs a balance someone can spend down and a hard stop when it is gone. What the agent builds instead is a number in a column. Here is the shape that holds, and the prompts that get it.
- Source: https://www.buildbase.app/guides/credits-and-usage-limits-for-an-ai-app
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-29
### In short
Credits for an AI app you built with a prompt are a balance the server spends after the work succeeds, never a column the browser decrements: check, work, then consume with an idempotency key, answer 402 when the balance is empty, show the platform's balance and store, and let a workflow send the low-balance email.
You are giving the AI feature in your app a balance: a number of credits
each workspace can spend, a way to buy more, a warning before it runs out,
a hard stop when it has, and a limit on the free plan that resets every
month. When it works, a person uses their free allowance, sees exactly how
much is left, buys a pack on a test card and watches the balance rise
without a reload, gets refused with a clear message at zero, and gets an
email before that happens. None of it lives in a column the browser can
write.
That last sentence is the whole post. Ask a coding agent for credits and
it builds a `credits` integer on the users table, decrements it from the
page that calls the model, and adds a route "for testing" that sets it. In
February 2026 someone audited three products posted on Reddit and found
one with "development endpoints still in production that let anyone mark
themselves as a paid user and give themselves unlimited credits". That is
not an unusual app. It is the default output of the prompt "add credits".
What we ran on 27 October 2026: nothing new. The consume path in this guide
is the one in [charge per credit in Next.js](/guides/charge-per-credit-nextjs)
and [the credits wallet](/guides/credits-wallet-nextjs), which were written
against our platform and whose figures (the 30-a-minute limit, the
seven-day expiry window) come from the platform's own routes. The
builder-specific parts are the prompts, and the honest note is that none
of them has been run inside a builder today.
> **Before you start:** An app with BuildBase sign-in and a workspace per customer, on any of the
> builders (the Lovable, v0, Bolt and Replit guides each end at that point). A
> Stripe account connected in the console, for the packs. A feature that costs
> something to run: a model call, an export, a render.
### 1. Decide what you are selling: a balance, a limit, or both
Two mechanisms look alike from the pricing page and behave differently
underneath, and the agent will build whichever one you name, so name the
right one.
**A limit (a quota)** is an allowance that comes with the plan and resets
every period. Twenty generations a month on the free plan, five hundred on
Pro. It is counted, not bought; when it is used up the answer is "upgrade"
or "wait until the first"; and nothing carries over.
**A balance (credits)** is something people buy and spend down. A pack of
500 for $10, a monthly grant of 100 with the plan, a top-up when it runs
low. It carries over, it can expire, it can be given away in a promotion,
and when it is gone the answer is "buy more". The balance is also a
liability on your side until it is spent, which is why it is a ledger and
not a number.
Most AI apps want both: a quota on the free plan so strangers can try the
feature, credits for everyone who pays so heavy users pay for what they
use. The longer argument, with the cases where each is the wrong choice,
is [quotas are not credits](/blog/quotas-are-not-credits). For this guide
the decision is a sentence you say out loud: "free users get N a month;
paid users spend credits".
What you should see: that sentence, with the numbers filled in, before
you prompt anything.
### 2. Put the price list in the console, not in code
Packs, prices, grants and expiry are configuration, and they live in the
BuildBase console so a price change is a form, not a deploy.
- **Packs.** Each one has a name, a number of credits, a price, and an
optional `validityDays`. A pack with no validity never lapses.
- **Plan grants.** A plan can grant credits each period. In one
configuration only (`renewOnPeriod` on, in reset mode) the unspent part
expires at the next monthly reset; leave it off and granted credits
carry over.
- **Quotas.** On the free plan, the monthly limit for the feature, as a
plan limit the server checks.
Nothing about prices goes in the app. The agent will try to put them
there, because the pricing page has to show them, and the answer is that
the page reads the packs from the platform.
What you should see: the packs listed in the console with their prices,
the free plan carrying the monthly limit, and a test purchase in Stripe's
test mode adding credits to a workspace before any code is written.
### 3. The server route: check, do the work, then consume
This is the step that decides whether the balance means anything. The
order inside the route is check, work, debit, and the debit is the gate.
```ts
// app/api/generate/route.ts
import BuildBase from '@buildbase/sdk';
const bb = BuildBase({ serverUrl, orgId, getSessionId });
const COST = 10;
export async function POST(request: Request) {
const { workspaceId, prompt, requestId } = await request.json();
// Advisory. Cheap, and it stops you doing work nobody can pay for.
const balance = await bb.credits.getBalance(workspaceId);
if ((balance?.available ?? 0) < COST) {
return Response.json(
{ error: 'Insufficient credits', available: balance?.available ?? 0 },
{ status: 402 }
);
}
const output = await generate(prompt);
// Authoritative. The balance moves here, after the work succeeded.
try {
const debit = await bb.credits.consume(workspaceId, {
amount: COST,
description: 'AI generation',
idempotencyKey: requestId,
});
return Response.json({ output, remaining: debit.balanceAfter });
} catch (err) {
if (err.code === 'INSUFFICIENT_CREDITS') {
return Response.json({ error: 'Insufficient credits' }, { status: 402 });
}
throw err;
}
}
```
Three things in it that the agent's version never has. The check is
advisory and the consume is the decision: on the server the debit lands
as one conditional update that requires the balance to still cover the
amount, so two requests racing for the last credit cannot both win, and
there is no window to close. The consume comes after the work, because no
call reverses a consumed credit, so a debit before work that fails is a
refund ticket. And the idempotency key makes a retry safe: the same key
returns without touching the balance, so a user who clicks twice, or a
network that resends, is charged once.
Paste this prompt, with your builder's words for "server route":
```text
The AI feature is paid for in credits held by BuildBase, not by this app. In the server route that runs it: read the balance with the server SDK's credits.getBalance and answer 402 if it cannot cover the cost; run the work; then call credits.consume with the amount, a description and an idempotency key taken from the request. Never consume before the work. Never store a credit balance, a credits column or a plan in our database. Do not add any route that sets a balance, grants credits or marks a user as paid, including for testing. The browser never calls the credits API directly.
```
What you should see: call the route once and the balance drops by ten.
Make the model call throw and the balance does not move, because the line
that moves it never runs. Send the same request id twice and it is charged
once.
**Correcting potential issues.** The ways the agent drifts, and the line
to paste back:
- It added a `credits` column and decrements it. Paste: "Remove the
credits column and every read or write of it. The balance is read from
credits.getBalance and spent with credits.consume, on the server only."
- It consumes before the work "to prevent abuse". Paste: "Move the
consume call after the work succeeds. The getBalance check before the
work is the abuse prevention; the debit is after."
- It left out the idempotency key, or generated it on the server. Paste:
"The idempotency key comes from the client with the request, one per
user action, so a retry of the same action carries the same key."
- It calls the credits API from the browser with a key. Paste: "No
credits call runs in the browser. The browser calls our route; the route
calls the platform."
### 4. The browser: the balance, the warning and the buy button
The screens are the platform's, and the agent's job is to place them.
Three pieces:
- `useCreditBalance(workspaceId)` returns the balance with its fields
(`available`, `totalGranted`, `totalConsumed`, `totalExpired`, and the
expiring part), so the number on the screen is the ledger's number.
- `WhenCreditsLow` with a required `threshold` renders its children once
the balance is at or below the number you give it, and
`WhenCreditsExhausted` renders at zero. There is no default threshold
because there is no sensible default for a number you price yourself.
- `openCreditStore()` from `useSaaSAuth()` opens the purchase screen from
anywhere, which is what the out-of-credits message should do, and
`CreditStorePage` is the same store as a page of your own.
```text
Show the workspace's credit balance in the app header with useCreditBalance from @buildbase/sdk/react. Inside the AI feature, wrap the warning in WhenCreditsLow with threshold set to the cost of one run, and wrap the out-of-credits message in WhenCreditsExhausted; both offer a button that calls openCreditStore(). Add a /credits page that renders CreditStorePage. When our route answers 402, open the store; when it answers 429, show "try again in a minute" and nothing else.
```
What you should see: the balance in the header, a yellow warning when it
is at or below one run's cost, the store opening on a click, a purchase on
a test card, and the header updating without a reload. Then the expiry
case: `useExpiringCredits(workspaceId, 7)` lists what lapses in the next
seven days (seven is the default window, 90 the ceiling), and a line on
the billing screen that says "40 credits expire on Friday" is the
difference between a top-up and a support ticket.
**Correcting potential issues.** If the agent built its own balance screen
reading its own column, step 3's first fix-up. If the "buy" button opens a
Stripe link the agent pasted, paste: "The buy button calls
openCreditStore(); the platform handles checkout and credits the balance.
Remove the Stripe link."
### 5. The hard stop, and the email before it
Two answers come out of the route in step 3, and they need two different
screens.
**402 means buy.** The balance cannot cover the run. The response carries
how many are available and how many were requested, so the message can
say the exact shortfall, and the button opens the store.
**429 means wait.** The consume endpoint is rate limited to 30 requests a
minute per IP, and that limiter answers with a 429 of its own. A 429 from
this route is never an empty balance. Generated apps show the buy screen
on any error, and a person who just bought a pack and then sees "buy
more" because they clicked fast is a refund request.
The email is a workflow, not code. The platform raises a
`credit.low_balance` event on its own, and a workflow triggered on it
sends the "running low" email from your sender, with a link to the store;
a second workflow on the quota's `quota.limit_exceeded` event tells a free
user they have hit the month's limit and what Pro would give them. Both
are built in the console's workflow editor with a template, and each run
is logged, so "did Acme get the warning" is a search. [Emails that
arrive](/guides/emails-that-arrive-for-an-ai-built-app) is the guide to
the sender and the workflows.
What you should see: spend a workspace down past the point where the
platform fires the low-balance event and the email arrives from your
domain; spend it to zero and the feature refuses with the store; call the
route thirty-one times in a minute and the thirty-first answers 429 with
no store in sight.
### 6. The free plan's limit, which is a different thing
The free tier's monthly allowance is a quota, and it is enforced on the
server by the plan, not by a counter in your database. The route records
one unit of usage against the workspace before the work, the platform
answers whether the workspace is within its plan's limit, and an exceeded
limit comes back as a refusal your route turns into a 429 with a message
about upgrading. The reset is the plan's, monthly, with no cron job of
yours.
In the browser, `WhenQuotaExhausted` and its siblings render on the
quota's state (within, near the threshold, exhausted) rather than on
numbers the page computes, which is the point of [enforcing quotas in
React](/guides/enforcing-quotas-in-react): the page never decides whether
someone is over, it only shows what the server decided. The server side,
with the batching that matters once the feature is popular, is
[quota enforcement in Next.js](/guides/quota-enforcement-server-side-nextjs).
```text
Free-plan workspaces get a monthly limit on the AI feature, enforced by the BuildBase plan limit, not by a counter in our database. In the server route, record usage against the workspace before running the work and answer 429 with an upgrade message when the platform says the limit is exceeded. In the browser, wrap the feature in WhenQuotaExhausted with an upgrade prompt. Do not add a usage table, a monthly reset job or a counter column.
```
What you should see: a free workspace runs the feature N times, the next
call answers 429 with the upgrade message, the page shows the upgrade
prompt without a reload, and on the first of the month it works again
with nothing of yours having run.
### 7. What the agent builds instead, and why it fails quietly
It is worth knowing the shape, because you will be reading diffs for it.
The balance is an integer on the users table. The page that calls the
model reads it, calls the model, subtracts, and writes it back, so a slow
network means two calls and one debit, and a fast one means the opposite.
A `/api/dev/add-credits` route exists because testing needed it, and
nothing removed it. There is no idempotency key, so every retry is a
double charge, and no ledger, so when a customer says "I had 50 and now I
have 12" there is nothing to show them. The free plan's limit is a
`generations_this_month` column that a cron job the agent also wrote
resets, or does not, on the first.
Each of those is a support ticket with a date on it, and the audit above
is what it looks like when a stranger finds the dev route before you do.
Enrichlead, the vibe-coded product that shut down within about a week of
launch in March 2025, failed in the same family: its founder described
"maxed out usage on API keys" and "people bypassing the subscription",
which is what no limit and no gate cost when the feature behind them is
metered by someone else's bill.
The reason to care about the shape, rather than any vendor, is the API
bill underneath. Every credit you fail to charge is a model call you paid
for. A balance the browser can set is a balance a stranger can set to a
million, and the model provider bills you for every one of them.
One more thing about the builder's own credits, which are a different
balance from the one you sell. A Base44 reviewer wrote on 15 October 2026
that "a runaway automated workflow in one of my apps consumed almost all
10,000 monthly integration credits". That is your building budget, not
your customers' balance, and it argues for the same habit in both places:
a limit the thing cannot cross, set by someone other than the thing
spending it.
### Where a plain limit, or the builder's own metering, wins
If your feature is cheap to run and you sell seats rather than usage, you
do not want credits. A monthly quota on each plan is simpler to explain.
It carries no liability on your books, it never expires on a customer who
then writes in, and the plan enforces it. Credits earn their complexity
when people buy them, when usage varies by ten times between customers, or
when you want a balance that can be granted in a promotion.
And if you bill usage in arrears, as a line on the invoice rather than as
a prepaid balance, Stripe's metered prices are the right tool and
credits are the wrong one: Stripe Billing adds 0.7% to the card fees, read
on 27 October 2026, and does the invoicing. Lovable's and Replit's built-in
payments, read the same day, take a subscription and say nothing about
usage, credits or limits, so on those builders the metering is yours
either way, and the shape above is the one that holds.
> **Key takeaway:** Credits are a ledger the server spends after the work, never a column the
> browser writes. Check, work, then consume with an idempotency key; 402 means
> buy and 429 means wait; the prices, the store and the low-balance email live
> in the platform, and no route in your app sets a balance.
### What breaks, and how you can tell
**The balance goes negative, or two clicks charge once.** The page is
subtracting a column. Step 3: the balance is only ever moved by
`credits.consume` on the server.
**A retry charged twice.** No idempotency key, or a key generated per
attempt instead of per action. The key comes from the client, one per
user action.
**The buy screen appears when the user clicked fast.** The app treats
429 as 402, and step 5 says why that is the wrong screen: 429 is the rate
limiter, so the message is "try again in a minute" and nothing opens.
**Credits were deducted for a run that failed.** The consume ran before
the work. Move it after.
**A customer says they lost credits and you cannot say where.** They
expired, and the balance screen never showed `totalExpired` or the
expiring list. Step 4.
**Someone has a million credits.** A route sets balances, usually under
`/dev/` or `/admin/` with no check. Delete it, and read [the five
checks](/blog/vibe-coded-app-hacked-incidents-and-five-checks) before
launch.
**The free limit never resets, or resets at the wrong time.** A counter
column and a cron job. Step 6: the limit is the plan's, and the platform
resets it.
### Install
The packs, the store and the workflows live in the console; the app
needs the SDK and its sign-in:
```bash
npm i @buildbase/sdk
npx buildbase init --org-id
```
---
## Add login, teams and paid plans to a Bolt.new app, and keep Bolt Cloud or Supabase for your data
> Bolt runs Node in your browser tab, so the three sign-in routes answer inside the preview. Where the live copy of them runs is the one decision this guide is built around. Read on 27 October 2026.
- Source: https://www.buildbase.app/guides/add-login-teams-and-paid-plans-to-a-bolt-app
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-28
- Updated: 2026-11-04
### In short
To add login, teams and paid plans to a Bolt.new app, ask Bolt for the @buildbase/sdk package and the three sign-in handlers from the Vite guide, keep the secret out of the browser and GitHub, and run the live handlers on a host that runs functions. Data stays in Bolt Cloud or Supabase; teams and plans are SDK calls.
You are adding real sign-in, a workspace per customer, paid plans and the
email that goes out when a card fails to an app Bolt built for you, without
moving your data out of Bolt Cloud or your Supabase project. When it works,
a stranger opens your live address in a private window, signs up with
Google or a magic link, lands in their own workspace, invites a colleague
who gets an email, picks a plan on a test card, and the feature they paid
for appears without a reload. The client secret never reaches the browser
and never reaches GitHub.
Bolt is different from the other builders in one way that matters here,
and it cuts both ways. Bolt runs Node in your browser tab (its supported
technologies page says "Node.js for the backend", JavaScript only, no PHP
or Python), so the three small sign-in routes this guide adds answer inside
the preview, where you can see them work before you publish. The other
edge of it: the preview's server is your tab, and the live site needs a
server of its own. Where that lives is the one decision this guide is built
around.
What we ran on 27 October 2026: the three handlers are the ones from
[BuildBase on Vite](/guides/buildbase-on-vite), which have been run end to
end in `vite dev` against a real organization on our local stack, and which
ran unchanged today as server routes inside the Cloudflare Workers runtime
for the [Lovable guide](/guides/add-login-teams-and-paid-plans-to-a-lovable-app).
What we have not run: anything inside Bolt itself. The Bolt-specific parts
of this guide (the preview, the token prices, Bolt Cloud's sign-in,
hosting, secrets and GitHub sync) are read from Bolt's help center today,
and the guide says so wherever a Bolt behaviour is the thing that decides
whether a step works.
> **Before you start:** A Bolt project, on any plan. A BuildBase organization, and an auth client
> created in the console under **User Management → Authentication**, with its
> client ID and secret. A GitHub account, for step 1's second route. A Stripe
> account, only when you reach plans.
> **Tip:** Bolt's own help center asks agents to treat it as the source of truth for how
> Bolt works. We did. Where this guide and a Bolt page disagree on a Bolt
> behaviour, the page is newer than this post, and wins.
### 1. Decide where the live sign-in server runs
Sign-in needs one thing a browser cannot hold: a secret. The hosted sign-in
page sends a person back to your app with a one-time code, and swapping
that code for a session uses the client secret, so the swap runs on a
server and the session comes back as an httpOnly cookie on your app's own
address. Three small routes do all of it: swap the code, report the
session, sign out.
During building, this is solved for you. Bolt's preview runs Node in the
tab, the Vite dev server runs there, and a small Vite plugin answers the
three routes, so the preview is a complete app. For the live site there
are two honest routes, and you should pick one before you prompt, because
the files differ.
**Route A: stay on Bolt hosting.** Bolt's Netlify page says "Bolt hosting
supports projects with a backend", and Bolt Cloud has server functions
that Bolt deploys for you. What no page in the help center says is the
address a server function answers on, or whether it shares your site's
address. The cookie only works if the route that sets it lives on the same
address as the app. So route A is a try, not a promise: ask Bolt to run the
three handlers as server functions, publish, and run the check in step 5.
If your live site answers the route with JSON, you are done and this is the
simplest setup there is. We have not published a project this way, so we
cannot tell you it works.
**Route B: keep building in Bolt, run the live site from GitHub.** Bolt's
GitHub integration is two-way: "every time you make a change that doesn't
break the project, Bolt creates a commit for you", and "it also checks
GitHub every 30 seconds for any updates made outside Bolt and pulls those
in". Connect the repository to Vercel, Netlify or Cloudflare, where each
handler is a one-line function file, and the live site is the same code
with a server that we know answers the routes. You keep working in Bolt;
the host rebuilds on every commit Bolt makes. The alternative Bolt offers
in one click, Netlify from the Publish menu, is not this: Bolt's own page
says Netlify there "can't host a database or a traditional backend", which
is the one-click static path, not a Netlify site built from your
repository.
One rule for route B that is easy to miss: Bolt's page says that when the
two sides conflict, "Bolt keeps your changes and overwrites the GitHub
version", and that merging branches is not supported in Bolt. So make
every change in Bolt, never in GitHub directly, and treat the repository
as the thing the host reads, not a second place to edit.
If your Bolt project is Next.js rather than Vite, the server is already in
the app. Bolt's terminal (not available in Safari, where previews are
hosted instead) should run `npx buildbase init --org-id `,
which writes the route handlers for you, though we have not tried it
there; the [v0 guide](/guides/add-sign-in-teams-and-paid-plans-to-a-v0-app)
is the Next.js version of this page, and route B applies to hosting it.
What you should see: a decision, written down, and for route B a GitHub
repository connected from Bolt's project menu (it starts private, on
`main`) and imported into your host.
### 2. Register where people come back to
The hosted sign-in page sends people back to one exact address per
environment, so register them before you prompt: your live address with
`/sign-in` on the end, your custom domain with `/sign-in` if you have one,
and the address of the preview if you want to test sign-in there. An
address it was not told about is refused.
The preview is the awkward one. Bolt's preview opens in its own tab at an
address Bolt assigns, and that address can change when the project
restarts. Most people register the live address and the custom domain,
test sign-in there, and use the preview for everything else, which is what
we suggest. If you do want sign-in in the preview, open it in a new tab,
copy the address, register it with `/sign-in` on the end, and expect to do
it again after a restart.
This is also where Bolt's own sign-in keeps its version of the same
problem. Bolt Cloud's authentication page describes a Site URL, set to
`localhost:3000` by default, which "does not work for live applications",
and a comma-separated allow list of redirect patterns with wildcards, which
Bolt "usually updates" when you publish. Those settings govern Bolt Cloud's
sign-in, not this one, and the addresses you register on the BuildBase
client are the only ones that matter here. [Login that works after you
publish](/guides/login-that-works-after-you-publish) is the troubleshooting
page for either.
What you should see: the auth client in the console lists each address,
and the client secret has been shown once. Do not paste it into the Bolt
chat.
### 3. Ask Bolt for the package and the three handlers
Paste this prompt. It names the outcome, the rules, the files, and the one
thing that must never happen to the secret. Bolt installs the package in
the preview, and you can watch `npm install` run in its terminal.
```text
Use the @buildbase/sdk npm package to add BuildBase sign-in, a workspace per customer, paid plans and lifecycle email to this app.
Keep Bolt Cloud (or my Supabase project) as the database; BuildBase is not the primary database. Do not add Clerk, Auth0, Resend or n8n, and do not enable Bolt Cloud's own sign-in. Stripe is bring-your-own; do not store card data.
Read https://www.buildbase.app/llms.txt first and do not invent endpoints. Take the files from https://www.buildbase.app/guides/buildbase-on-vite unchanged:
- server/auth.ts with the guide's token, session and signout handlers, byte for byte
- the buildbaseAuth Vite plugin in vite.config.ts, so the preview answers POST /api/auth/token, GET /api/auth/session and POST /api/auth/signout
- api/auth/token.ts, api/auth/session.ts and api/auth/signout.ts as one-line Vercel function files that export the matching handler
- src/context/buildbase-provider.tsx from the guide, with import '@buildbase/sdk/css', wrapping the app in main.tsx
Put VITE_BUILDBASE_ORG_ID, VITE_BUILDBASE_CLIENT_ID and VITE_BUILDBASE_REDIRECT_URL in .env, add .env to .gitignore, and leave BUILDBASE_CLIENT_SECRET empty for me to fill in; never read it in the browser and never give it a VITE_ prefix.
If sign-in already exists in this app, stop and ask me before changing it.
```
For route A, replace the third line of the file list with: "run the three
handlers as Bolt server functions at /api/auth/token, /api/auth/session
and /api/auth/signout on the published site, reading
BUILDBASE_CLIENT_SECRET from Bolt Secrets". For a Netlify or Cloudflare
host on route B, name that host's function folder instead of `api/`; the
handlers are plain `Request` to `Response` functions, and the Vite guide
says each host needs a one-line wrapper of its own.
What you should see: `@buildbase/sdk` in `package.json`, and five new or
changed files. The one that matters is the handler that swaps the one-time
code for a session, and it is the Vite guide's file. The provider is the
guide's too, and the part worth reading is the three callbacks, because
each one is a fetch to one of the routes:
```tsx
// src/context/buildbase-provider.tsx (trimmed; the Vite guide has the full file)
import '@buildbase/sdk/css';
import { ApiVersion } from '@buildbase/sdk';
import { SaaSOSProvider } from '@buildbase/sdk/react';
let cached: string | null | undefined;
export async function getSession() {
if (cached === undefined) {
cached = (await (await fetch('/api/auth/session')).json()).sessionId;
}
return cached ?? null;
}
export function BuildBaseProvider({ children }: { children: React.ReactNode }) {
return (
{
const res = await fetch('/api/auth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code }),
});
cached = (await res.json()).sessionId;
return { sessionId: cached! };
},
onSignOut: async () => {
await fetch('/api/auth/signout', { method: 'POST' });
cached = null;
},
},
}}
>
{children}
);
}
```
Then the first check, and it is the reason Bolt is a good place to do
this. Open the preview's address with `/api/auth/session` on the end. You
should see `{"sessionId":null}`: the server half is alive, inside the
preview, before any button exists. The Vite plugin answered it, running in
your tab.
**Correcting potential issues.** Read the change before you accept it. The
ways Bolt tends to drift, and the line to paste back:
- It switched on Bolt Cloud's sign-in as well, or wrote a `users` table for
its own login. Paste: "BuildBase is the only sign-in in this app. Remove
the other sign-in pages and the users table for them, and keep every
other table."
- It put the secret in `.env` as `VITE_BUILDBASE_CLIENT_SECRET`, or read it
in the provider. Paste: "BUILDBASE*CLIENT_SECRET is read only inside
server/auth.ts. Remove every other reference and the VITE* prefix."
- It wrote the three routes as Bolt server functions when you asked for
route B, or as Vercel files when you asked for route A. Paste the route
you chose, by name, with the file list from the prompt.
- `/api/auth/session` returns the app's HTML in the preview. The Vite
plugin is missing from `vite.config.ts`. Paste: "Add the buildbaseAuth
plugin from the Vite guide to vite.config.ts, before react()."
### 4. The secret, and where it must never go
During building, the secret lives in `.env` as `BUILDBASE_CLIENT_SECRET`,
with no prefix, next to the three public `VITE_` values. The Node process
that reads it is the Vite dev server in your tab, which is yours, so this
is safe in the same way a `.env` on your laptop is safe. Two things keep it
that way.
**`.env` in `.gitignore` before GitHub.** Bolt commits every non-breaking
change to the repository on its own, and Bolt's secrets page says "never
store secrets in plain text in your code". A `.env` that is not ignored is
code as far as a commit is concerned. Check the file before you connect
the repository, not after.
**A separate auth client for building.** Create a second client in the
console, call it "Bolt preview", and use its secret in `.env`. If a preview
secret ever leaks, you regenerate that client's secret in the console and
nothing about the live site changes. The console shows a secret in full
once, when the client is created, so copy it then.
For the live site, the secret goes where the functions run. On route B
that is the host's environment variables: Vercel's project settings,
Netlify's site settings, Cloudflare's secrets. On route A it is Bolt's
Secrets page, reached from the database icon at the top of the project,
which Bolt's docs say is readable by server functions and, on an
individual account, by the project owner only. Prefixes stay the same
everywhere: three `VITE_` values the browser may see, one bare value it
never does.
```bash
# .env (building) and the host's environment variables (live)
VITE_BUILDBASE_ORG_ID=
VITE_BUILDBASE_CLIENT_ID=
VITE_BUILDBASE_REDIRECT_URL=https://your-app.example.com/sign-in
BUILDBASE_CLIENT_SECRET=
# VITE_BUILDBASE_SERVER_URL defaults to https://api.console.buildbase.app
```
The redirect value is the one that differs between building and live: the
preview's `.env` carries the preview address, and the host's variables
carry the live one. Vite inlines `VITE_` values at build time, so the host
builds with its own.
What you should see: `.env` listed in `.gitignore`, the repository on
GitHub without it, and the host's variables set. Then one more
`/api/auth/session` on the preview, still `{"sessionId":null}`, to confirm
nothing broke while you moved things around.
### 5. Publish, then run the thirty-second check
Publish (route A), or let the host build the latest commit (route B). Then
open your live address with `/api/auth/session` on the end, before you
click anything.
JSON back, `{"sessionId":null}`, means the server half lives on your live
address, and the rest of this guide follows. The app's HTML back means the
route is not there: on route A, Bolt hosting did not put the server
functions under your site's address, and route B is the answer; on route
B, the function files are not in the host's function folder, or the host
built an older commit. Nothing further works until this check passes, and
nothing further is worth debugging until it does.
Then sign in. Open the live address in a private window, click the button
that calls `signIn()` from `useSaaSAuth()`, and you are sent to the hosted
sign-in page, which offers whichever methods you switched on in the
console. Sign up with a second email. You come back to `/sign-in` on your
app, signed in.
Then the two checks a demo skips. Close the browser, reopen the site: still
signed in, because the cookie is good for 30 days, which is the
[default session length](/guides/token-expired-mid-request). Sign out, then
reload: asked to sign in again, because sign-out ended the session on the
server rather than clearing a value in the browser.
The methods are switches, not code: email and password, a magic link, an
email code, a phone sign-in code sent through your own Twilio account,
passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC
provider, and Ethereum or Solana wallets. Turning on Google means creating
the client in Google's console and pasting two values; nothing in the Bolt
project changes.
**Correcting potential issues.** "The redirect address is not allowed" on
the hosted page: the address in `VITE_BUILDBASE_REDIRECT_URL` and the one
registered on the client differ, usually by a trailing slash, `www`, or the
`/sign-in` path. "Sign-in failed" after a correct code: the secret did not
reach the function; check the host's variables, and on route A, Bolt's
Secrets page. Sign-in works in the preview and not on the live site: the
live address is not registered, or the host built with the preview's
`.env` values because `.env` was committed after all.
### 6. A workspace per customer, and the colleague they invite
Every new user lands in their own workspace on first sign-in, with no setup
step. That is on by default for new organizations, and in your app it is
one component for the switcher and the hooks the SDK already has. Prompt
Bolt for the screens; the data model is already there.
```text
Add a workspace switcher to the app header using useSaaSWorkspaces() from @buildbase/sdk/react, and a /settings page that opens the SDK's built-in workspace, members and billing screens.
Members with the admin role may invite teammates by email; everyone else sees the member list read-only.
Do not create workspace, membership or role tables in Bolt Cloud or Supabase; BuildBase holds them.
```
What you should see: a switcher listing the workspaces the signed-in person
belongs to, with **Add team** creating another if you allow it. On the
members screen, inviting an address that has no account yet sends an email
with a link; the person signs up and lands in the workspace with the role
you chose. That flow has been in the SDK since version 0.0.71, and the
reasons an invite can be refused (a seat limit, an outsider policy) come
back as named errors rather than silence.
Why not let Bolt write the tables? Bolt's own security audit is better
than most at catching what goes wrong here: its help page says it checks
"that protected parts of your app require an account", that "users can't
do things you don't intend, like changing a price", and that keys are not
"sent to visitors' browsers". What no audit can check is which workspace a
row belongs to, because a generated `teams` table has no rule for that
until someone writes one, and the role column it adds is checked on one
page and nowhere else. The SDK's roles are enforced by the API, so a member
who types the address of an admin page is refused by the server, not just
by a missing menu item. Bolt Cloud's sign-in page, read today, mentions no
roles, teams or permissions for the people using your app, so whatever a
prompt builds here is built from scratch.
**Correcting potential issues.** If a member can see another workspace's
rows by changing an id in the address bar, Bolt wrote a page that reads
your database without scoping it. That is your data and your query, and
the next section is about it.
### 7. Your data stays where it is: the one honest wrinkle
Your tables stay in Bolt Cloud or in your Supabase project. The rule we
give every agent is "do not use BuildBase as the primary database", and it
applies here. Supabase's own post of 30 September 2025 says Bolt Cloud
backends run on Supabase, so the wrinkle is the same on both: row-level
security policies keyed to the old sign-in (`auth.uid()` and friends) do
not know who a BuildBase user is, because a BuildBase session is an opaque
id, not a token Supabase can read.
There are two ways through, and most apps want the first.
**Read and write through server routes.** A function on the host (or a
server function on route A) checks the BuildBase session and queries your
database with a server-side credential, scoped by the BuildBase user or
workspace id. This is the pattern generated apps should use anyway, because
it puts the permission check where it cannot be forged. The server SDK
makes the check one call:
```ts
// server/buildbase.ts
import BuildBase from '@buildbase/sdk';
// The Vite guide's cookie: bb-session-id, or bb-session-id- when
// VITE_BUILDBASE_ENVIRONMENT names a development or staging environment.
const readCookie = (request: Request) =>
(request.headers.get('cookie') ?? '').match(
/(?:^|;\s*)bb-session-id=([^;]+)/
);
export function bbFor(request: Request) {
const match = readCookie(request);
return BuildBase({
serverUrl:
process.env.VITE_BUILDBASE_SERVER_URL ||
'https://api.console.buildbase.app',
orgId: process.env.VITE_BUILDBASE_ORG_ID!,
getSessionId: async () => (match ? decodeURIComponent(match[1]) : null),
});
}
```
A route that needs the user calls `bbFor(request).users.getProfile()`, and
a missing or expired session comes back as an error rather than a guess.
**Mint a Supabase-shaped token for browser queries.** If pages query
Supabase directly from the browser and you want the existing policies to
keep working, add one more function: it validates the session with the
server SDK, then signs a short-lived HS256 token with your Supabase
project's JWT secret, with `sub` set to the BuildBase user id and `role`
and `aud` set to `authenticated`, and the browser passes it to Supabase as
the bearer token. `auth.uid()` then matches `sub`, so store the BuildBase
user id in your owner columns. The step-by-step is in
[the skill repository](https://github.com/buildbase-app/claude-skill/blob/main/distribution/supabase-jwt.md).
You own that route and its refresh schedule. The platform change that would
make it unnecessary, BuildBase publishing signing keys so Supabase can
verify a user token directly, is recorded as not built.
Run Bolt's database review after a change this size. Its help page says it
"checks your database rules and permissions and flags anything that could
make your data insecure, like a permission rule that allows anyone to read
a table", and the full audit is a free button in the Publish menu
(prompting Bolt to audit costs tokens; the button does not).
### 8. Plans people can pay for, and the email when a card fails
Plans, prices and trials live in the BuildBase console and sync to your own
Stripe account at Stripe's rates, with a 0% platform fee, and no card data
touches your app. The part that generated apps get wrong is what happens
after the payment, so this step is mostly about the webhook route and the
feature flag.
In the console, create two plans, Launch and Pro, say, each with a 7-day
trial and a monthly and a yearly price. Then the webhook. It is a fourth
function, and this is the prompt for it:
```text
Add api/webhooks/buildbase.ts as a POST function. Verify the signature with parseWebhookEvent from @buildbase/sdk on the raw request body, using BUILDBASE_WEBHOOK_SECRET from the host's environment variables. Handle payment.failed with our own side effects only (flag the workspace, post to Slack); the platform emails the customer itself, but only once I have connected an email sender and switched on the Payment Failed notification event in the console. Ignore other events.
Gate the export feature behind a BuildBase feature flag tied to the Pro plan, checked in a function. Do not store the plan in Bolt Cloud or Supabase.
```
Point an endpoint in the console at
`https://your-app.example.com/api/webhooks/buildbase`, add its signing
secret to the host as `BUILDBASE_WEBHOOK_SECRET`, and publish.
What you should see: subscribe on a test card and the Pro feature appears
without a reload, because the flag follows the workspace's plan. Let the
test card fail on renewal and the email goes out from your sending domain,
because `payment.failed` is one of the 129 events in the catalog and the
console's notification or a workflow sends it; the route in your app is
for whatever you want to happen besides. The console's delivery log shows
each attempt, and a delivery your server was down for is retried up to
five times over about two and a half minutes.
Compare that with Bolt's own Stripe integration, read today: one-time
payments and subscriptions, with "automatic webhook handling for payment
events", and the page says Bolt "automatically handles webhook endpoint
registration and signature verification", on a project that uses Bolt
Database or Supabase and has sign-in set up, and not with Firebase. That is a good integration for
selling one thing to one person. What the page does not describe is a plan
that belongs to a team, seats, limits, trials that end without a card, or
credits, so if a plan has to change what the app does for a whole
workspace, [entitlements rather than flags](/blog/entitlements-are-not-feature-flags)
is the ten-minute read before you prompt.
### Where Bolt's built-in wins
Keep Bolt Cloud's sign-in when your app has one user per account and you
need nothing after login. It is zero-config inside Bolt, it lives in the
same place as your database, its Site URL and redirect list are updated
for you when you publish, and nothing leaves Bolt hosting. Keep Bolt's
Stripe integration when you sell one subscription to one person and want
the webhooks registered and verified without touching them. And keep
Bolt's security audit in either case; it is free from the Publish menu,
and it checks things (a changed price, a key in the browser) that this
guide's setup does not make go away.
Choose BuildBase when the question is "what may this team do now that they
paid": a workspace per customer, invites and roles enforced by the API,
plans with versions, feature flags tied to the plan, credits with a hard
stop, and the lifecycle email, from one SDK, with your data staying in
Bolt Cloud. That is the layer Bolt's help center does not reach today, and
[the launch checklist](/guides/vibe-coded-app-launch-checklist) is the
twenty-item version of why it matters before strangers arrive.
> **Key takeaway:** On Bolt the preview is a real server, so the three routes work before you
> publish. The whole job is making sure the live site has a server too, and the
> thirty-second check in step 5 tells you whether it does.
### What this costs in tokens
Bolt prices building by tokens. On 27 October 2026 its pricing page lists
Free at $0 with 1M tokens a month and a 300K daily cap, Pro at $25 a month
with 10M tokens, rollover and no daily cap, Teams at $30 a member starting
at 10M tokens each, and Enterprise by consumption, with "save up to 28%"
on the annual toggle. Hosting is separate and per account: Free gets 10 GB
of bandwidth and 333,333 requests a month, after which the site stops
displaying until the month resets; Pro gets 30 GB and 1 million requests
with pay-as-you-go above that. Bolt changes these; check the page.
The prompt in step 3 is one request, with perhaps two fix-ups; steps 6 and
8 are one each. The expensive thing on Bolt is not a feature, it is a loop.
A one-star Trustpilot review from 29 August 2026 put it as "half the time
you spend your tokens trying to resolve issues that their own AI has
created itself", and another, from 4 October, reported "approximately 212K
Tokens out of my 300K daily allowance" gone "in a very short period of
time". Naming the exact files, the exact variable names and the exact
guide is how you avoid the loop, and it is why this page is long. The
other half is step 5: do not spend tokens debugging sign-in until the
thirty-second check passes, because until it does, the problem is not in
the code Bolt wrote.
BuildBase's side: a Free plan at $0, then Launch at $19 a month, with a 7-day
trial and no card on the paid plans.
### What breaks, and how you can tell
**`/api/auth/session` returns HTML on the live site and JSON in the
preview.** Step 5. The live site has no server for the routes: on route A
the functions are not under your site's address, on route B the function
files are not in the host's folder. Route B, or the folder.
**"Sign-in failed" on a correct code.** The secret did not reach the
function. Check the host's variables, or Bolt's Secrets page on route A.
**Sign-in works in the preview and loops on the live site.** The live
address is not registered with `/sign-in` on the end, or the host built
with the preview's redirect value because `.env` was committed. Step 2 and
step 4.
**The secret is in the repository.** `.env` was not ignored before Bolt
connected GitHub. Regenerate the secret in the console (the old one stops
working immediately), add `.env` to `.gitignore`, and treat the old value
as public.
**The preview address changed and sign-in there stopped.** The project
restarted. Register the new address, or test sign-in on the live site
only.
**Rows vanish, or "permission denied", after switching sign-in.** Row rules
keyed to the old sign-in no longer match. Section 7: route the reads
through the server, or mint the token.
**The package install fails in the preview.** Bolt runs Node inside the
browser, which cannot load compiled native addons, and the SDK's
dependencies are plain JavaScript, so read the install error before
assuming the package; it is usually another dependency the agent added in
the same change.
### Install
In Bolt, the install is a sentence in the chat: "Use the @buildbase/sdk
npm package", and `npm install` runs in the preview's terminal. On a
checkout of the repository, it is the usual line:
```bash
npm i @buildbase/sdk
```
---
## Add login, teams and paid plans to a Replit Agent app, and keep Replit's database for your data
> A Replit project is a real Linux workspace with a shell, so the SDK installs like anywhere else. The three sign-in routes go on the Express server Agent already wrote; we ran them on 27 October 2026.
- Source: https://www.buildbase.app/guides/add-login-teams-and-paid-plans-to-a-replit-app
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-28
- Updated: 2026-11-04
### In short
To add login, teams and paid plans to a Replit Agent app, run npx buildbase init, mount the three sign-in handlers on the Express server through a 26-line adapter tested on 27 October 2026, put the secret in Secrets and in the published app, and keep your data in Replit Database. Teams and plans are SDK calls.
You are adding real sign-in, a workspace per customer, paid plans and the
email that goes out when a card fails to an app Replit's Agent built for
you, without moving your data out of Replit Database. When it works, a
stranger opens your published address in a private window, signs up with
Google or a magic link, lands in their own workspace, invites a colleague
who gets an email, picks a plan on a test card, and the feature they paid
for appears without a reload. The client secret lives in Secrets and never
reaches the browser.
Replit is the easiest of the builders to do this on, for one reason: a
Replit project is a real Linux workspace with a shell. `npm install`
installs, `npx` runs, and the server Agent wrote is a Node process you can
read. There is no "where does the server live" question, which is most of
the Bolt and Lovable guides. The question here is different: Replit does
not document which stack Agent generates, so step 1 is finding out, and
the rest of the guide is written for the layout Replit's own pages
describe indirectly, a React front end on an Express server with
PostgreSQL behind it.
What we ran on 27 October 2026: the three sign-in handlers from
[BuildBase on Vite](/guides/buildbase-on-vite), unchanged, mounted on
Express 4.22.3 through a 26-line adapter, with `@buildbase/sdk` 0.0.90
installed from npm, Node 22, the API routes ahead of a stand-in for the
Vite middleware, on port 5000 as Replit's template expects. Each route
answered as the guide says it should: the session route returned
`{"sessionId":null}` with no cookie and `{"sessionId":"abc123"}` with one,
the token route returned 400 with no code and 401 with a bogus one (our
platform rejected it, as it should), and sign-out set the cookie with
`Max-Age=0`. The same results held with `express.json()` applied globally
before the routes, which is how Agent's generated server does it, and
`tsc` reported no errors. What we have not run: anything inside Replit
itself (the Shell, Secrets, Publishing), `npx buildbase init` in a Replit
project, the ESM layout Replit's template uses, or the hosted sign-in
round trip, which needs a registered address. Where a Replit behaviour
decides whether a step works, this guide quotes Replit's page and says so.
> **Before you start:** A Replit project built by Agent, on any plan (Starter publishes one app, which
> Replit's page says goes down after 30 days). A BuildBase organization, and an
> auth client created in the console under **User Management → Authentication**,
> with its client ID and secret. Your published address, registered on that
> client as a redirect URL ending in `/sign-in`. A Stripe account, only when you
> reach plans.
> **Tip:** The handlers in this guide are the Vite guide's, byte for byte, and the
> server-side pattern is the [Express guide](/guides/buildbase-on-express)'s.
> This page is the Replit wrapping around them: the Shell, Secrets, the adapter,
> and the prompts that keep Agent on the rails.
### 1. Find out what Agent built
Open `package.json` from the file tree and read the dependencies. Then
open `replit.md`, which Agent writes at the root of every project and
reads before every request; its first lines usually name the stack.
Replit's docs do not state what Agent generates, but three of its pages
say it sideways. The deployment types page says "Agent builds full-stack
apps that need a backend server, so use Autoscale or Reserved VM for
those". The Clerk Auth page says Agent protects "your API routes" with
"Clerk's Express middleware". And the `replit.md` examples describe "React
frontend, Node.js backend, PostgreSQL database" and an app "built with
React and Express.js". So the layout to expect is one `package.json` with
`react`, `vite`, `express` and a Postgres client, a `client/` folder the
Vite dev server serves, a `server/` folder Express runs, and a `shared/`
folder between them.
Three cases, and what each means for the rest of this page:
- **`express` and `vite` both listed.** This guide applies as written. The
three routes go on the Express server, and the provider goes in the React
app.
- **`next` listed.** You have a Next.js app, and `npx buildbase init` in
the Shell writes all ten files, including the three route handlers and
the webhook. Follow the [v0 guide](/guides/add-sign-in-teams-and-paid-plans-to-a-v0-app)
from its step 2 and come back here for Secrets and Publishing.
- **`express` with no `vite`, or a server with HTML templates.** The
[Express guide](/guides/buildbase-on-express) is the right one: the
server drives sign-in itself and `req.user` keeps working.
What you should see: a sentence you can say out loud, "my app is React on
Express with Postgres", before you prompt anything.
### 2. Register where people come back to
The hosted sign-in page sends people back to one exact address per
environment, so register them before you prompt: your published
`.replit.app` address with `/sign-in` on the end, your custom domain with
`/sign-in` if you have one, and the preview's `replit.dev` address if you
want to test sign-in before publishing. An address it was not told about
is refused.
The preview address is the one to watch. It is a `replit.dev` address
Replit assigns to the running project, and it is not the published one.
Register it if you want to sign in during building; otherwise register the
published address and test sign-in there. Replit's own sign-in keeps a
list of your app's domains in the `REPLIT_DOMAINS` environment variable
and asks you to republish to refresh it; that list governs Replit Auth,
not this one, and the addresses on the BuildBase client are the only ones
that matter here. [Login that works after you
publish](/guides/login-that-works-after-you-publish) is the troubleshooting
page for either.
What you should see: the auth client in the console lists each address,
and the client secret has been shown once. Do not paste it into the Agent
chat or into `replit.md`.
### 3. Install the skill and run `init` in the Shell
Open the Shell (Tools, then Shell) and run three commands. The first
installs the BuildBase skill, which is the set of rules that keeps Agent
from building its own sign-in next to this one; the second installs the
SDK; the third writes the provider and the environment file.
```bash
npx skills add buildbase-app/claude-skill
npm i @buildbase/sdk
npx buildbase init --org-id
```
Replit's Agent Skills page says installed skills live under
`/.agents/skills/`, that "only a brief description loads until the skill
is invoked", and that skills "installed via CLI or copied from the internet
have not" been audited, so read the skill's `SKILL.md` once yourself; it
is short. If the first command put the skill somewhere else, move the
folder under `.agents/skills/`.
`init` reads `package.json` to tell Next.js, Vite and Express apart. When
it finds both `vite` and `express`, it treats the project as Vite, because
that is the order it checks in, so on this layout it writes the provider
under `src/` (or `client/src/`) and `.env.example` with the variable
names, and prints the Vite guide's address for the three handlers, which
step 4 covers. It never overwrites a file. It leaves every secret empty
and refuses a secret passed on the command line, which is the behaviour
you want in a shared workspace. We have not run it inside a Replit
project; if it reports a path you did not expect, the provider is one file
and step 4's prompt names where it goes.
Then two lines in `replit.md`, so every future request starts from the
same rules:
```text
## Sign-in, teams and billing
BuildBase (@buildbase/sdk) is the only sign-in in this app. Do not add Replit Auth, Clerk or a users table. Workspaces, roles, plans and credits live in BuildBase; app data stays in Replit Database and every query scopes by the workspace id from the BuildBase session. Secrets stay in the Secrets tool, never in code, never with a VITE_ prefix.
```
What you should see: `@buildbase/sdk` in `package.json`, a provider file,
`.env.example`, and the two lines in `replit.md`.
### 4. Mount the three routes on Express
The handlers are the Vite guide's `server/auth.ts`, plain `Request` to
`Response` functions. Express 4 speaks its own request and response
objects, so a small adapter turns one into the other. This is the file we
ran today, as written:
```ts
// server/buildbase-routes.ts
import express, {
Router,
type Request as Req,
type Response as Res,
} from 'express';
import { session, signout, token } from './auth.js';
type WebHandler = (request: Request) => Response | Promise;
/** Run a web-standard `Request -> Response` handler as an Express route. */
const adapt = (handler: WebHandler) => async (req: Req, res: Res) => {
const headers = new Headers();
for (const [name, value] of Object.entries(req.headers))
if (value !== undefined)
headers.set(name, Array.isArray(value) ? value.join(', ') : value);
const hasBody =
req.method !== 'GET' && req.method !== 'HEAD' && req.body !== undefined;
const request = new Request(
`${req.protocol}://${req.get('host')}${req.originalUrl}`,
{
method: req.method,
headers,
body: hasBody ? JSON.stringify(req.body) : undefined,
}
);
const response = await handler(request);
res.status(response.status);
response.headers.forEach((value, name) => res.append(name, value));
res.send(Buffer.from(await response.arrayBuffer()));
};
export const authRouter = Router();
authRouter.post('/api/auth/token', express.json(), adapt(token));
authRouter.get('/api/auth/session', adapt(session));
authRouter.post('/api/auth/signout', adapt(signout));
```
Two choices in it are deliberate. The token route parses JSON with
`express.json()` and re-serialises the body, rather than streaming the raw
request, because Agent's generated `server/index.ts` applies
`express.json()` to every route before any of yours, which consumes the
stream; this adapter works either way, and we checked both. And
`Set-Cookie` is copied with `res.append`, so the session cookie arrives as
its own header rather than folded into another.
Then the router goes on the app before the Vite middleware, so the API is
never swallowed by the front-end fallback. Paste this prompt:
```text
Use the @buildbase/sdk npm package, already installed, to add BuildBase sign-in to this app. Read https://www.buildbase.app/llms.txt first and do not invent endpoints.
- Create server/auth.ts with the token, session and signout handlers from https://www.buildbase.app/guides/buildbase-on-vite, byte for byte.
- Create server/buildbase-routes.ts with the adapter from the BuildBase Replit guide and mount authRouter in server/index.ts before the Vite middleware and before any catch-all route.
- Keep the BuildBaseProvider that npx buildbase init wrote and wrap the React app in it in client/src/main.tsx, with import '@buildbase/sdk/css'.
- Read VITE_BUILDBASE_ORG_ID, VITE_BUILDBASE_CLIENT_ID and VITE_BUILDBASE_REDIRECT_URL from the environment; I will add BUILDBASE_CLIENT_SECRET in Secrets myself. Never read it in client/ and never give it a VITE_ prefix.
- Do not add Replit Auth, Clerk, Passport or a users table. If sign-in already exists in this app, stop and ask me before changing it.
```
What you should see: three new files and one changed one, and nothing
under `client/` that mentions the secret. The provider `init` wrote is the
Vite guide's: `getSession` fetches `/api/auth/session` once per page load,
`handleAuthentication` posts the one-time code to `/api/auth/token`, and
`onSignOut` posts to `/api/auth/signout`, so the three routes are the whole
contract between the two halves.
**Correcting potential issues.** Read the change before you accept it. The
ways Agent tends to drift, and the line to paste back:
- It mounted the router after the catch-all, so `/api/auth/session`
returns the app's HTML. Paste: "Mount authRouter in server/index.ts
before the Vite middleware and before any route that serves index.html."
- It rewrote the handlers as Express middleware with `req.body` and
`res.cookie`. Paste: "Keep server/auth.ts byte for byte as the guide has
it and keep the adapter; do not rewrite the handlers."
- It added Replit Auth "as a fallback", or kept a `users` table for its
own login. Paste: "BuildBase is the only sign-in in this app. Remove the
other sign-in and its users table, and keep every other table."
- It read the secret in a client file, or prefixed it `VITE_`. Paste:
"BUILDBASE*CLIENT_SECRET is read only inside server/auth.ts on the
server. Remove every other reference and the VITE* prefix."
### 5. Secrets, twice
Open Tools, then Secrets under Setup, and add `BUILDBASE_CLIENT_SECRET`
with the value the console showed you once. Replit's secrets page says the
tool "automatically encrypts the data and makes it available to your
Replit project as an environment variable", which is exactly how
`server/auth.ts` reads it. The three public values can go in the same tool
as configurations (its "separate sections for secrets and
configurations") or in `.env`; either way they reach Vite as `VITE_`
variables, which Vite inlines into the browser bundle, which is fine for
an organization id and a client id and fatal for a secret.
```bash
# Secrets tool (the one bare value) and configurations (the three public ones)
BUILDBASE_CLIENT_SECRET=
VITE_BUILDBASE_ORG_ID=
VITE_BUILDBASE_CLIENT_ID=
VITE_BUILDBASE_REDIRECT_URL=https://your-app.replit.app/sign-in
# VITE_BUILDBASE_SERVER_URL defaults to https://api.console.buildbase.app
```
Then the second time, and this is the step people miss. Replit's
troubleshooting page says "Secrets you set in the Project Editor do not
automatically carry over to your published app. Add all production Secrets
and environment variables in the Publishing pane", under Adjust settings,
Production app secrets. One value differs between the two: the redirect,
which carries the `replit.dev` address in development and the published
one in production, and Replit's secrets page adds that the tool has a
"New published app configuration" option for exactly this.
What you should see: `printenv | grep BUILDBASE` in the Shell lists the
four names with the secret present (Replit's page says `printenv` is how
to see every variable; organization members without the Owner role cannot
read secret values in the tool but can print them, which is worth knowing
before you share the workspace).
### 6. Run, then publish, then sign in from a private window
Press Run and open the preview. Before any button exists, open the
preview's address with `/api/auth/session` on the end. You should see
`{"sessionId":null}`: the server half is alive. That is the response we
got today from the same router on the same handlers, and it is the first
thing to check whenever sign-in misbehaves later, because the app's HTML
there means the route is not mounted ahead of the fallback.
Publish with the default deployment type. Replit's page says Autoscale "is
the default and recommended choice" for web apps and APIs, that Static
"is not compatible with Replit Apps created using Agent", and that Secrets
"are available for all deployment types except Static Deployments".
`REPLIT_DEPLOYMENT` is set to `1` in the published app if you ever need to
tell the two apart in code.
Then sign in. Open the published address in a private window, click the
button that calls `signIn()` from `useSaaSAuth()`, and you are sent to the
hosted sign-in page, which offers whichever methods you switched on in the
console. Sign up with a second email. You come back to `/sign-in` on your
app, signed in.
Then the two checks a demo skips. Close the browser, reopen the site: still
signed in, because the cookie is good for 30 days, which is the
[default session length](/guides/token-expired-mid-request). Sign out, then
reload: asked to sign in again, because sign-out ended the session on the
server rather than clearing a value in the browser; today's test showed
the sign-out response clearing the session cookie with `Path=/; HttpOnly;
SameSite=Lax; Max-Age=0`. The guide names that cookie `bb-session-id`, as
`npx buildbase init` does.
The methods are switches, not code: email and password, a magic link, an
email code, a phone sign-in code sent through your own Twilio account,
passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC
provider, and Ethereum or Solana wallets. Turning on Google means creating
the client in Google's console and pasting two values; nothing in the
Replit project changes.
**Correcting potential issues.** "The redirect address is not allowed" on
the hosted page: the address in `VITE_BUILDBASE_REDIRECT_URL` and the one
registered on the client differ, usually by a trailing slash or the
`/sign-in` path, or production is still carrying the `replit.dev` value.
"Sign-in failed" after a correct code: the secret did not reach the
published app; Production app secrets, not the editor's Secrets, is where
it has to be. The preview works and the published app does not: Replit's
troubleshooting page puts production Secrets and the port configuration
first, and so do we.
### 7. A workspace per customer, and the colleague they invite
Every new user lands in their own workspace on first sign-in, with no setup
step. That is on by default for new organizations. In your app it is one
component for the switcher plus the hooks the SDK already has, so prompt
Agent for the screens; the data model is already there.
```text
Add a workspace switcher to the app header using useSaaSWorkspaces() from @buildbase/sdk/react, and a /settings page that opens the SDK's built-in workspace, members and billing screens.
Members with the admin role may invite teammates by email; everyone else sees the member list read-only.
Do not create workspace, membership or role tables in Replit Database; BuildBase holds them. Add a workspace_id column to every table that holds customer data, filled from the BuildBase session on the server, and filter every query by it.
```
What you should see: a switcher listing the workspaces the signed-in person
belongs to, with **Add team** creating another if you allow it. On the
members screen, inviting an address that has no account yet sends an email
with a link; the person signs up and lands in the workspace with the role
you chose. That flow has been in the SDK since version 0.0.71, and the
reasons an invite can be refused (a seat limit, an outsider policy) come
back as named errors rather than silence.
Why not let Agent write the tables? Because Replit's own options do not
have this layer either, and the page says so. Replit Auth means "users
sign in with their existing Replit accounts" on a Replit-branded page.
Clerk Auth gives your app its own tenant and branded sign-in, and under
"What's not supported" the same page lists "Organization tenants, Clerk's
organization and team-membership features". So whatever Agent builds for
teams, it builds from scratch. Every audit of a generated app finds the
same thing: a role column checked on one page and nowhere else. The SDK's
roles are enforced by the API, so a member who types the address of an
admin page is refused by the server, not just by a missing menu item.
**Correcting potential issues.** If a member can see another workspace's
rows by changing an id in the address bar, Agent wrote a query that
filters by the row id and not by the workspace. That is your data and your
query, and the next section is about it.
### 8. Your data stays in Replit Database, and it is simpler here
Your tables stay in Replit Database. The rule we give every agent is "do
not use BuildBase as the primary database", and it applies here. On
Supabase-shaped backends there is a wrinkle, because row-level security
policies keyed to the old sign-in cannot read a BuildBase session; on
Replit there is not, because the database is PostgreSQL that your Express
server reads with a server-side connection, and the permission check lives
in the route, where it cannot be forged.
So the pattern is one helper and one habit. The helper binds the server
SDK to the request's cookie:
```ts
// server/buildbase.ts
import BuildBase from '@buildbase/sdk';
import type { Request } from 'express';
export function bbFor(req: Request) {
// The Vite guide's cookie: bb-session-id, or bb-session-id- when
// VITE_BUILDBASE_ENVIRONMENT names a development or staging environment.
const match = (req.headers.cookie ?? '').match(
/(?:^|;\s*)bb-session-id=([^;]+)/
);
return BuildBase({
serverUrl:
process.env.VITE_BUILDBASE_SERVER_URL ||
'https://api.console.buildbase.app',
orgId: process.env.VITE_BUILDBASE_ORG_ID!,
getSessionId: async () => (match ? decodeURIComponent(match[1]) : null),
});
}
```
The habit is that every route that touches customer data asks the SDK who
is asking and which workspace they are in, and passes that workspace id
into the query. A route with no session gets an error from the SDK rather
than a guess, and a query without a `workspace_id` filter is the bug to
look for in every change Agent makes from now on. The pattern is spelled
out, with the audit that found "any logged-in user could grant themselves
admin", in [teams, invites and admin versus
member](/guides/teams-invites-and-roles-for-a-vibe-coded-app).
One Replit-specific comfort. After the July 2025 incident in which the
agent deleted a customer's production database during a code freeze,
Replit rolled out automatic separation of development and production
databases, so the test data you create in the preview does not sit next to
real customers' rows. Jason Lemkin's line from that week, "there is no way
to enforce a code freeze in vibe coding apps like Replit", is the reason
to keep the permission check in a route you can read rather than in a
table rule you cannot.
### 9. Plans people can pay for, and the email when a card fails
Plans, prices and trials live in the BuildBase console and sync to your own
Stripe account at Stripe's rates, with a 0% platform fee, and no card data
touches your app. The part that generated apps get wrong is what happens
after the payment, so this step is mostly about the webhook route and the
feature flag.
In the console, create two plans, Launch and Pro, say, each with a 7-day
trial and a monthly and a yearly price. Then the webhook. On Express it
needs the raw body, because the signature is computed over the bytes, and
Agent's global `express.json()` would parse them first:
```text
Add server/buildbase-webhook.ts and mount it in server/index.ts as app.post('/api/webhooks/buildbase', express.raw({ type: 'application/json' }), buildbaseWebhook), before express.json(). Verify the signature with parseWebhookEvent from @buildbase/sdk on the raw body, using BUILDBASE_WEBHOOK_SECRET from Secrets. Handle payment.failed with our own side effects only (flag the workspace, post to Slack); the platform emails the customer itself, but only once I have connected an email sender and switched on the Payment Failed notification event in the console. Ignore other events.
Gate the export feature behind a BuildBase feature flag tied to the Pro plan, checked in a server route. Do not store the plan in Replit Database.
```
Point an endpoint in the console at
`https://your-app.replit.app/api/webhooks/buildbase`, add its signing
secret as `BUILDBASE_WEBHOOK_SECRET` in Secrets and again in Production app
secrets, and republish.
What you should see: subscribe on a test card and the Pro feature appears
without a reload, because the flag follows the workspace's plan. Let the
test card fail on renewal and the email goes out from your sending domain,
because `payment.failed` is one of the 129 events in the catalog and the
console's notification or a workflow sends it; the route in your app is
for whatever you want to happen besides. The console's delivery log shows
each attempt, and a delivery your server was down for is retried up to
five times over about two and a half minutes. Autoscale scales to zero
when idle, which is fine: the first retry wakes it.
Compare that with Replit's own routes to payments, read today: the Stripe
connector, on paid plans, where Agent sets up a Stripe sandbox and you
connect the live account from the Publish pane, or your own keys in
Secrets with the Checkout page and webhook endpoint Agent writes. Its
Stripe page walks through deposits, balance charges and refunds for a
booking app and mentions a monthly subscription with Stripe Billing as a
customisation. It says nothing about a plan that belongs to a team, seats,
limits, trials that end without a card, or credits, so if a plan has to
change what the app does for a whole workspace, [entitlements rather than
flags](/blog/entitlements-are-not-feature-flags) is the ten-minute read
before you prompt.
### Where Replit's built-in wins
Keep Replit Auth when your app is a prototype or an internal tool and
Replit branding is acceptable, which is Replit's own description of where
it fits; it is one sentence to Agent, Replit sends the password reset
emails for you, and there is nothing to configure. Keep Clerk Auth when
you want a branded sign-in with separate development and production user
stores and you need nothing after login; Replit provisions the tenant,
stores the keys and switches them at publish time, and its migration from
Replit Auth to Clerk moves the accounts for you. Keep Replit's Stripe
connector when you sell one thing to one person and want the sandbox and
the live switch handled for you.
Choose BuildBase when the question is "what may this team do now that they
paid": a workspace per customer, invites and roles enforced by the API,
plans with versions, feature flags tied to the plan, credits with a hard
stop, and the lifecycle email, from one SDK, with your data staying in
Replit Database. That is the layer Replit's pages list as not there today,
and [the launch checklist](/guides/vibe-coded-app-launch-checklist) is the
twenty-item version of why it matters before strangers arrive.
> **Key takeaway:** On Replit there is a shell and a server, so nothing here is a workaround: the
> three routes mount on Express through 26 lines we ran today. The two things to
> get right are the secret, twice, and a workspace id on every query.
### What this costs in credits
Replit prices Agent work by effort. Its AI billing page says one
checkpoint is created per request, that complex builds are "bundled into
one checkpoint that may cost more than a simple request", and that "Replit
asks for confirmation before a paid action". On 27 October 2026 the
pricing page lists Core at $20 a month ($18 billed annually) with $20
towards models, Pro at $100 ($90 annually) with $100 and rollover for two
months, and Enterprise as custom; the Starter plan has daily Agent credits
up to a monthly cap and one published app that goes down after 30 days.
Published apps, the database and storage are billed by usage from the same
credits. Replit changes these; check the page.
The prompts in steps 4, 7 and 9 are three checkpoints, with perhaps two
fix-ups. The expensive thing on Replit is not a feature, it is a loop, and
the loop here has a name: a one-star Trustpilot review from 17 October 2026
reads, in full, "Users can't log in. AI gets into a failure loop." Another,
from 20 September, warns that "especially if you set the limit 50 dollar
it turns out take 300 dollar". Naming the exact files, the exact routes
and the exact guide is how you avoid the loop, and `replit.md` is how you
avoid it next month too. A non-developer who built a SaaS on Replit in
three hours in July 2026 chose it because "I wanted authentication,
payments, and a database without configuring anything myself", and called
the lock-in "the uncomfortable trade-off for the convenience"; this guide
is the version of that trade where the accounts, the teams and the plans
are yours to take with you.
BuildBase's side: a Free plan at $0, then Launch at $19 a month, with a 7-day
trial and no card on the paid plans.
### What breaks, and how you can tell
**`/api/auth/session` returns the app's HTML.** Step 4. The router is
mounted after the Vite middleware or the catch-all. Move it up.
**"Sign-in failed" on a correct code.** The secret is not in Production
app secrets, only in the editor's Secrets. Step 5, the second half.
**Sign-in works in the preview and loops after publishing.** Production is
still carrying the `replit.dev` redirect value, or the published address
is not registered with `/sign-in` on the end. Step 2 and step 5.
**The token route returns 400 with a stack trace in the log.** The body
was not JSON. The adapter hands malformed JSON to Express's parser, which
answers 400 on its own; the provider always sends JSON, so this is a
hand-made request, not the app.
**The webhook returns 401 on every delivery.** `express.json()` parsed the
body before the raw handler saw it. Mount the webhook route with
`express.raw` ahead of `express.json()`.
**A member can see another workspace's rows.** The query filters by the row
id and not by `workspace_id`. Section 8, the habit.
**`npx buildbase init` says "could not tell the framework".** Neither
`next`, `vite` nor `express` is in `package.json`. Pass
`--framework vite` for the provider, and mount the routes by hand as in
step 4.
### Install
In the Shell:
```bash
npm i @buildbase/sdk
npx buildbase init --org-id
```
---
## Emails that arrive: confirmation, reset and welcome emails for an AI-built app
> The confirmation email worked for you and never reaches a stranger, because the sender is for development. Find the sender, put your domain behind it, and make the lifecycle emails run on their own.
- Source: https://www.buildbase.app/guides/emails-that-arrive-for-an-ai-built-app
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-28
### In short
An AI-built app sends confirmation and reset emails through a development sender until you connect a domain: Supabase delivers only to your project team, two an hour, and BuildBase uses whichever sender was created first. Find the sender, verify a domain, move the default, then make the lifecycle emails workflows.
"Then a real person signs up, never gets the confirmation email, and you
never hear from them again." A dev.to writer put that at the top of a
seven-step guide for beginners on 20 October 2026, and it is the whole
failure in one sentence: the email worked for you, in the preview, and
that is the last time it worked.
You are making three kinds of email arrive, in this order: the ones the
app cannot work without (confirmation, magic link, password reset,
invitation), the ones that make it a product (welcome, trial ending, card
failed), and the ones people opt into (campaigns, digests). When it works,
a stranger signs up from a Gmail address, gets the confirmation in under a
minute from your own domain, the welcome arrives after it, the trial-ending
reminder goes out three days before the trial ends with no code involved,
and every one of those messages is in a log you can open.
What we ran on 27 October 2026: the sender, domain and workflow pieces here
are the ones the published guide on
[transactional email landing in spam](/guides/transactional-email-landing-in-spam)
and the notifications guide are built on; the Supabase and Resend figures
were read from their pages today. We have not sent test mail through a
builder's own pipeline today, so where a builder's behaviour matters it is
named rather than claimed.
> **Before you start:** A domain you control and can add DNS records to. An app with sign-in working,
> either the builder's built-in or BuildBase. A second email address at a
> provider you do not use for work, to test with. For the workflow steps,
> BuildBase sign-in, because the triggers are platform events.
### 1. Find out which sender sent the last email
Before you touch DNS, open the last email your app sent and read the
sender address, because the fix depends entirely on who sent it. There are
three usual answers, and two of them are development senders.
**The builder's or Supabase's default sender.** If your app's sign-in is
Lovable Cloud, Bolt Cloud or your own Supabase project, the confirmation
email comes from Supabase's built-in sender until you change it. Supabase's
docs on custom SMTP say three things about that sender: "Supabase Auth
will refuse to deliver messages to addresses that are not part of the
project's team", "currently this value is set to 2 messages per hour", and
the server "is not meant for production use". That is why your own
confirmation arrived and a stranger's did not: you are on the team, and
they are not, and even on the team the third sign-up in an hour waits.
**A personal Google account somebody connected during setup.** This is
the BuildBase version of the same trap, and it is quieter. System mail
(the magic link, the verification code, the password reset code, the
workspace invitation) does not name a sender; it goes through whichever
single sender in the organization is flagged as the system default, which
is usually the first sender anyone created. Every way of creating a sender
fills that flag only if it is empty, and never moves it. So if someone
connected their own Google account to check that email works, and weeks
later someone else added a verified domain and a Mailgun sender on it,
every sign-in link since has still gone out through Gmail, from the first
person's address, and no DNS record you fix will change that.
**An email API the agent wired directly.** A `fetch` to Resend's or
SendGrid's API with a key from the environment and a hard-coded sender,
usually `onboarding@resend.dev` or a bare address on an unverified domain.
It works in the sense that the request is well formed; Resend's free plan
sends 3,000 emails a month, 100 a day, and the test domain is for testing.
How to prove which one you have: in Supabase, Authentication, SMTP
Settings tells you whether custom SMTP is on; in BuildBase, the email
history row stores the `from` it used and the sender it went through, and
an organization owner can list every sender in the org with its
`systemDefault` flag. If the sender you expected is not the one in the
history, step 3 is the fix.
What you should see: one sentence you can say out loud, "the confirmation
email goes out through X from address Y", before you change anything.
### 2. Put a domain you own behind it
A sender on a domain you own, with the three DNS records that let other
mail servers trust it, is the whole of deliverability for an app this
size. On BuildBase, connect a sender through Google, Mailgun, Amazon SES or
your own SMTP; on Supabase, turn on custom SMTP with a sender from any of
the services its docs name (Resend, SES, Postmark, SendGrid, ZeptoMail,
Brevo), after which mail goes to everyone, at 30 an hour until you raise
the limit on the rate-limits page.
Two decisions before the records:
**A subdomain, not the root.** Send from `mail.example.com` rather than
`example.com`. If a campaign ever damages the sending reputation, it
damages the subdomain, and your personal mail on the root keeps arriving.
It also lets the sign-in mail and the marketing mail live on different
subdomains with different reputations.
**One sender for system mail.** The magic link, the reset code and the
invitation should come from a sender on the verified domain, with a From
name that is your product and a reply-to that a human reads. A reset code
from `no-reply@mail.example.com` with the product name is fine. One from
`firstname.lastname@gmail.com` is the first thing a stranger notices.
The records themselves (SPF, DKIM, DMARC) are three TXT entries your DNS
provider shows you how to add, and the sender's own page prints the values.
What matters more than adding them is checking them, which is what the
next guide does: [transactional email landing in
spam](/guides/transactional-email-landing-in-spam) reads the
`Authentication-Results` header on a copy in the spam folder and tells you
which of the three failed, instead of guessing. On BuildBase, domain
verification runs through Mailgun regardless of which provider delivers a
given sender, so a verified sending domain needs Mailgun connected even if
SES delivers the mail.
#### The three records, in plain words
You do not have to understand the records to add them, but you do have to
understand them to read a failure, so here is each in one breath.
SPF is a list, published on your domain, of the servers allowed to send
mail that claims to come from it. If Mailgun sends your reset code and
Mailgun is not on the list, the receiving server has no reason to believe
the message is yours. The sender's page tells you the one entry to add, and
a domain can carry only one SPF record, so a second sender joins the same
record rather than getting its own.
DKIM is a signature. The sending server signs each message with a private
key, and the public half sits in your DNS so the receiver can check that
nothing changed in transit and that the signer was allowed to sign for
your domain. It is the long record, and the one most often pasted wrong,
so do not mark the step done until the sender's page says it verified.
DMARC is the policy that says what to do when the other two fail, and
where to send the reports. Start at `p=none`: nothing is rejected, and the
reports show you which legitimate mail is failing before you tighten it.
The one thing to know is that DMARC also checks that the domain in the
From line is the domain the other two records were checked for. That is
why a message sent through a sender verified on your domain, with a From
address at gmail.com, can pass SPF, pass DKIM and still fail DMARC, and it
is the third branch of the spam guide's decision tree.
Prompt for it, if the agent is doing the wiring:
```text
Connect a sender on mail. for all system email and set it as the organization's default sender. Do not send any email from the agent's own code through Resend, SendGrid or another API; every email goes through the platform's sender. Show me the three DNS records I need to add and which one failed if verification does not pass.
```
What you should see: the domain shows verified in the console, and a test
email from the sender arrives at your second address with the From name
and the domain you chose. Then open the message's headers and look for
`spf=pass`, `dkim=pass` and `dmarc=pass`. Three passes is done; anything
else is the spam guide's decision tree.
### 3. Move the default, then test as a stranger
Moving the system default to the sender on your verified domain is one
call, and it has to happen before you delete anything, because the delete
route refuses to remove a sender while it holds the flag:
```bash
curl -X PATCH https://api.console.buildbase.app/api/emails/senders/$SENDER_ID/default \
-H "Authorization: $BUILDBASE_TOKEN"
```
The sender's owner can do it, and so can an organization owner or admin.
On Supabase, the equivalent is enabling custom SMTP with the new sender's
host, port, username and password in the project's Authentication
settings; once saved, the built-in sender is no longer used.
What you should see: sign up from your second address, at a provider you
do not use for work (a Gmail account if you build on Outlook, or the
reverse), from a private window, and time the confirmation email. Under a
minute, from your domain, in the inbox. Then request a password reset and
a magic link and check both come from the same sender. If the confirmation
arrives and the reset does not, two senders are in play and the default
did not move.
**Correcting potential issues.** If the agent "fixed" this by adding an
email API call inside the sign-up route, paste: "Remove the email code from
the sign-up route. Confirmation, reset and invitation emails are sent by
the platform through the default sender; the app sends nothing itself."
If a sender shows as verified but mail still fails DMARC, the From domain
on the message is not the one that was checked, which is the spam guide's
third case.
### 4. The welcome, the trial ending, the card that failed
These three emails are the difference between an app and a product, and
generated apps never send them because nobody asked. On BuildBase they are
workflows rather than code: a trigger on an event the platform already
knows about, an email step with a template, published without a deploy,
with every run logged per step.
The triggers are the platform's own events, and three matter on launch
day:
- **A sign-up.** The welcome email, with the one thing you want a new
person to do first. Keep it to one link.
- **`subscription.trial_will_end`.** A heads-up a few days before the
trial ends, with a link to the plan screen. This is the single most
effective email a subscription product sends.
- **`payment.failed`.** The card failed; here is the link to update it.
The platform sends this one itself when the console notification or a
workflow is on, so the webhook handler in your app is for your own side
effects (flag the account, post to Slack), not for the email.
In the console's workflow editor those are three triggers and three email
steps, each with a template in HTML, Markdown or plain text and merge tags
for the person's name and the workspace. Conditions and waits go between
steps ("wait three days; if they have not created a project, send the
nudge"), and a follow-up stops once the person has done the thing, which
is the part a cron job the agent wrote never gets right. More than sixty
triggers exist; these three are the ones that pay for themselves in the
first month.
Here is the trial reminder as it looks in the editor, so that "no code"
means something concrete. The trigger is `subscription.trial_will_end`.
Step one is a condition on the workspace's subscription, because a
customer who already added a card does not need the nudge. Step two is an
email to the workspace owner, from your default sender, with a merge tag
for the date the trial ends and one button to the plan screen. Step three
is a wait of two days, then a second email only if the condition still
holds. Every run lists each step with its time and outcome, so "did the
reminder go out to Acme" is a search in the console, not a dig through
logs.
Prompt for the parts that touch the app:
```text
Do not write welcome, trial-ending or failed-payment emails in code. I will create them as workflows in the console. In the app, make sure the sign-up, trial and subscription events reach the platform (they do by default through BuildBase sign-in and billing); do not add a cron job, a queue or an email API for these.
```
What you should see: sign up as a stranger and the welcome arrives after
the confirmation, from the same domain. Start a trial on a test card, and
the reminder is scheduled; the workflow's run log shows the wait step
pending. Let the test card fail on renewal and the failed-payment email
goes out, and the run log shows it did. If any of those shows nothing, the
trigger is not wired, and the log says which one.
### 5. The emails people can turn off, and the one they always can
A person should be able to choose which emails they get, and every email
that is not required to operate the account should carry a one-click
unsubscribe. The sign-in emails (confirmation, reset, magic link) are the
account working and always send; everything else is a preference.
BuildBase ships the preference screen: a settings page where a user picks
which notifications they receive, with one-click unsubscribe and a
`List-Unsubscribe` header on campaign mail so mail clients show their own
unsubscribe button. [Which notifications users get to turn
off](/guides/which-notifications-users-can-turn-off) is the guide to
deciding what goes on that screen, and the rule of thumb is short: if a
person would be angry to receive it, it is optional; if they would be
angry not to, it is required.
What you should see: the settings page shows the preference list, turning
one off stops that email on the next run of its workflow, and a campaign
sent to a list shows an unsubscribe link that works in one click. On
Supabase-only apps there is no preference screen until you build one, and
the agent's version is usually a boolean column checked by nothing.
### 6. What the email says, and what it should not
The last check is the content, and it is the one the spam filters do not
catch. A non-developer who built a mental-health app in five weeks and
spent three months getting it ready for real users listed, among the
things he had to fix, that "booking confirmation emails included the
reason for the session". The email worked. It leaked.
Three rules that cover most of it. A transactional email says what
happened and what to do next, and nothing the person did not type into the
email field themselves; a sensitive field belongs behind the sign-in, with
a link. The sign-in emails carry a code or a link that expires, and never
a password. And a message to a user names the user, not "Dear user", which
is both the right thing and a signal the filters read.
What you should see: open each of the emails from steps 3 and 4 and ask
whether you would be comfortable if it were forwarded. If not, move the
detail behind a link.
### Where the builder's own sender wins
For a single-user app or a tool for your own team, the sender the builder
gives you is fine, and the limits that break it for strangers (team-only
delivery, two an hour) are limits you will never hit. Replit and Bolt
connect Resend and SendGrid as connectors, v0 connects Resend in one
click, and Resend's free plan at 3,000 emails a month covers a small app
with no domain of its own for a while. If your app sends one kind of
email and you already have a Resend account, connect it and skip the rest.
Choose a platform sender with workflows when the emails are the product's
behaviour rather than a notification: a trial that ends on its own, a card
that fails and a reminder that follows it, a preference screen, campaigns
to a list, and a log you can open when a customer says "I never got it".
Lovable's Cloud page lists no email at all and points to a separate guide
on sending from your own domain; Bolt's and Replit's connectors send, and
leave the rest to code. [The launch
checklist](/guides/vibe-coded-app-launch-checklist) puts email where it
sits among the other nineteen things.
> **Key takeaway:** The confirmation email that only you receive is not a bug in the email. It is
> a development sender doing exactly what its docs say. Find the sender, put
> your domain behind it, move the default, and make the lifecycle emails
> workflows you can watch run.
### What breaks, and how you can tell
**You get the confirmation, strangers do not.** Step 1: the development
sender delivers only to the project's team, and only two messages an hour
even then.
**The reset code arrives from a personal Gmail address.** Step 3. Somebody
connected their own account first, and the system default never moved.
**The domain says verified and mail still goes to spam.** Open the copy in
the spam folder and read `Authentication-Results`, as the spam guide walks
through: SPF or DKIM failing points at a record, and DMARC failing while
both pass means the From domain is not the one that was checked.
**The welcome arrives, the trial reminder never does.** Step 4. Either the
wait step is still pending or the trigger is not wired, and the run log
says which.
**A user turned off notifications and still gets them.** Step 5. The
preference is a column nobody's code reads; the platform's preference
screen is the one the workflows honour.
**The sender cannot be deleted.** It holds the system default flag. Move the
default first.
### Install
The sender, the workflows and the preference screen live in the console;
the app needs only the SDK and its sign-in routes:
```bash
npm i @buildbase/sdk
npx buildbase init --org-id
```
---
## Add login, teams and paid plans to a Lovable app, and keep Lovable Cloud or Supabase for your data
> New Lovable apps are TanStack Start apps, which means they can hold the three server routes BuildBase sign-in needs. Built and typechecked on 27 October 2026, with the Supabase wrinkle stated plainly.
- Source: https://www.buildbase.app/guides/add-login-teams-and-paid-plans-to-a-lovable-app
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-27
- Updated: 2026-11-04
### In short
To add login, teams and paid plans to a Lovable app, ask Lovable for the @buildbase/sdk package, add three small server routes that swap the sign-in code for a session cookie, keep the client secret in Lovable Secrets, and leave your data in Lovable Cloud or Supabase. Teams, roles and plans are then SDK calls.
You are adding real sign-in, a workspace per customer, paid plans and the
email that goes out when a card fails to an app Lovable built for you,
without moving your data out of Lovable Cloud or your Supabase project. When
it works, a stranger opens your published address in a private window, signs
up with Google or a magic link, lands in their own workspace, invites a
colleague who gets an email, picks a plan on a test card, and the feature
they paid for appears without a reload. The client secret never leaves
Lovable's server side.
The thing that makes this possible is a change Lovable made in May 2026.
New Lovable apps are TanStack Start apps, which render on the server and can
hold server routes, instead of React + Vite apps that render only in the
browser. A server route is exactly what the sign-in code exchange needs,
because it uses a secret the browser must never see. Older Lovable apps are
still Vite, and this guide says what to do about that too.
What we ran on 27 October 2026: a current TanStack Start app with the
official Cloudflare Workers adapter, the shape Lovable's new apps use,
scaffolded with `@tanstack/cli` 0.72.0 (TanStack Start 1.169.4, Vite 8.3.5,
React 19.3.1), with `@buildbase/sdk` 0.0.90 installed from npm. The three
handlers from our Vite guide went in unchanged, as server routes. Typecheck
passed, the production build passed, a `wrangler deploy --dry-run` passed,
and the three routes answered correctly inside the Workers runtime, in
development and in the built Worker, against a stub of our platform. What
we have not run: the real hosted sign-in round trip (that needs an
organization and a registered redirect address), a browser, a real deploy,
or Lovable's own build pipeline. Where that last one matters, this guide
says so.
> **Before you start:** A Lovable project on a paid plan or the free plan, either stack. A BuildBase
> organization, and an auth client created in the console under **User
> Management → Authentication**, with its client ID and secret. Your published
> Lovable address (and your custom domain, if you have one) registered on that
> client as redirect URLs, each ending in `/sign-in`. A Stripe account, only
> when you reach plans.
> **Tip:** The handlers in this guide are the ones from [BuildBase on
> Vite](/guides/buildbase-on-vite), byte for byte. If you are comfortable in a
> terminal, that guide and the [admin-dashboard
> example](https://github.com/buildbase-app/examples/tree/main/admin-dashboard)
> are the tested originals; this page is the Lovable wrapping around them.
### 1. Find out which Lovable app you have
Open the **Code** view and look at `package.json`. If it lists
`@tanstack/react-start`, you have a TanStack Start app and every step below
applies as written. If it does not, you have an older React + Vite app, and
you need a server first.
Lovable's own docs give that test, and the date behind it: projects created
from 13 May 2026 (22 June for Enterprise workspaces) use TanStack Start;
earlier ones run on React with Vite and render in the browser. There is no
framework choice. Every project uses the same stack, and if you want a
different one, Lovable's answer is to continue outside Lovable through Git
sync.
If yours is Vite, you have two honest routes:
- **Ask Lovable to upgrade the project to TanStack Start.** Its upgrade
page says anyone who can edit the project can start it on any plan, most
upgrades cost 10 to 35 credits, the database is untouched, your published
site does not change until you publish the upgraded version, and you can
revert from version history. Do that first, test every page (the page
warns that some browser-only libraries can break server rendering), then
come back to step 2.
- **Export to GitHub and host somewhere with serverless functions.** Git
sync is two-way and on every plan for github.com; it always creates a new
private repository. Then follow the Vite guide on Vercel, Netlify or
Cloudflare, where the three handlers are one-line function files. You
keep building in Lovable; the sign-in server lives on the host.
Why not run the handlers as Lovable Cloud edge functions and stay on Vite?
Because the session has to be an httpOnly cookie on your app's own address,
and a function on another origin cannot set one there. A server route in
the same app can. That is the whole reason TanStack Start matters here.
What you should see: either `@tanstack/react-start` in `package.json`, or
a decision about which of the two routes above you are taking.
### 2. Register where people come back to
The hosted sign-in page sends people back to one exact address per
environment, so register them before you prompt: your published Lovable
address with `/sign-in` on the end, your custom domain with `/sign-in` if
you have one, and `http://localhost:3000/sign-in` if you ever run the
exported code locally. An address it was not told about is refused.
This is also where the most common Lovable login complaint lives. Lovable's
own sign-in docs say that when sign-in works in preview but fails on a
published or custom domain, the redirect addresses are the thing to check,
and that is true of BuildBase's hosted page as much as of the built-in one.
A wildcard can stand in for one leftmost subdomain on a domain you own, but
not on a public suffix, so `*.lovable.app` is refused; register each address
you actually use. Preview addresses change, so most people register the
published one and the custom domain and test sign-in there.
What you should see: the auth client in the console lists each address,
and the client secret has been shown once. Do not paste it into the Lovable
chat.
### 3. Ask Lovable for the package and the three routes
You do not install anything. Lovable's docs say to name the package in the
project chat, and it adds it to the dependencies; there is no terminal
step. Paste this prompt. It names the outcome, the rules, the files, and
the one thing that must never happen to the secret.
```text
Use the @buildbase/sdk npm package to add BuildBase sign-in, a workspace per customer, paid plans and lifecycle email to this app.
Keep Lovable Cloud (or my Supabase project) as the database; BuildBase is not the primary database. Do not add Clerk, Auth0, Resend or n8n. Stripe is bring-your-own; do not store card data.
Read https://www.buildbase.app/llms.txt first and do not invent endpoints. Take the three handlers from https://www.buildbase.app/guides/buildbase-on-vite unchanged and run them as TanStack Start server routes:
- src/server/auth.ts with the guide's token, session and signout handlers, byte for byte
- src/routes/api/auth/token.ts (POST), src/routes/api/auth/session.ts (GET) and src/routes/api/auth/signout.ts (POST): each a createFileRoute with server.handlers that calls the matching handler
- src/context/buildbase-provider.tsx from the guide, with import '@buildbase/sdk/css', wrapping in the root route's component in src/routes/__root.tsx
Put VITE_BUILDBASE_ORG_ID, VITE_BUILDBASE_CLIENT_ID and VITE_BUILDBASE_REDIRECT_URL in .env. I will add BUILDBASE_CLIENT_SECRET under Secrets myself; never read it in the browser and never give it a VITE_ prefix.
If sign-in already exists in this app, stop and ask me before changing it.
```
What you should see: `@buildbase/sdk` in `package.json`, and five new or
changed files. The route that matters is the one that swaps the one-time
code from the hosted page for a session, and in TanStack Start it is three
lines around the Vite guide's handler:
```ts
// src/routes/api/auth/token.ts
import { createFileRoute } from '@tanstack/react-router';
import { token } from '../../../server/auth';
export const Route = createFileRoute('/api/auth/token')({
server: { handlers: { POST: ({ request }) => token(request) } },
});
```
`session.ts` is the same shape with `GET: ({ request }) => session(request)`,
and `signout.ts` with `POST: () => signout()`. A Start handler receives
`{ request, params, context }` rather than a bare `Request`, which is the
only reason the wrapper exists; `src/server/auth.ts` is the guide's file.
The provider wraps the root route:
```tsx
// src/routes/__root.tsx (the component; the html shell stays as Lovable wrote it)
import { createRootRoute, Outlet } from '@tanstack/react-router';
import { BuildBaseProvider } from '../context/buildbase-provider';
export const Route = createRootRoute({
// head and shellComponent as Lovable generated them
component: () => (
),
});
```
Two things we checked that you do not have to: the provider renders on the
server in its loading state without touching `window`, so server rendering
does not break; and the stylesheet import is emitted as a route asset and
linked in the server-rendered HTML, so the SDK's screens are styled before
the page becomes interactive.
**Correcting potential issues.** Read the change before you accept it. The
ways Lovable tends to drift, and the line to paste back:
- It wrote `createServerFn` functions instead of server routes. Those are
for calling from your own pages, not for the three `/api/auth/*`
addresses the provider fetches. Paste: "Replace the server functions
with file routes under src/routes/api/auth, each exporting a
createFileRoute whose server.handlers entry calls the matching handler,
as the guide shows."
- It put the secret in `.env` as `VITE_BUILDBASE_CLIENT_SECRET`, or read it
in the provider. Paste: "BUILDBASE*CLIENT_SECRET is read only inside
src/server/auth.ts on the server. Remove every other reference and the
VITE* prefix."
- It kept, or added, a sign-in of its own next to BuildBase's. Paste:
"BuildBase is the only sign-in in this app. Remove the other sign-in
pages and the users table for them, and keep every other table."
### 4. Add the secret, and the three public values
The secret goes under **More → Settings → Secrets** as
`BUILDBASE_CLIENT_SECRET`. Lovable's docs say a secret's value can never be
viewed again in Lovable, only replaced or deleted, that it is not repeated
in chat, logs or code, and that secrets never reach the browser. That is
the right place. The three public values go in `.env`, which Lovable says
is where `VITE_`-prefixed, browser-exposed variables belong, and which it
asks you not to add to `.gitignore`.
```bash
# .env
VITE_BUILDBASE_ORG_ID=
VITE_BUILDBASE_CLIENT_ID=
VITE_BUILDBASE_REDIRECT_URL=https://your-app.lovable.app/sign-in
# VITE_BUILDBASE_SERVER_URL defaults to https://api.console.buildbase.app
```
Here is the part we could not confirm from Lovable's docs, so you have to:
the secrets page says secrets are injected into edge functions and
server-side integrations at runtime, and the external-hosting page says
server-function secrets are set on the host. Neither names a TanStack Start
server route. In our test the Workers runtime exposed the secret to the
route as `process.env.BUILDBASE_CLIENT_SECRET` because the Worker had
`nodejs_compat` on. Step 5 tells you whether Lovable's Worker does the same:
a sign-in that fails with "Sign-in failed" on a correct code means the
secret did not reach the route.
One more detail from the test. The provider reads the three public values
with `import.meta.env`, which Vite inlines at build time, and the handlers
read the same three names with `process.env` at request time. In a Worker
that means the values have to exist as runtime variables too, not only in
the build. If step 5 fails with a missing org id, the fix-up is below.
What you should see: after publishing, open
`https://your-app.lovable.app/api/auth/session` and get `{"sessionId":null}`.
The server half is alive before any button exists. If you get the app's
HTML back instead, the routes are not there, and either the prompt did not
land or this is still a Vite project.
**Correcting potential issues.** If the server route cannot see
`process.env` at all, or reads the public values as empty, paste: "In
src/server/auth.ts, read VITE_BUILDBASE_ORG_ID, VITE_BUILDBASE_CLIENT_ID and
VITE_BUILDBASE_SERVER_URL with import.meta.env, and read
BUILDBASE_CLIENT_SECRET from the Worker's env binding; keep every read
inside the handler, never at module scope."
### 5. Publish, then sign in from a private window
Publish. Open the published address in a private window, click the button
that calls `signIn()` from `useSaaSAuth()`, and you are sent to the hosted
sign-in page, which offers whichever methods you switched on in the
console. Sign up with a second email. You come back to `/sign-in` on your
app, signed in.
Then the two checks a demo skips. Close the browser, reopen the site: still
signed in, because the cookie is good for 30 days, which is the
[default session length](/guides/token-expired-mid-request). Sign out, then
reload: asked to sign in again, because sign-out ended the session on the
server rather than clearing a value in the browser. In our test the session cookie
came back with `Path=/; HttpOnly; SameSite=Lax; Max-Age=2592000`, and
sign-out answered with `Max-Age=0`. The guide names it `bb-session-id`, as
`npx buildbase init` does.
The methods are switches, not code: email and password, a magic link, an
email code, a phone sign-in code sent through your own Twilio account,
passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC
provider, and Ethereum or Solana wallets. Turning on Google means creating
the client in Google's console and pasting two values; nothing in the
Lovable app changes.
**Correcting potential issues.** "The redirect address is not allowed" on
the hosted page: the address in `VITE_BUILDBASE_REDIRECT_URL` and the one
registered on the client differ, usually by a trailing slash, `www`, or the
`/sign-in` path. "Sign-in failed" after a correct code: the secret did not
reach the server route; check the Secrets panel, and if it is there, use
the env-binding fix-up in step 4. Lovable's own 50-address limit applies to
its built-in sign-in, not to this one.
### 6. A workspace per customer, and the colleague they invite
Every new user lands in their own workspace on first sign-in, with no setup
step. That is on by default for new organizations, and in your app it is
one component for the switcher and the hooks the SDK already has. Prompt
Lovable for the screens; the data model is already there.
```text
Add a workspace switcher to the app header using useSaaSWorkspaces() from @buildbase/sdk/react, and a /settings page that opens the SDK's built-in workspace, members and billing screens.
Members with the admin role may invite teammates by email; everyone else sees the member list read-only.
Do not create workspace, membership or role tables in Lovable Cloud or Supabase; BuildBase holds them.
```
What you should see: a switcher listing the workspaces the signed-in person
belongs to, with **Add team** creating another if you allow it. On the
members screen, inviting an address that has no account yet sends an email
with a link; the person signs up and lands in the workspace with the role
you chose. That flow has been in the SDK since version 0.0.71, and the
reasons an invite can be refused (a seat limit, an outsider policy) come
back as named errors rather than silence.
Why not let Lovable write the tables? Because every audit of a vibe-coded
app finds the same bug: a role column checked on one page and nowhere else.
Lovable's own end-user sign-in docs describe no roles, teams or workspaces
for the people using your app, so whatever a prompt builds here is built
from scratch. The SDK's roles are enforced by the API, so a member who types
the address of an admin page gets refused by the server, not just a missing
menu item.
**Correcting potential issues.** If a member can see another workspace's
rows by changing an id in the address bar, Lovable wrote a page that reads
your database without scoping it. That is your data and your query, and the
next section is about it.
### 7. Your data stays where it is: the one honest wrinkle
Your tables stay in Lovable Cloud or in your Supabase project. The rule we
give every agent is "do not use BuildBase as the primary database", and it
applies here. The wrinkle is row-level security: policies keyed to the old
sign-in (`auth.uid()` and friends) do not know who a BuildBase user is,
because a BuildBase session is an opaque id, not a token Supabase can read.
There are two ways through, and most apps want the first.
**Read and write through server routes.** A server route or server function
checks the BuildBase session and queries your database with a server-side
credential, scoped by the BuildBase user or workspace id. This is the
pattern generated apps should use anyway, because it puts the permission
check where it cannot be forged. The server SDK makes the check one call:
```ts
// src/server/buildbase.ts
import BuildBase from '@buildbase/sdk';
import { getCookie } from '@tanstack/react-start/server';
// The Vite guide's cookie: bb-session-id, or bb-session-id- when
// VITE_BUILDBASE_ENVIRONMENT names a development or staging environment.
export async function getSessionId() {
return getCookie('bb-session-id') ?? null;
}
let client: ReturnType | undefined;
export function bb() {
client ??= BuildBase({
serverUrl:
process.env.VITE_BUILDBASE_SERVER_URL ||
'https://api.console.buildbase.app',
orgId: process.env.VITE_BUILDBASE_ORG_ID!,
getSessionId,
});
return client;
}
```
In our test a `/profile` route's server function called
`bb().users.getProfile()` with that cookie, the call reached the platform,
and a missing session redirected home. One note from the typecheck: TanStack
Start refuses to send a value it cannot serialise out of a server function,
and the SDK's user type carries free-form claims, so return the fields the
page needs (`{ email }`) rather than the whole user.
**Mint a Supabase-shaped token for browser queries.** If pages query
Supabase directly from the browser and you want the existing policies to
keep working, add one more server route: it validates the session with the
server SDK, then signs a short-lived HS256 token with your Supabase project's
JWT secret (kept in Secrets), with `sub` set to the BuildBase user id and
`role` and `aud` set to `authenticated`, and the browser passes it to
Supabase as the bearer token. `auth.uid()` then matches `sub`, so store the
BuildBase user id in your owner columns. The step-by-step is in
[the skill repository](https://github.com/buildbase-app/claude-skill/blob/main/distribution/supabase-jwt.md).
You own that route and its refresh schedule. The platform change that would
make it unnecessary, BuildBase publishing signing keys so Supabase can
verify a user token directly, is recorded as not built.
Lovable's Quick scan still runs on every publish and still checks that
tables have row rules; nothing here switches it off, and the Deep scan is
worth running once after a change this size.
### 8. Plans people can pay for, and the email when a card fails
Plans, prices and trials live in the BuildBase console and sync to your own
Stripe account at Stripe's rates, with a 0% platform fee, and no card data
touches your app. The part that generated apps get wrong is what happens
after the payment, so this step is mostly about the webhook route and the
feature flag.
In the console, create two plans, Launch and Pro, say, each with a 7-day
trial and a monthly and a yearly price. Then the webhook. It is a fourth
server route, and this is the prompt for it:
```text
Add src/routes/api/webhooks/buildbase.ts as a POST server route. Verify the signature with parseWebhookEvent from @buildbase/sdk on the raw request body, using BUILDBASE_WEBHOOK_SECRET from Secrets. Handle payment.failed with our own side effects only (flag the workspace, post to Slack); the platform emails the customer itself, but only once I have connected an email sender and switched on the Payment Failed notification event in the console. Ignore other events.
Gate the export feature behind a BuildBase feature flag tied to the Pro plan, checked in a server route. Do not store the plan in Lovable Cloud or Supabase.
```
Point an endpoint in the console at
`https://your-app.lovable.app/api/webhooks/buildbase`, add its signing
secret under Secrets as `BUILDBASE_WEBHOOK_SECRET`, and publish.
What you should see: subscribe on a test card and the Pro feature appears
without a reload, because the flag follows the workspace's plan. Let the
test card fail on renewal and the email goes out from your sending domain,
because `payment.failed` is one of the 129 events in the catalog and the
console's notification or a workflow sends it; the route in your app is
for whatever you want to happen besides. The console's delivery log shows
each attempt, and a delivery your server was down for is retried up to
five times over about two and a half minutes.
Compare that with the built-in payments, read on 27 October 2026 from
Lovable's docs: Paddle at 5.0% plus 50 cents per transaction (a flat 10%
under $10) or your own Stripe at Stripe's rates, on Pro and up; one active
subscription per user by default, one provider per project, and once
payments are on, the project cannot be forked. Trials, discount codes and
monthly or yearly prices are there. Usage-based billing, seats and credits
are not mentioned, and neither is a plan per team. If your app sells one
subscription to one person, the built-in is simpler. If a plan belongs to a
workspace and has to change what the app does,
[entitlements rather than flags](/blog/entitlements-are-not-feature-flags)
is the ten-minute read before you prompt.
### Where Lovable's built-in is the better pick
Keep Lovable's built-in sign-in when your app has one user per account and
you need nothing after login. It is zero-config inside Lovable, which an
external SDK will never be, it ships SAML SSO and OIDC, which BuildBase does
not, so a buyer who signs in with Okta is better served by it, and its
redirect addresses are managed for you on the built-in backend. Keep the
built-in payments when you sell one subscription per person and want the
tax side handled, which is Paddle's own pitch for it.
Choose BuildBase when the question is "what may this team do now that they
paid": a workspace per customer, invites and roles enforced by the API,
plans with versions, feature flags tied to the plan, credits with a hard
stop, and the lifecycle email, from one SDK, with your data staying in
Lovable Cloud. That is the layer Lovable's docs do not reach today, and
[the launch checklist](/guides/vibe-coded-app-launch-checklist) is the
twenty-item version of why it matters before strangers arrive.
> **Key takeaway:** On Lovable the hard part was never the SDK, it was having a server. New
> Lovable apps have one. Three server routes, a secret in Secrets, and the rest
> is hooks, with your database exactly where it was.
### What this costs in credits
Lovable prices builds by the request. Its own pricing page gives examples:
0.50 credits to make a button grey, 1.20 to add authentication, 1.70 or so
for a landing page with images, and 1 credit per message in plan mode. Pro
is $25 a month for 100 credits ($21 on annual billing) and Business $50 for
100, with daily build credits on top; an upgrade from Vite to TanStack Start
is 10 to 35. All read on 27 October 2026, and Lovable changes these.
The prompt in step 3 is one request, with perhaps two fix-ups. Steps 6 and
8 are one each. The expensive thing on Lovable is not a feature, it is a
loop: about 63% of the negative reviews we read across the builders were
about credits spent on fixes that did not fix. Naming the exact files, the
exact env names and the exact guide is how you avoid the loop, and it is
why this page is long.
BuildBase's side: a Free plan at $0, then Launch at $19 a month, with a 7-day
trial and no card on the paid plans.
### What breaks, and how you can tell
**Sign-in works in preview and loops after publishing.** The published
address, or the custom domain, is not registered with `/sign-in` on the
end. Register each exact address; `*.lovable.app` is refused.
**"Sign-in failed" on a correct code.** The secret did not reach the server
route. Check Secrets, then use the env-binding fix-up in step 4.
**`/api/auth/session` returns the app's HTML.** There are no server routes,
because the project is still React + Vite, or the prompt wrote server
functions instead. Step 1, then step 3's first fix-up.
**The org id is empty on the server.** The handlers read `process.env` at
request time and the Worker only has the values from the build. Read the
three public values with `import.meta.env` in `src/server/auth.ts`.
**The secret is in the browser.** Search the published JavaScript for its
first characters. If it is there, it was prefixed `VITE_`. Rotate it in the
console, move it to Secrets, publish again.
**Rows vanish, or "permission denied", after switching sign-in.** Row rules
keyed to the old sign-in no longer match. Section 7: route the reads through
the server, or mint the token.
**The package install breaks the build.** Lovable's docs say it cannot
guarantee third-party packages. The SDK's dependencies are plain JavaScript
with no native code, which is the usual cause of a broken install, so read
the build error before assuming the package; and keep `bun.lock` in place,
because Lovable installs with Bun.
### Install
In Lovable, the install is a sentence in the chat: "Use the @buildbase/sdk
npm package". On an exported copy, Lovable's docs say to install with Bun so
the lockfile stays in sync (`bun add @buildbase/sdk`), and on any other host
it is the usual line:
```bash
npm i @buildbase/sdk
```
---
## Add sign-in, teams and paid plans to a v0 app without leaving Next.js
> A v0 app is a Next.js app, which is the easiest place to add BuildBase: one prompt or one init command, five variables in Vercel, one redirect address, then teams, plans and the failed-payment email.
- Source: https://www.buildbase.app/guides/add-sign-in-teams-and-paid-plans-to-a-v0-app
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-27
- Updated: 2026-11-04
### In short
To add sign-in, teams and paid plans to a v0 app, keep it a Next.js app and add BuildBase: paste one prompt in v0, or run npx buildbase init on the repo v0 keeps in GitHub. Put five variables in Vercel with the secret server-only, register your domain as the redirect address, and teams, plans and email are SDK calls.
You are adding real sign-in, a workspace per customer, paid plans and the
email that goes out when a card fails to an app v0 generated for you. When
it works, a stranger opens your production domain in a private window, signs
up with Google or a magic link, lands in their own workspace, invites a
colleague, picks a plan on a test card, and the feature they paid for appears
without a reload. All of it is in your repository, and none of the secrets
are in the browser.
v0 is the easiest builder to do this on, for one reason: every v0 app is a
Next.js app with the App Router, and Next.js is where our SDK has the most
road under it. The same ten files that `npx buildbase init` writes into any
Next.js app are the files v0 will write if you hand it the right prompt.
What we ran on 27 October 2026: `npx buildbase init` in a fresh Next.js App
Router app, then typecheck and `next build`, through the CLI's own gates (a
60-cell matrix of project shapes, platform builds in seven frameworks, and a
59-assertion end-to-end run against a stub server). What we have not run
today is this exact flow inside v0's own chat, so where a step says "you
should see", that is what Next.js and v0's documented behaviour give you,
and the one place v0's behaviour matters is called out.
> **Before you start:** A v0 project, connected to GitHub and to a Vercel project (v0's docs say that
> is what gets you environment variables, deployments and previews). A BuildBase
> organization, and an auth client created in the console under **User
> Management → Authentication**, with its client ID and secret. Your production
> domain registered on that client as a redirect URL, and
> `http://localhost:3000` beside it. A Stripe account, only when you reach
> plans.
> **Tip:** Already have a Next.js app with a `with-buildbase` shape? The [Next.js
> guide](/guides/buildbase-on-nextjs) is the tested version of every snippet
> below, and this page is the v0-specific wrapping around it: which prompt,
> where the variables go, and what v0 does with the branch.
### 1. Decide where people come back to
The hosted sign-in page sends people back to one exact address you
registered, so decide it before you prompt: your production domain for the
live app and `http://localhost:3000` for local work. Register both on the
auth client. Everything that goes wrong later with "login loops" traces
back to this address.
Why one address? Because the sign-in happens on a page BuildBase hosts
(on your own domain, if you set that up later), and that page needs to know
the only places it is allowed to send a signed-in person. An address it was
not told about is refused, which is the right behaviour and the most
common first-day surprise.
v0 adds a wrinkle: it deploys to Vercel, and Vercel gives every deployment
a preview address on `vercel.app`. A wildcard can stand in for one leftmost
subdomain on a domain you own, but not on a public suffix, so
`*.vercel.app` is refused. If you want to test sign-in on a preview
deployment, register that preview's exact address. Most people register
production and localhost and test sign-in there.
What you should see: in the console, the auth client lists two redirect
URLs, and the client secret is shown once. Copy it somewhere you will not
paste into a chat.
### 2. Paste the prompt into v0
Paste this into the v0 chat for your project. It names the outcome, the
rules, the guide v0 should follow, and the one thing that must never
happen to the secret.
```text
Add BuildBase (@buildbase/sdk) to this Next.js app for sign-in, a workspace per customer, paid plans and lifecycle email.
Follow https://www.buildbase.app/guides/buildbase-on-nextjs exactly, and read https://www.buildbase.app/llms.txt first. Do not invent endpoints.
Keep the existing database. Do not add Clerk, Auth0, Better Auth, Resend or n8n. Stripe is bring-your-own; do not store card data.
Write app/providers.tsx, app/api/auth/token/route.ts, app/api/auth/session/route.ts, app/api/auth/signout/route.ts, lib/buildbase.ts and app/api/webhooks/buildbase/route.ts, and wrap app/layout.tsx in the provider.
Read NEXT_PUBLIC_BUILDBASE_ORG_ID, NEXT_PUBLIC_BUILDBASE_CLIENT_ID and NEXT_PUBLIC_BUILDBASE_REDIRECT_URL in the browser; read BUILDBASE_CLIENT_SECRET and BUILDBASE_WEBHOOK_SECRET only in route handlers, never with a NEXT_PUBLIC_ prefix.
Leave every secret empty in .env.example. If sign-in already exists in this app, stop and ask me before changing it.
```
What you should see: v0 creates a working branch (its docs say it never
pushes to your base branch; it opens or reuses a pull request when you
publish), and the branch contains those six files plus an edited
`app/layout.tsx`. The provider should look like this, which is the tested
shape from the Next.js guide, trimmed:
```tsx
// app/providers.tsx
'use client';
import '@buildbase/sdk/css';
import { ApiVersion } from '@buildbase/sdk';
import { SaaSOSProvider } from '@buildbase/sdk/react';
export function Providers({ children }: { children: React.ReactNode }) {
return (
(await (await fetch('/api/auth/session')).json()).sessionId,
handleAuthentication: async (code: string) => {
const res = await fetch('/api/auth/token', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ code }),
});
return { sessionId: (await res.json()).sessionId };
},
onSignOut: async () => {
await fetch('/api/auth/signout', { method: 'POST' });
},
},
}}
>
{children}
);
}
```
And the route that matters, the one that swaps the one-time code from the
hosted page for a session and puts it in a cookie the browser cannot read:
```ts
// app/api/auth/token/route.ts
import { NextResponse } from 'next/server';
export async function POST(request: Request) {
const { code } = await request.json();
const res = await fetch(
`${process.env.NEXT_PUBLIC_BUILDBASE_SERVER_URL || 'https://api.console.buildbase.app'}/api/v1/auth/token`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
code,
orgId: process.env.NEXT_PUBLIC_BUILDBASE_ORG_ID,
clientId: process.env.NEXT_PUBLIC_BUILDBASE_CLIENT_ID,
clientSecret: process.env.BUILDBASE_CLIENT_SECRET,
}),
}
);
if (!res.ok)
return NextResponse.json({ error: 'Sign-in failed' }, { status: 401 });
const { data } = await res.json();
const response = NextResponse.json({ sessionId: data.sessionId });
// The name `npx buildbase init` writes; with NEXT_PUBLIC_BUILDBASE_ENVIRONMENT
// set to a development or staging key it is bb-session-id-.
response.cookies.set('bb-session-id', data.sessionId, {
httpOnly: true,
secure: process.env.NODE_ENV === 'production',
sameSite: 'lax',
path: '/',
maxAge: 60 * 60 * 24 * 30,
});
return response;
}
```
The session route returns that cookie's value so the app can restore itself
after a refresh; the sign-out route deletes it. Both are a handful of lines
in the [with-buildbase example](https://github.com/buildbase-app/examples/tree/main/with-buildbase/app/api/auth).
**Correcting potential issues.** Read the diff before you accept it. The
three ways v0 tends to drift, and the line to paste back:
- It added `better-auth`, `@clerk/nextjs` or `next-auth` anyway. Paste:
"Remove that package. BuildBase is the only sign-in in this app. Keep the
users in my existing database."
- It put the secret in a `NEXT_PUBLIC_` variable, or read it in a client
component. Paste: "BUILDBASE*CLIENT_SECRET must be read only in
app/api/auth/token/route.ts. Remove every other reference and never
prefix it with NEXT_PUBLIC*."
- It created `BuildBase(...)` at the top of `lib/buildbase.ts` instead of
inside a function. That breaks `next build` on any machine where the
variables are not filled in yet. Paste: "In lib/buildbase.ts, create the
server client lazily inside a bb() function, as the guide shows."
### 3. Set five variables in Vercel
Four public values and one secret go in the Vercel project's environment
variables, not in a file v0 commits. v0's docs say environment variables
are managed in Vercel (Project menu → Settings → Environment Variables) and
that previews run the full application with them, so the route handlers
see the secret on every deployment and the browser never does.
```bash
NEXT_PUBLIC_BUILDBASE_ORG_ID=
NEXT_PUBLIC_BUILDBASE_CLIENT_ID=
NEXT_PUBLIC_BUILDBASE_REDIRECT_URL=https://your-domain.com
BUILDBASE_CLIENT_SECRET=
BUILDBASE_WEBHOOK_SECRET=
# NEXT_PUBLIC_BUILDBASE_SERVER_URL defaults to https://api.console.buildbase.app
```
The rule behind the split is the same one every Next.js app lives under:
anything prefixed `NEXT_PUBLIC_` is inlined into the browser bundle. That is
fine for an organization id and a client id, which are public by design, and
fatal for a secret. So the secret has no prefix, and only
`app/api/auth/token/route.ts` reads it.
Redeploy. What you should see: open
`https://your-domain.com/api/auth/session` and get `{"sessionId":null}`. The
server half is alive before any button exists. If you get HTML back
instead, the route is not deployed, and the diff in step 2 did not land on
the branch Vercel built.
### 4. Sign in from a private window
Open the production domain in a private window, click the button that calls
`signIn()` from `useSaaSAuth()`, and you are sent to the hosted sign-in
page, which offers whichever methods you switched on in the console. Sign
up with a second email. You come back to the registered address signed in.
Then do the two checks a demo skips. Close the browser, reopen the site:
still signed in, because the cookie is good for 30 days, which is the
[default session length](/guides/token-expired-mid-request). Sign out, then
reload: asked to sign in again, because sign-out ended the session on the
server rather than clearing a value in the browser.
The methods are switches, not code. Email and password, a magic link, an
email code, a phone sign-in code sent through your own Twilio account,
passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC
provider, and Ethereum or Solana wallets. Turning on
[Google sign-in](/guides/social-login-nextjs) means creating the client in
Google's console and pasting two values; nothing in the v0 app changes.
**Correcting potential issues.** If the hosted page says the redirect
address is not allowed, the address in `NEXT_PUBLIC_BUILDBASE_REDIRECT_URL`
and the one registered on the client differ, usually by a trailing slash or
`www`. They must match exactly. If you are testing on a preview deployment,
see step 1: register that preview's exact address or test on production.
### 5. A workspace per customer, and the colleague they invite
Every new user lands in their own workspace on first sign-in, with no setup
step. That is on by default for new organizations, and in your app it is
one component for the switcher and the hooks the SDK already has. Prompt v0
for the screens; the data model is already there.
```text
Add a workspace switcher to the app header using useSaaSWorkspaces() from @buildbase/sdk/react, and a /settings page that opens the SDK's built-in workspace, members and billing screens.
Members with the admin role may invite teammates by email; everyone else sees the member list read-only.
Do not create workspace, membership or role tables in my database; BuildBase holds them.
```
What you should see: a switcher listing the workspaces the signed-in person
belongs to, with **Add team** creating another if you allow it. On the
members screen, inviting an address that has no account yet sends an email
with a link; the person signs up and lands in the workspace with the role
you chose. That invitation flow is in the SDK since version 0.0.71, and the
reasons an invite can be refused (a seat limit, an outsider policy) come
back as named errors rather than a silent nothing.
Why not let v0 write the tables? Because the audits of vibe-coded apps all
find the same bug: a role column checked on one page and nowhere else. The
SDK's roles are enforced by the API, so a member who types the address of
an admin page gets refused by the server, not just a missing menu item.
[Roles and permissions per workspace](/guides/roles-and-permissions-per-workspace-nextjs)
goes deeper when you want permissions of your own.
**Correcting potential issues.** If a member can see a second workspace's
data by changing an id in the address bar, v0 wrote a page that reads your
database without scoping it to the current workspace. Paste: "Every query
in this page must be scoped to the current workspace id from
useSaaSWorkspaces(); refuse the request on the server if the user is not a
member." That is your database and your query, and no SDK can scope it for
you.
### 6. Plans people can pay for, and the email when a card fails
Plans, prices and trials live in the console and sync to your own Stripe
account; the platform fee is 0%, and no card data touches your app. The
part generated apps get wrong is what happens after the payment, so this
step is mostly about the webhook route and the feature flag.
First the catalog, in the console: a Launch plan and a Pro plan, say, with
a 7-day trial on both and a monthly and a yearly price. Then the webhook.
`init` writes `app/api/webhooks/buildbase/route.ts`, and the prompt in step
2 asked v0 for the same file. It verifies the signature with
`parseWebhookEvent` on the raw body and handles events from the published
catalog, 129 of them, by name:
```text
In app/api/webhooks/buildbase/route.ts, handle payment.failed with our own side effects only (flag the workspace, post to Slack); the platform emails the customer itself, but only once I have connected an email sender and switched on the Payment Failed notification event in the console. Handle subscription.created by nothing; the plan is already on the workspace.
Gate the export feature behind a BuildBase feature flag tied to the Pro plan, checked on the server. Do not store the plan in my database.
```
Point an endpoint in the console at `https://your-domain.com/api/webhooks/buildbase`,
copy its signing secret into `BUILDBASE_WEBHOOK_SECRET` in Vercel, and
redeploy.
What you should see: subscribe on a test card and the Pro feature appears
without a reload, because the flag follows the workspace's plan. Let the
test card fail on renewal and the email goes out, from your sending domain,
because `payment.failed` is a real event the console's notification or a
workflow acts on, rather than a Stripe event the app guessed at; the route
in your app is for whatever you want to happen besides. In the console, the
webhook's delivery log shows each attempt, and a delivery your server was
down for is retried up to five times over about two and a half minutes.
Two pieces worth ten minutes before you prompt for them. A plan change
creates a new version rather than editing the old one, so nobody is moved
to a new price without you choosing to move them;
[plan versioning](/guides/plan-versioning-nextjs) explains why that matters
on the day you raise prices. And the difference between
[entitlements and feature flags](/blog/entitlements-are-not-feature-flags)
decides whether "paid" means "sees the button" or "may call the endpoint".
You want the second.
**Correcting potential issues.** If v0 wrote a Stripe webhook handling
`invoice.payment_failed` directly, it built the billing a second time.
Paste: "Remove the direct Stripe webhook. BuildBase receives Stripe's events;
my app receives BuildBase's. Handle payment.failed in
app/api/webhooks/buildbase/route.ts only." If the feature check lives in a
client component, paste: "Check the feature flag on the server in the route
that performs the export, not in the component that shows the button."
### The other path: init on the repository v0 keeps
v0 keeps your code in a GitHub repository it created (or one you imported),
and that repository is the source of truth. If you ever open a terminal,
the fastest version of steps 2 and 3 is two commands on a clone of it:
```bash
npm install @buildbase/sdk
npx buildbase init --org-id
```
It reads `package.json`, sees Next.js, and writes ten files: the provider,
the three sign-in routes, the webhook route, the server helper,
`.env.example` and `.env.local`, and it wraps `app/layout.tsx`. Four things
it will not do: overwrite a file that exists, write a secret (every value is
left empty, and it refuses a secret passed on the command line), touch a
Pages Router app (refused, with a message), or change anything on a second
run (it prints `already configured`).
Push the branch and open the pull request; when it merges, v0's docs say it
synchronizes the chat with the base branch, so the next prompt sees the
files. Then set the variables in Vercel exactly as in step 3.
What we have not done is run `init` from inside v0, because v0's chat is not
a terminal. In our own agent evaluation, agents read about `init` and wrote
the files by hand instead, because `init` needs the organization id and
they had none. If you have the id, `init` is the shorter road.
### Where v0's own options are the better pick
If all you need is sign-in and you like owning code, Better Auth is the
honest default on v0: Vercel bought it in July 2026, it is open source under
MIT with 4.7 million weekly downloads, and it is the library an agent on
Vercel's platform is most likely to reach for. Clerk has been one click from
the v0 chat since 9 September 2026 and Auth0 since the week after, and v0
loads a provider's skills
automatically when its integration is installed, so they are wired with
less prompting than BuildBase, which is not a Marketplace integration today
and needs the links in the prompt above.
Pick one of those when your app has one user per account and the plan
lives in Stripe alone. Pick BuildBase when the question is "what may this
team do now that they paid", because that is the part none of the three
documents for your end users: a workspace per customer, invites and roles
enforced by the API, plans with versions, feature flags tied to the plan,
credits with a hard stop, and the lifecycle email, from one SDK. The
[Clerk comparison](/compare/clerk-vs-buildbase) is the line-by-line
version.
> **Key takeaway:** On v0 the hard part is not the framework, it is the prompt. Name the guide,
> name the files, name where the secret may be read, and v0 writes what init
> would have written. After that, teams and plans are hooks, and [the launch
> checklist](/guides/vibe-coded-app-launch-checklist) is what to run before you
> share the link.
### What breaks, and how you can tell
**Sign-in works on production and loops on a preview deployment.** The
preview's `vercel.app` address is not registered, and a wildcard on a
public suffix is refused. Register the exact address or test on production.
**`next build` fails on Vercel with "orgId is required".** `BuildBase(...)`
is being created at module level in `lib/buildbase.ts`, before the
environment variables exist on the build machine. Create it inside a
function on first use, as the Next.js guide shows.
**The secret is in the browser.** Search the deployed JavaScript for the
first characters of the client secret. If it is there, a variable was
prefixed `NEXT_PUBLIC_` or read in a client component. Rotate the secret in
the console, fix the prefix, redeploy.
**Paid, but the feature did not appear.** The webhook endpoint in the
console points at the wrong address, or `BUILDBASE_WEBHOOK_SECRET` is empty
on Vercel. The delivery log in the console shows each attempt and its
status; a 401 there means the secret, a timeout means the route.
**A member sees another team's data.** The page queries your database
without the workspace id. The SDK scopes what it holds; your tables are
yours to scope, and the fix is in the query, not in the SDK.
**`init` refuses the app.** It is a Pages Router project. v0 generates the
App Router, so this only happens on an imported repository; the Next.js
guide's steps work by hand on either.
### Install
Add the SDK to the repository v0 keeps, or paste the prompt in step 2 and
let v0 write the same files:
```bash
npm i @buildbase/sdk
```
---
## Login that works after you publish: the live-site checklist for a vibe-coded app
> Sign-in works in the preview and loops, lands on localhost or hangs on the live site. Six checks, in the order a stranger hits them, with the exact error strings and the setting behind each one.
- Source: https://www.buildbase.app/guides/login-that-works-after-you-publish
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-27
- Updated: 2026-11-04
### In short
Login that works in the preview and fails on the published site comes down to an address: the sign-in provider only returns to URLs it was told about, and the live one was never added. Six checks in order: the redirect address, the Google client, the confirmation email, the session, sign-out, a second browser.
A Replit review from 17 October 2026 reads, in full: "Users can't log in."
A paid-fix vendor advertises on Mastodon with the exact symptom: "lovable
login works in preview, then loops or dumps you on localhost after
publish?" And on dev.to, the largest troubleshooting cluster we found for
any builder, ten posts in thirty days, is Lovable sign-in that works for
the builder and fails for everyone else.
It is nearly always the same thing. Sign-in happens on a page somebody else
hosts (Supabase, Lovable Cloud, Bolt Cloud, Google, BuildBase's hosted
page), and that page only sends people back to addresses it has been told
about. The preview address was told about. The published one, and the
custom domain you added on Friday, were not. Nothing in the app is broken,
which is why no amount of prompting fixes it, and why a loop of fixes is
how the credits go.
This is a checklist, not a tutorial: six checks in the order a stranger
hits them, each with the symptom, the error string if there is one, the
setting behind it, and how to prove it is fixed. Run every one on the
**published** site, in a private window, as a second person, never as
yourself in the editor's preview. The settings and limits quoted were read
from each vendor's own docs on 27 October 2026.
> **Before you start:** A published app with a sign-in of any kind (the builder's built-in, your own
> Supabase project, or BuildBase), a second email address you control, and a
> second browser or a private window. For the Google check, access to the Google
> Cloud Console project that holds the OAuth client.
### First, find out who does your sign-in
Before any check, name the thing that signs people in, because every
setting below lives in a different place depending on the answer. Most
builders have given you one of four:
| Who signs people in | How to tell | Where the allow list lives |
| ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| The builder's built-in backend (Lovable Cloud, Bolt Cloud, Replit Auth) | The Users list is inside the builder, and you never created a Supabase or BuildBase account for this app | The builder's own auth settings; Lovable and Bolt manage most of it when you publish |
| Your own Supabase project | There is a Supabase dashboard for this app and the code calls `supabase.auth` | Supabase, Authentication, URL Configuration: the Site URL and the Redirect URLs |
| BuildBase's hosted page | The code has a `SaaSOSProvider`, three `/api/auth/*` routes and a `bb-session-id` cookie | The auth client in the BuildBase console, under User Management, Authentication |
| Something the agent wrote itself | A `users` table, a password hash, a `jsonwebtoken` or `iron-session` dependency | Nowhere; the redirect is whatever the code does, and the code is the setting |
The fourth row is the one to worry about. There is no allow list because
the agent wrote its own sign-in, and the checks below still apply, but the
"setting" is a line of code the agent chose. [What a coding agent builds
when nobody tells it
otherwise](/blog/what-a-coding-agent-builds-when-nobody-tells-it-otherwise)
is what that line usually looks like.
### 1. The redirect address: where sign-in sends people back
Symptom: sign-in works in the preview; on the live site it loops back to
the sign-in page, lands on `localhost:3000`, or shows "redirect URL not
allowed". Cause: the live address is not on the provider's allow list, so
the provider falls back to its default, which is the preview or localhost.
A published app has more addresses than it looks. Lovable gives you a
preview address, a published `something.lovable.app` address, and your
custom domain if you added one; v0 and Vercel give you a preview address
per deployment and a production domain; Bolt gives you a Netlify address
and your domain. Each is a different string to the provider, and an allow
list that holds one of them holds one of them. Register the published
address and the custom domain as a matter of course, and the preview only
if you test sign-in there.
The settings, by provider:
**Supabase (your own project, or the one a builder created for you).** The
Site URL is the default redirect when no `redirectTo` is given, and the
docs tell you to change it "from `http://localhost:3000` to your production
URL". Redirect URLs live on the URL Configuration page; the `redirectTo`
your code passes must match that list. Wildcards exist (`*` matches within
one path segment, `**` across them), and the docs keep them for local and
preview work: "we recommend setting the exact redirect URL path for your
site URL in production".
**Lovable Cloud.** The built-in sign-in allows up to 50 redirect addresses
per app. If the app uses your own Supabase project instead, Lovable's
sign-in docs say it does not update that project's Site URL or redirect
URLs for you; you add the published address and the custom domain in the
Supabase dashboard yourself.
**Bolt Cloud.** Bolt's auth settings carry a Site URL ("the primary live
URL of your app") and a URI allow list; new projects default to
`localhost:3000`, which the docs say "does not work for live applications".
Bolt usually updates these when you publish, and the docs add that you may
need to edit them by hand, "especially with multiple domains".
**BuildBase.** Each auth client has a list of redirect URLs, and the hosted
sign-in page returns only to one of them, path included. A wildcard can
stand in for one leftmost subdomain on a domain you own
(`https://*.app.example.com/sign-in`), and never on a public suffix, so
`*.lovable.app` and `*.vercel.app` are refused. Register the published
address, the custom domain, and `localhost` for local work, each once.
[Auth clients, redirect URLs and environments](/guides/auth-clients-redirect-urls-and-environments)
is the pattern for keeping preview, staging and production apart without
sharing a client.
How to prove it: open the published site in a private window, start
sign-in, and read the address bar when it fails. If it says `localhost`,
the Site URL is the default. If it says "not allowed" or "mismatch", the
address differs from the registered one by a trailing slash, `www`, `http`
versus `https`, or the path. Fix the one character, and try again from a
fresh private window, because the old one may have cached the failure.
The four ways an address differs, because every one of them has cost
someone an afternoon: `https://app.example.com/sign-in` is not
`https://app.example.com/sign-in/` (the slash), not
`https://www.app.example.com/sign-in` (the `www`), not
`http://app.example.com/sign-in` (the scheme), and not
`https://app.example.com/` (the path). Allow lists compare strings, not
intentions.
If you want the agent to do the registering, give it the strings rather
than the job, because an agent asked to "fix login on the live site" will
change code, and the code was never wrong:
```text
Do not change any sign-in code. In the sign-in provider's settings, set the Site URL to https:// and add these redirect URLs exactly, with no wildcard: https:///sign-in, https:///sign-in, http://localhost:3000/sign-in. Then tell me which settings page you changed and what it now contains.
```
**Correcting potential issues.** If the agent answers by editing the
sign-in code anyway, paste: "Revert that change. The problem is the
provider's allow list, not the code; show me the current Site URL and
redirect list before changing anything else." On a builder that manages
the list for you (Lovable Cloud, Bolt Cloud), publishing again after adding
a custom domain is often the whole fix, because the builder updates the
list on publish; Bolt's docs say exactly that, with the caveat about
multiple domains.
### 2. The Google client: `redirect_uri_mismatch`
Symptom: the Google button opens Google's page, which shows "Error 400:
redirect_uri_mismatch", or returns to the app with nothing signed in.
Cause: the address Google was asked to return to is not one of the
authorized redirect URIs on your OAuth client, exactly.
This one has a second allow list, and it is Google's, not your provider's.
Whoever handles the sign-in (Supabase, Bolt Cloud, BuildBase) has one
callback address that Google must know; Bolt's docs, for example, show the
origin and redirect URIs to paste into Google Cloud Console when you turn
Google on. That address does not change when you publish, which is why
this check passes for most people. It fails when the client was created
for a different provider, when a second provider was added later, or when
someone pasted the app's address instead of the provider's callback.
The Figma Make community thread that opened on 22 July 2025, "Google
signup works but no access to app", stayed open into September with no
root cause given; the symptom in it is this check and the one before it
together: Google succeeded, then the provider returned to an address the
app did not expect.
How to prove it: read the `redirect_uri` in Google's error page, copy it
character for character into the OAuth client's authorized redirect URIs,
save, wait a few minutes, retry from a private window. If your sign-in is
BuildBase, [social login in Next.js](/guides/social-login-nextjs) shows the
one callback address to register and the two values to paste back.
### 3. The confirmation email that only you receive
Symptom: you signed up fine; a stranger signs up and the confirmation
email never arrives, or arrives an hour later, or lands in spam. Cause: the
sender is a development sender with limits you never hit, because you were
inside them.
Supabase's docs on custom SMTP say it plainly about the built-in sender:
"Supabase Auth will refuse to deliver messages to addresses that are not
part of the project's team", the limit is "2 messages per hour", and the
server "is not meant for production use". You are on the team. Your
customers are not. The dev.to writer who put it best: "Then a real person
signs up, never gets the confirmation email, and you never hear from them
again."
The fix on Supabase is a custom SMTP sender (Resend, SES, Postmark,
SendGrid and others are named in the docs) set in the project's auth
settings, after which mail goes to everyone, with a limit of 30 an hour
until you raise it on the rate-limits page. On BuildBase, sign-in emails go
out through your organization's sending domain (Google, Mailgun, Amazon
SES or your own SMTP), which you set once for every email the platform
sends, and the [guide on email landing in
spam](/guides/transactional-email-landing-in-spam) covers the domain
records that keep it out of the junk folder.
How to prove it: sign up with an address at a provider you do not use for
work (a Gmail account if you build on Outlook, or the reverse), and time
the email. Then open it on a phone and look at the sender name and
address. "noreply@mail.app.supabase.io" is the development sender; your own
domain is the fix.
### 4. The session after a reload, and after a week
Symptom: sign-in works; reloading the page signs you out, or everything is
fine until a week later when every user is signed out at once. Cause: the
session is held in the wrong place, or on the wrong host.
The right place is a cookie the browser cannot read, set by your server
after the sign-in code is exchanged, with a lifetime you chose. On
BuildBase that cookie is 30 days by default, which is the
[default session length](/guides/token-expired-mid-request), and the Vite,
Next.js and Lovable guides all set it the same way. A session kept in
`localStorage` by the browser survives reloads but can be read by any
script on the page, which is the thing the 2025 Lovable exposure and the
2026 Moltbook leak had in common: a key the browser held.
The wrong host is subtler. A cookie set on `app.example.com` is not sent
to `example.com`, and a cookie set on the published `*.lovable.app`
address does not follow you to the custom domain. If sign-in works on one
address and not the other, that is the cookie, and [a session cookie not
shared across subdomains](/guides/session-cookie-not-shared-across-subdomains)
is the two-line fix.
How to prove it: sign in, close the browser entirely, open the published
site again. Still signed in. Then open the same site on the custom domain
in the same browser. Still signed in, or you have the subdomain problem.
And if your app uses Next.js middleware to guard pages, the symptom "the
page reloads forever after sign-in" has its own guide:
[middleware redirect loop after login](/guides/nextjs-middleware-redirect-loop-after-login).
### 5. Sign-out that actually signs out
Symptom: a user signs out, presses back, and is still inside. Or signs out
on a laptop and stays signed in on a phone. Cause: sign-out cleared a value
in the browser and told the server nothing.
A sign-out has to end the session where it lives, on the server, so that
the cookie, the phone and the tab that was left open all stop working at
once. On BuildBase, `onSignOut` calls your sign-out route, which clears the
cookie, and the SDK revokes the session on the platform, so a device list
shows it gone and the other devices lose it too. A generated sign-out
usually does only the first half.
How to prove it: sign in on two browsers as the same person. Sign out on
one. Reload the other. If it is still signed in, the server was never
told. The device list on the account screen is the honest check: a
session that is signed out should not be listed.
The same list is the answer to the first support email every app gets,
"I think someone else is logged into my account". Every BuildBase user has
a list of their devices and can sign out one or all of them, and so can
you, as the owner, from the console; a generated app has neither, because
nobody asked, and the only way to end a stolen session is to change the
password and hope. If your sign-in is the builder's built-in, check
whether the Users view offers the same; as of 27 October 2026, Lovable's
shows sign-up and last sign-in times and the methods used, and Replit's
Users tab lists people and last sign-in, and neither documents a way to
end a session from there.
### 6. The second person, and the second browser
Symptom: none yet, because nobody has tried. This is the check that finds
the five above before a customer does.
Every check on this list fails for a stranger first and for you last,
because your browser carries the preview's cookies, your email is on the
project's team, and your Google account already consented. So the last
check is the first one to run: a private window, a second email address,
a phone on mobile data rather than your Wi-Fi, and the published address
typed by hand rather than clicked from the editor.
Walk the whole path: sign up, confirm, sign out, sign in, close the
browser, reopen, forgot password. Then do it once more on the custom
domain. Ten minutes, and it is the same ten minutes a stranger will spend
before deciding whether your app is real.
### What prompting it instead costs
The reason this is a checklist and not a prompt: the fix is a setting, and
an agent asked to fix it will change code. Lovable's own pricing page gives
1.20 credits as the example cost of adding authentication in build mode
(read 27 October 2026), and the complaint that dominates every builder's
reviews is the loop: "repeated 'fixes' that did not fix the problem", as
one 1-star Lovable review from 12 October 2026 puts it, and "You will then
spend DAYS and credits telling it to do the same thing 15 times", from
another in September. Fifteen attempts at 1.20 credits is a fifth of a Pro
plan's monthly 100, spent on code that was never wrong. The six checks
above cost nothing but ten minutes, and the one prompt worth sending is
the one in check 1 that names the addresses and forbids code changes.
> **Key takeaway:** Sign-in that works in preview and fails live is an address problem, not a code
> problem. Find the allow list, add the exact live address, test as a stranger
> from a private window. Prompting the agent to "fix login" will spend credits
> on code that was never wrong.
### Where the built-in sign-in is the better pick
If your app has one user per account and the built-in sign-in works for
strangers after the six checks above, keep it. Lovable Cloud, Bolt Cloud
and Replit Auth manage their own redirect addresses when you publish, and
Lovable's built-in sign-in adds SAML SSO and OIDC of its own, where
BuildBase's [enterprise SSO](/enterprise) runs through your own WorkOS
account on the Enterprise plan. An external sign-in adds a client to
register and an address to keep in step, and for a single-user app that is
work for nothing.
Choose a hosted sign-in on your own domain when you want one address to
register per environment instead of one per builder preview, methods that
are switches rather than code (passkeys, magic links, Google, GitHub,
Microsoft, Apple and the rest), a device list and a sign-out that ends the
session everywhere, and the teams and plans layer on top. [Should you run
auth on your own domain](/guides/should-you-run-auth-on-your-own-domain)
is the decision in full, and [the launch
checklist](/guides/vibe-coded-app-launch-checklist) is the other nineteen
things to check before strangers arrive.
### What breaks, and how you can tell
**Loops to the sign-in page on the live site.** Check 1. The live address
is not on the allow list, or differs by one character.
**Lands on `localhost:3000` after sign-in.** Check 1. The Site URL is still
the default. Supabase's and Bolt's docs both name that default.
**Error 400: redirect_uri_mismatch.** Check 2. Google's authorized redirect
URIs do not include the provider's callback address exactly.
**Confirmation email arrives for you and nobody else.** Check 3. The
development sender delivers only to the project's team, at two an hour.
**Signed out on every reload.** Check 4. The session route is not deployed,
or the cookie is set on another host.
**Signed out, pressed back, still inside.** Check 5. Sign-out never reached
the server.
**"Users can't log in", and you cannot reproduce it.** Check 6. You are
testing as yourself. Private window, second email, phone on mobile data.
### Install
If the fix for your app is a hosted sign-in page with one address to
register, the SDK and the CLI write the sign-in routes for you:
```bash
npm i @buildbase/sdk
npx buildbase init --org-id
```
---
## Paid plans that actually gate features: plans, trials, limits and seats for a vibe-coded app
> Every builder takes the money. The hard half is after: the plan has to change what the app does, and nobody may mark themselves paid. Each step with a prompt, from the webhook to the server gate.
- Source: https://www.buildbase.app/guides/paid-plans-that-gate-features-vibe-coded-app
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-27
### In short
A paid plan gates a feature when three things agree: the plan lives on the customer workspace, not in your database; the button checks it in the browser; and the server checks it again before doing the work. Stripe takes the card, BuildBase keeps the plan, and a signed webhook ties the two together.
"The worst Lovable payment bug is the one where the payment works." A
developer who fixes vibe-coded apps for a living wrote that on 20 October
2026, and it is the whole subject of this guide. The customer is charged.
The app never notices. The paid feature stays grey, the customer emails you,
and you refund a payment that worked perfectly.
Every builder now takes the money. Lovable has Paddle and Stripe built in,
Bolt and Replit have Stripe connectors, v0 has Stripe in the Vercel
Marketplace, Base44 has its own payments by Wix. What none of their docs
cover, as of 27 October 2026, is the part after the checkout: a plan that
belongs to a team rather than a person, a trial that ends on its own, a
seat count, a usage limit, and a feature that appears when the plan says
so and disappears when the card fails. That is what you are building here.
When it works: a customer picks a plan on a test card, the paid feature
appears without a reload, a colleague they invited gets it too because the
plan belongs to the workspace, the trial ends and the app knows, and when
the card fails on renewal the feature closes and an email goes out. And at
no point does your app hold a column that says `paid: true`.
What we ran on 27 October 2026: the SDK's plan, entitlement and webhook
pieces are the ones the Next.js guide and the existing billing guides are
built on, and the webhook route is the one `npx buildbase init` writes.
The prompts below are what we hand to an agent; the "what you should see"
lines are what those pieces do. We have not run this flow inside a
builder's own chat today, so where a builder's behaviour matters it is
named.
> **Before you start:** An app with BuildBase sign-in already working (the [v0
> guide](/guides/add-sign-in-teams-and-paid-plans-to-a-v0-app) or the [Lovable
> guide](/guides/add-login-teams-and-paid-plans-to-a-lovable-app) gets you
> there), a Stripe account in test mode, and the signing secret of a webhook
> endpoint created in the console. A workspace per customer is already on by
> default; this guide assumes it.
### 1. Decide what "paid" changes, in writing
Before any prompt, write down what each plan unlocks, as a short list of
feature names: `export`, `api-access`, `five-seats`, `priority-support`.
Those names become feature flags tied to plans, and they are the only
vocabulary the rest of this guide uses. A plan that does not change what
the app does is a donation, not a subscription.
Why first? Because an agent asked for "add Stripe subscriptions" builds a
checkout and stops. It has no idea which button the money is supposed to
turn on, so it turns on nothing, and that is the bug in the opening line.
Naming the features before the prompt is the difference between "add
billing" and "gate the export feature behind the Pro plan".
Keep two kinds of thing apart while you write the list, because they are
wired differently:
- **A feature the plan includes or does not.** Export on Pro, not on
Launch. This is a flag tied to the plan.
- **A quantity the plan allows.** Five seats, 1,000 generations a month,
10 GB. This is a limit or a credit balance, and it has its own guide:
[a credits wallet](/guides/credits-wallet-nextjs)
when it is a balance,
[enforcing quotas](/guides/enforcing-quotas-in-react) when it is a cap.
The distinction between a flag and an entitlement is worth ten minutes
before you prompt: [entitlements are not feature
flags](/blog/entitlements-are-not-feature-flags) explains why "sees the
button" and "may call the endpoint" are two different questions, and why
you want the second.
What you should see: a list of three to six feature names and which plan
carries each. Paste it into the prompts below where they say ``.
### 2. Create the plans in the console, synced to your Stripe
Plans, prices and trials live in the BuildBase console and sync to your own
Stripe account; Stripe is yours, at Stripe's rates, and the platform fee is
0%. No card data touches your app, ever. In the console, create the plans
from step 1 with a monthly and a yearly price each, and mark which features
each plan includes.
Three settings matter more than they look:
**The trial.** A free trial that becomes a plan without a second checkout.
Decide the length now, and decide whether it needs a card. Our own plans
run a 7-day trial with no card; [a trial without a
card](/guides/free-trial-without-a-card-nextjs) walks through what changes
when you skip the card, chiefly that the trial ending has to do something
on its own.
**Versions.** A plan change creates a new version rather than editing the
old one, so raising a price never moves an existing customer unless you
choose to move them. [Plan versioning](/guides/plan-versioning-nextjs) is
the day-you-raise-prices guide, and
[proration on plan change](/guides/proration-on-plan-change-nextjs) covers
what the customer is charged when they switch mid-month.
**Currencies.** Pick them before the first subscription. [Choosing your
currencies before you have
customers](/guides/choosing-billing-currencies-before-your-first-subscription)
is short and saves a migration.
The pricing page and the checkout come ready-made, in 21 currencies, and
you can use the SDK's or draw your own against the same plans. If you draw
your own, the [annual and monthly toggle](/guides/annual-and-monthly-toggle-nextjs)
is the one piece worth copying rather than inventing, because the yearly
price has to come from the plan rather than from a multiplication in the
component, or the two drift the first time you change one.
What you should see: in Stripe's test dashboard, products and prices that
match the console, created by the sync rather than by hand. If you made a
price in Stripe first, that is the wrong direction; the console is the
source and Stripe the mirror, and
[keeping a pricing page honest against your plans](/guides/keeping-a-pricing-page-honest-against-your-plans)
explains why.
### 3. The webhook: where the plan reaches your app
The plan never lives in your database. It lives on the customer's workspace
in BuildBase, and your app learns about changes through signed webhook
events. The route that receives them is the one `npx buildbase init` writes,
or the one this prompt asks for:
```text
Add a POST route at /api/webhooks/buildbase (app/api/webhooks/buildbase/route.ts on Next.js). Verify every delivery with parseWebhookEvent from @buildbase/sdk on the raw request body, using BUILDBASE_WEBHOOK_SECRET from the environment, and reject anything that fails verification with 401.
Handle these events by name and nothing else: subscription.created, subscription.upgraded, subscription.downgraded, subscription.canceled, subscription.suspended, subscription.trial_will_end, subscription.trial_expired, payment.failed, payment.succeeded.
Do not write the plan, the trial state or any "paid" flag to my database. The workspace carries them. Use the events to send email, post to Slack, or log, and respond 200 quickly.
```
Then, in the console, point an endpoint at that address and copy its
signing secret into `BUILDBASE_WEBHOOK_SECRET`.
Why "do not write the plan to my database" is in the prompt, in bold in
our heads: the audit that keeps coming up in these guides found, in
February 2026, "development endpoints still in production that let anyone
mark themselves as a paid user and give themselves unlimited credits". That
endpoint existed because the plan was a row the app owned. When the plan
is a property of the workspace in BuildBase, read through the SDK, there is
no row to flip and no endpoint to leave behind.
What you should see: subscribe on a test card, and the console's delivery
log for the endpoint shows `subscription.created` delivered with a 200 from
your route. Stop your server, cancel the subscription, start it again: the
`subscription.canceled` delivery is retried and lands, because deliveries
are tried up to five times over about two and a half minutes. [What a
webhook is, and what happens when delivery fails](/blog/what-are-webhooks)
has the ladder.
**Correcting potential issues.** If the agent wrote a Stripe webhook
handling `invoice.paid` or `customer.subscription.updated` directly, it
built the billing a second time, next to the one in the console. Paste:
"Remove the direct Stripe webhook. BuildBase receives Stripe's events; my
app receives BuildBase's events at /api/webhooks/buildbase only." If it
added a `plan` column to a users or workspaces table, paste: "Remove the
plan column. The plan is read from the workspace through the SDK, never
stored in my database."
### 4. The button: gate the feature in the browser
In the app, the gate is a component around the feature, with the feature
name from step 1 as its `slug`. The SDK ships two for this, and the
difference matters.
```tsx
import { WhenEntitled, WhenWorkspaceFeatureEnabled } from '@buildbase/sdk/react';
// The current workspace's plan includes this feature, and nobody has turned it off.
}>
// The flag is on for this workspace, whichever plan it is on.
```
`WhenEntitled` answers the plan question: does this workspace's plan
include the feature, and is it still available (a suspended subscription
says no). `WhenWorkspaceFeatureEnabled` answers the switch question: is the
flag on for this workspace, which is how you run a beta for the customers
you choose, or let a workspace admin turn an allowed feature on or off from
the built-in settings screen. Most paid features want the first; most
betas want the second.
Prompt for it:
```text
Wrap each paid feature in the app in from @buildbase/sdk/react, using these feature slugs: . Where a feature is locked, show a short upgrade prompt that opens the SDK's plan screen; do not hide the button silently.
Show the current plan, the trial end date and an upgrade or cancel action on the /settings page using the SDK's built-in billing screen. Do not build a custom pricing table; use the SDK's.
```
What you should see: on a free workspace the export button shows the
upgrade prompt; subscribe on a test card and it becomes the real button
without a reload, because the workspace's plan changed under the component.
A teammate in the same workspace sees the same, because the plan belongs
to the workspace rather than to the person who paid. That last part is
what a per-user subscription cannot do, and it is why Lovable's one
subscription per user, documented as the default on 27 October 2026, is
the wrong shape for anything with teams.
> **Key takeaway:** The browser gate decides what people see. It never decides what they may do.
> Anything a component hides can be requested by hand, so step 5 is the one that
> makes the plan real.
### 5. The server: the gate that cannot be bypassed
Every feature the browser gates has a server route that does the work, and
that route checks the plan again before doing it. This is the step
generated apps skip, and it is the step the audits catch, so it gets its
own prompt rather than a sentence in another one.
```text
In every server route that performs a paid feature (), check the current workspace's entitlement for the feature slug through the BuildBase server SDK before doing the work, using the session from the request, and return 402 with a short JSON error when the workspace is not entitled. Never trust a plan or feature value sent by the browser in the request body or headers. Do not cache the answer across requests.
```
Why 402 and why "never trust the request body": the other finding in that
February audit was "a live marketplace with real Stripe payments where any
logged-in user could grant themselves admin and hijack payment routing
with a single request", and a Mastodon post from a developer who reviews
AI-built code names the pattern he looks for first: "server routes that
take a user id from the request body instead of the session". A plan in
the request body is the same mistake with a different noun. The server
asks BuildBase who this session is and what its workspace is entitled to,
and ignores whatever the browser claims.
[Server-side quota enforcement](/guides/quota-enforcement-server-side-nextjs)
shows the same shape for a limit, and the reason the answer should not be
cached for long: a permission change reaches a signed-in user within the
hour, and [why that is](/blog/why-permissions-refresh-hourly) is a trade we
made on purpose.
What you should see: in the browser's developer tools, copy the request
the export button makes and replay it from a free workspace's session. It
should come back 402, every time, whatever you put in the body.
**Correcting potential issues.** If the route checks a header like
`x-plan: pro` or a field in the JSON body, paste: "Remove every plan or
feature value read from the request. Derive the workspace from the session
and ask the BuildBase server SDK for the entitlement." If the route checks
nothing because "the button is already hidden", paste the same line, and
then read step 4's takeaway again.
### 6. Seats, when the plan is per person
Some plans are priced per seat: three members included, more at a price.
The workspace keeps the seat count, inviting past it is refused by the
server with a named error, and the SDK's `useSeatStatus` counts pending
invitations against the ceiling the same way the server does, so the
invite button can say "2 of 5 seats" before anyone clicks it.
[Charge per seat](/guides/charge-per-seat-nextjs) is the full guide, and
the prompt is one line:
```text
Price the Pro plan per seat with three seats included. Show seat usage from useSeatStatus on the members screen, and let an admin buy more seats through the SDK's plan screen. Do not count members in my own database; the workspace knows.
```
What you should see: the fourth invitation on a three-seat plan is refused
with a seat-limit error the members screen shows in words, not a silent
nothing. If you ever see "something went wrong" instead, the error's
`code` was dropped on the way to the screen; the SDK's invitation errors
carry it.
### 7. The trial ends, the card fails: what happens on its own
A subscription has a life after checkout, and the events in step 3 are how
the app keeps up without you watching. Three of them deserve a workflow
rather than a line in the webhook route, because a workflow is a thing you
can see ran.
- **`subscription.trial_will_end`**: a heads-up email a few days before,
with a link to the plan screen. This is the single most effective email a
SaaS sends, and generated apps never send it because nobody asked.
- **`payment.failed`**: an email saying the card failed, with the link to
update it, and a note to your Slack channel. The subscription is not
cancelled on the first failure; the dunning sequence handles retries, and
[usage that does not match the invoice](/guides/usage-does-not-match-invoice)
explains the states between "paid" and "gone".
- **`subscription.suspended`**: the feature gate from step 4 closes on its
own, because `WhenEntitled` reads the workspace's state, and a last email
says so.
In the console's workflow editor these are three triggers, two email steps
and one Slack step, published without a deploy. In the app, nothing
changes, which is the point.
What you should see: let a test card fail on renewal (Stripe's test cards
include one that fails on the second charge). The `payment.failed` delivery
lands, the email goes out from your sending domain, Slack gets a line, and
the export button on that workspace shows the upgrade prompt again once the
subscription is suspended.
### Where the builder's own payments are the better pick
Keep Lovable's built-in payments, or Bolt's or Replit's Stripe connector,
when your app sells one subscription to one person and the plan does not
need to change what the app does beyond a single "premium" check. Inside
the builder they are a prompt away, and Lovable's Paddle option (5.0% plus
50 cents per transaction, read from its docs on 27 October 2026) handles
the tax side, which Stripe alone does not. If you sell in many countries
and want someone else to be the merchant of record, that is a real
advantage we do not offer; our billing is Stripe, bring your own.
Choose this guide's shape when the plan belongs to a team, when a feature
has to open and close with the subscription, when seats or limits are
part of the price, or when a trial has to end without you. Lovable's docs
describe one active subscription per user by default, one provider per
project, and a project that cannot be forked once payments are on; none of
Bolt's, Replit's or v0's describe a plan per team at all. That layer is
what the webhook, the two gates and the workflows above add, with Stripe
still yours. [The Clerk and Stripe combination, and when to skip
it](/compare/clerk-stripe-combination) is the same comparison from the
other side.
### What breaks, and how you can tell
**Paid, still on the free plan.** The endpoint in the console points at
the wrong address, or `BUILDBASE_WEBHOOK_SECRET` is empty. The delivery log
shows each attempt: a 401 means the secret, a timeout means the route.
**The feature appears for the person who paid and not for their
teammate.** Something stored the plan per user. Remove it; the plan is on
the workspace, and `WhenEntitled` reads the workspace.
**The feature works after cancelling.** The server route in step 5 is
missing, or it cached the answer. Replay the request from the cancelled
workspace's session and watch for the 402.
**Two customers were charged twice for one upgrade.** Your route did the
work twice because the retry ladder delivered the same event twice and
nothing noticed, which is what the event id is for: it is identical on
every retry, so store it and make a second sighting a no-op.
[Idempotency in billing](/blog/idempotency-in-billing) is the fix.
**The pricing page shows a price Stripe does not charge.** Someone edited
Stripe by hand. The console is the source. Re-sync, then read
[keeping a pricing page honest](/guides/keeping-a-pricing-page-honest-against-your-plans)
before it happens again.
**The trial ended and nothing happened.** No workflow is listening to
`subscription.trial_expired`, so the gate closed on its own and the email
did not go out, because nobody asked for it. Step 7.
### Install
Add the SDK to the app you have, or let the CLI write the webhook route and
the rest of the sign-in files:
```bash
npm i @buildbase/sdk
npx buildbase init --org-id
```
---
## Teams, invites and admin vs member for an app you built with a prompt
> No builder ships teams for your end users. Give every customer their own workspace, let them invite colleagues by email, and make admin vs member a rule the server enforces, not a hidden button.
- Source: https://www.buildbase.app/guides/teams-invites-and-roles-for-a-vibe-coded-app
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-27
### In short
To add teams to a vibe-coded app, give every customer a workspace of their own on first sign-in, let members invite colleagues by email with a role, and enforce that role where the data is read, on the server. BuildBase holds the workspaces, members and roles; your database keeps the data, scoped by workspace id.
Two people from the same company sign up for your app separately. Now you
have two accounts that should have been one, two sets of data that should
have been shared, and no way to merge them that does not involve you, a
database, and a Saturday. This is the teams problem, and it arrives with
the second customer rather than the hundredth.
No builder ships the answer for your end users. Lovable's changelog is full
of workspaces, roles, invites and SCIM, and every entry is about Lovable's
own workspaces for the people building the app. Its end-user sign-in docs
describe no teams, roles or invitations; Base44's cover sign-in methods and
no roles; Bolt, Replit and v0 document nothing here. All read on 27 October 2026. Whatever a prompt builds for teams, it builds from scratch, and what
it builds is the subject of every audit of a vibe-coded app we have read.
So this guide does it the other way round. The workspaces, the members, the
invitations and the roles live in BuildBase, where they already exist, and
your database keeps your data with one extra column. When it works: a new
customer lands in their own workspace the moment they sign in, invites a
colleague who gets an email and arrives in the same workspace with the role
they were given, sees a member list and a switcher, and cannot see, or
change, a single row that belongs to another company, however the request
is made.
What we ran on 27 October 2026: the workspace, invitation and role pieces
below are the ones the published guides on
[workspaces in an afternoon](/guides/multi-tenant-workspaces-in-an-afternoon),
[team invitations](/guides/team-invitations-nextjs) and
[roles per workspace](/guides/roles-and-permissions-per-workspace-nextjs)
are built on, and the data-isolation pattern is the one in
[per-org data isolation](/guides/per-org-data-isolation-nextjs). The
prompts are what we hand an agent. We have not run them inside a builder's
chat today.
> **Before you start:** An app with BuildBase sign-in working (the [v0
> guide](/guides/add-sign-in-teams-and-paid-plans-to-a-v0-app) or the [Lovable
> guide](/guides/add-login-teams-and-paid-plans-to-a-lovable-app) gets you
> there), and a BuildBase organization in Platform mode, which is the default. A
> second email address you control, for the invite.
### 1. Decide what a workspace is, in your product's words
A workspace is the thing a customer pays for and shares with colleagues.
Before any prompt, decide what your product calls it (team, company,
studio, school, client) and whether a person can belong to more than one.
That one decision shapes the switcher, the invitation email and the
settings screen, and an agent will guess it wrong if you do not say.
Two settings in the console back the decision, under the organization's
workspace settings:
- **Auto-create first workspace.** On by default: a new user lands in a
workspace of their own on first sign-in, with no setup step. Leave it on
unless every user is invited into an existing team and never starts one.
- **Can users create more workspaces.** On if a consultant can have one
workspace per client; off if a person belongs to exactly one company.
What you should see: a decision written in one line ("a workspace is a
school; teachers belong to one; admins can create more"), and the two
switches set to match. Everything below uses your word.
### 2. The switcher and the first workspace
The SDK's `useSaaSWorkspaces()` returns every workspace the signed-in
person belongs to, the current one, and the calls to create and switch.
The switcher is one component you style; the data is already there. Prompt
for it:
```text
Add a switcher to the app header using useSaaSWorkspaces() from @buildbase/sdk/react: list the the user belongs to, mark the current one, switch on click, and show "New " if the organization allows users to create more.
Call fetchWorkspaces() once after sign-in and select the first if none is selected.
Do not create , membership or role tables in my database; BuildBase holds them. Every page that shows my data reads currentWorkspace.id from useSaaSWorkspaces() and uses it in the query.
```
What you should see: sign up with a fresh email and you are in a workspace
already, named for you, with the switcher showing one entry. If creating
more is allowed, create a second and switch; the pages re-query for the
new id. If the switcher is empty, the override in step 1 is off or the
organization is in Personal mode, and
[auto-created first workspace](/guides/auto-created-first-workspace-nextjs)
has the two-minute fix.
The last line of that prompt is the one that matters, and the next section
is about why.
### What an agent builds for teams when nobody tells it otherwise
Left to itself, an agent asked for "teams" writes a `teams` table, a
`memberships` table with a `role` column, and a page that lists members. It
is the textbook shape, and it is where every audit of a vibe-coded app we
have read finds the leak, so it is worth knowing before you prompt what
the generated version leaves out.
The invitation is usually a row inserted for an email address, with no
email sent, no pending state and no expiry, so the invited person either
never hears about it or arrives to find nothing. The role is checked on
the page that lists members and nowhere else; the routes that change data
trust whoever is signed in. The workspace id travels in the request body,
because that is the easiest place for the agent to put it, which means any
member can send another workspace's id. And the "current workspace" is
whatever the browser last said it was.
None of that is carelessness. A developer who runs a competing platform
said on Hacker News in August 2026 that the apps he sees from
non-technical founders are "all apps with multi-tenancy - database backed
- payment integrations - the works", a dance-school management tool, a
classifieds site with paid upgrades. The builders ask for teams because
their customers are teams, and the agent delivers the textbook, which was
written for a tutorial with one trusted user. The three findings from the
February 2026 audit (self-promotion to admin, a paid flag anyone could set,
a dev endpoint left live) are the textbook meeting its first stranger.
What this guide does differently is move the parts that need to be right
(who is in which workspace, who may do what, how an invitation becomes a
member) into a system that already enforces them, and leave the agent one
job it can do well: filter your rows by an id the server already knows.
### 3. Your data, scoped by workspace: the part no SDK does for you
Your tables are yours, in Lovable Cloud, Supabase, Neon or wherever the
builder put them, and every row that belongs to a customer carries their
workspace id. BuildBase decides who is in which workspace; your queries
decide which rows a workspace sees, and no SDK can write those queries for
you. This is the step a prompt gets wrong most often, so it is the longest
one.
The rule has three parts, and all three have to hold:
1. **Every customer row has a `workspace_id` column**, set when the row is
created, from the current workspace, on the server.
2. **Every read and write filters by it**, with the id taken from the
session's workspace on the server, never from the request body.
3. **The database refuses what the query forgets.** Row-level security in
Supabase or Postgres, or a check in the data layer that no route can
skip.
Why "never from the request body" gets its own clause: a developer who
reviews AI-built code wrote on 25 October 2026 that the first thing he
looks for is "server routes that take a user id from the request body
instead of the session", alongside "tables without RLS, policies that say
true". A workspace id in the request body is the same bug: any member can
send another workspace's id and read its rows. The server knows which
workspace the session is in; it never needs to be told.
```text
Add a workspace_id column to every table that holds customer data (), filled on insert from the current workspace on the server. Filter every select, update and delete by workspace_id, taking the id from the server session's current workspace, never from the request body, query string or headers.
Add row-level security policies so a row is only readable and writable when its workspace_id matches the caller's current workspace. Keep the policies in a migration file I can read.
```
If your sign-in is BuildBase and your data is in Supabase, there is one
honest wrinkle: Supabase policies keyed to `auth.uid()` do not know a
BuildBase session. Either read and write through server routes that check
the session and query with a server credential scoped by the workspace id,
or mint a Supabase-shaped token on your server for browser queries. Both
are laid out in [the Lovable
guide](/guides/add-login-teams-and-paid-plans-to-a-lovable-app), section 7,
and [per-org data isolation](/guides/per-org-data-isolation-nextjs) shows
the server-route shape in Next.js.
What you should see, and this is the test that matters: sign in as a
member of workspace A, open a page that lists rows, and in the browser's
developer tools replay the request with workspace B's id in the body, the
query string and a header. Every attempt returns A's rows or nothing. Then
change the id in the page address, if the page carries one. Same result.
If any of those returns B's data, the filter trusts the client, and nothing
else in this guide helps until that is fixed.
> **Key takeaway:** BuildBase decides who belongs to which workspace. Your queries decide which
> rows a workspace sees, with the id from the session, never the request. Both
> halves have to be right, and the audits say the second half is the one that is
> usually wrong.
### 4. Invite a colleague by email
Members invite teammates by email and give each one a role. An address
with no account yet gets an email with a link; following the link is the
proof, so the person signs up and lands in the workspace without a
separate email-verification step. If the organization has switched
invitations off, the landing page says so before anyone is sent anywhere.
The SDK's built-in members screen does all of this, which is why the
prompt is mostly about not rebuilding it:
```text
Add a /settings page that opens the SDK's built-in workspace, members and billing screens. On the members screen, admins can invite by email with a role, change a member's role, remove a member, and see and withdraw pending invitations; members see the list read-only.
Use the SDK's screens and hooks (useWorkspaceInvitations, inviteMember); do not build an invitation table, an invitation email or an accept page of my own.
```
What you should see: invite your second email address as a member. The
email arrives from your sending domain with a link; open it in a private
window, sign up, and you land in the same workspace with the member role.
Back in the first window, the pending invitation has become a member. Then
invite the same address again: refused, with a named reason, because the
SDK's invitation errors carry a `code` and the server's fields (the seat
limit and the count when it is a seat limit, the retry delay when it is a
rate limit), and the screen says each in words.
Two things can refuse an invitation that look like bugs and are not. A
seat limit on the plan, which the members screen shows as "n of m seats"
through `useSeatStatus`, counting pending invitations the way the server
does. And an outsiders policy: an organization can block inviting people
from outside its own domains, or cap the role an outsider may hold, and
the error names that too. [Why an invited member cannot see the
workspace](/guides/invited-member-cannot-see-workspace) walks the other
failure, where the invitation worked and the data did not follow.
### 5. Admin and member: enforce the role where the data is
A role is a rule about what a teammate may do, and it is only a rule if the
server applies it. Owners and admins decide what each member can do; the
API refuses what the role does not allow; the interface merely hides what
would be refused. Generated apps get the third part and skip the second,
which is the bug every audit finds.
The February 2026 audit of three apps posted to Reddit found "a live
marketplace with real Stripe payments where any logged-in user could grant
themselves admin and hijack payment routing with a single request". The
admin button was hidden. The request behind it was not checked. One
request.
Roles in BuildBase exist at two levels: organization roles for your own
staff, and workspace roles for the customer's team, with defaults a
workspace can adjust and permissions you add for your product ("export
reports", "manage billing"). In the browser, the SDK ships the gates:
```tsx
import { WhenWorkspaceRoles, WhenPermission } from '@buildbase/sdk/react';
```
And on the server, the same question asked of the session, not the
request:
```text
Every server route that changes data or settings must check the caller's role or permission in the current workspace through the BuildBase server SDK, using the session, before doing the work, and return 403 with a short JSON error otherwise. Never read a role, a permission or an "isAdmin" value from the request body, query string or headers.
In the browser, wrap admin-only controls in or from @buildbase/sdk/react, as a convenience only; the server check is the rule.
```
Two levels, and it is worth knowing which you are prompting for. An
organization role is for your own staff: who at your company may see
every workspace, change plans, read the audit log. A workspace role is for
the customer's team: owner, admin, member, or the names your product uses,
with the defaults a workspace admin may adjust for their own team. The
permissions you add ("reports.export", "billing.manage") hang off workspace
roles, so a customer's owner decides which of their colleagues may export,
and your server asks that question of the workspace, not of a global
table. If you have one role column today, this is why it is not enough:
the same person can be an admin of one workspace and a member of another.
What you should see: as a member, copy the address of an admin-only page
and open it: the controls are gone. Then, from the developer tools, replay
an admin request (change a role, delete the workspace) with the member's
session. 403, every time, whatever the body says. If it succeeds, the
route checks nothing or checks the client, and that is the one-request
bug.
One honest caveat about timing: a role change reaches a signed-in user
within the hour, not instantly, because the SDK refreshes permissions on a
schedule rather than on every request. [Why permissions refresh hourly and
not instantly](/blog/why-permissions-refresh-hourly) is the trade, and
[a permission change not taking
effect](/guides/permission-change-not-taking-effect) is what to do when
you need it sooner. [What is RBAC](/blog/what-is-rbac) is the explainer if
"role" and "permission" are blurring together.
### 6. Switching, and the data that did not switch
The last bug is the quiet one. A person switches workspace in the
switcher, and a page still shows the old workspace's rows, because a hook
cached them or a query ignored the change. It looks like a leak and it is
usually a stale fetch.
```text
Every data hook and loader in the app depends on currentWorkspace.id from useSaaSWorkspaces(): when it changes, refetch, and clear any cached rows from the previous before the new rows arrive. Never keep rows from one in memory while another is selected.
```
What you should see: with two workspaces that have different data, switch
back and forth. Each page shows only the selected workspace's rows,
immediately, with no flash of the other's. [Stale data after a workspace
switch](/guides/stale-data-after-workspace-switch) covers the cache
details in Next.js.
### The screens you do not have to build
The settings screens for all of this ship with the SDK: workspace, members
(invite, pending invitations, roles, remove), billing, plan, usage,
devices, notifications and the rest, thirteen in all, in eight languages
including right-to-left ones. The `/settings` prompt in step 4 opens them
inside your app's own layout. You can draw your own members screen against
the same hooks (`useSaaSWorkspaces`, `useWorkspaceInvitations`,
`useSeatStatus`), and the only reason to is a design system the built-in
screens do not match; the behaviour is the same either way, and the
refusals (a seat limit, an outsider policy, a duplicate invitation) come
back as the same named errors.
Where the built-in screens earn their keep is the part nobody budgets for:
the pending-invitation list, the "withdraw" action, the role change that
has to be refused when it would leave a workspace with no owner, the
member removal that has to end that person's session on the server. A
generated members page does the first thing on that list and none of the
others.
### Where the builder's built-in sign-in wins
If your app is for one person, a notebook, a personal tracker, a tool for
a single operator, you do not need any of this, and the builder's built-in
sign-in with its users list is the better pick: zero setup, no switcher,
no roles to explain. Lovable's Users view, Replit's Users tab and Base44's
auth cover that case well, and adding workspaces to an app that will never
have two people in one account is weight for nothing.
The moment a second person from the same customer shows up, the maths
flips. Merging two personal accounts into one team later is the migration
every small SaaS dreads, and the audits say the generated version of teams
is where the data leaks. [What is multi-tenancy](/blog/what-is-multi-tenancy)
is the short explainer; [the best multi-tenant
backend](/compare/best-multi-tenant-backend) is the comparison if you want
to weigh the alternatives before committing.
### What breaks, and how you can tell
**A member sees another company's rows by changing an id.** The filter
takes the id from the request. Step 3, and nothing else matters until it
is fixed.
**The switcher is empty, or "New team" does nothing.** Auto-create is off,
the organization is in Personal mode, or "Can invite members" is disabled
under advanced overrides. Step 1's two switches.
**The invitation email never arrives.** It is sent from your organization's
sending domain, and that domain is not set up yet; [email landing in spam](/guides/transactional-email-landing-in-spam) is the guide. The
invitation itself exists; check pending invitations on the members screen.
**Invited, signed up, sees nothing.** The person signed up with a different
email than the one invited, or accepted in a browser that then switched to
a personal workspace. [Invited member cannot see the
workspace](/guides/invited-member-cannot-see-workspace) walks it.
**A member promoted themselves.** The role-change route checks the client,
or checks nothing. Step 5; replay the request to prove the fix.
**The role changed but the member still sees the old buttons.** Up to an
hour, by design. Sign out and in to force it, or follow
[permission change not taking effect](/guides/permission-change-not-taking-effect).
### Install
Add the SDK to the app you have, or let the CLI write the sign-in files
the switcher and members screen sit on:
```bash
npm i @buildbase/sdk
npx buildbase init --org-id
```
---
## The vibe coder's launch checklist: 20 things between a demo and a product
> Your AI-built app works for you. Before strangers use it, twenty things have to be true that a demo never tests: login that holds up live, teams, plans that gate access, emails that arrive.
- Source: https://www.buildbase.app/guides/vibe-coded-app-launch-checklist
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-27
### In short
A vibe-coded app is ready for strangers when twenty things are true that a demo never tests: sign-in that survives publishing, teams with roles, paid plans that gate features, emails that arrive, usage limits, signed webhooks. This list names each in plain words, what your builder already covers, and what to add.
Your app works. You showed it to a friend, they signed up, it looked real.
Then you published it, and the second person who tried it could not log in.
That is not a bug in the usual sense. A demo tests one person, in one browser,
who already trusts the app and never tries to break it. A launch tests
strangers, their colleagues, their phones, and their credit cards. Twenty
things have to be true for that to go well, and a demo exercises none of
them, which is why the demo passed and the launch did not.
This is that list. It is written for someone who built the app by prompting
and will add the next piece the same way, so every item says what the thing
is in plain words, what your builder already gives you (checked on 27 October
2026 against each builder's own docs), what to look at on the live site, and
what to add. The technical term appears once in brackets so you can search
for it. After that, the plain word does the work.
### Why the demo passed and the launch will not
The demo passed because nothing in it was hostile. The launch fails because
the app has no opinion about strangers: who they are, which company they
belong to, what they paid for, what they may see. Those four questions are
the whole difference between a working page and a product, and no builder
answers them for you by default.
The evidence is not theoretical. In 2025 a scan of 1,645 published Lovable
apps found 170 of them, 10.3%, with database tables any visitor could read or
write; that became CVE-2025-48757, which Lovable disputes. In February 2026 a
researcher reported 16 flaws in one exam app featured on Lovable's own
Discover page, including a
sign-in check written backwards that let anonymous visitors in and blocked
real users; 18,697 records were exposed. The same month, a developer audited
three products people had posted to Reddit and wrote up what he found: "any
logged-in user could grant themselves admin and hijack payment routing with
a single request", and in another, "development endpoints still in
production that let anyone mark themselves as a paid user and give
themselves unlimited credits".
None of those apps was broken in the demo sense. Every one of them worked for
its builder. An ICU doctor who had spent a month vibe-coding medical
simulators said the quiet part out loud on Hacker News in September, while
explaining why he would not post his own email address on the forum: "I'm
not smart enough to know whether that is safe or not." A person who ships
software to strangers and cannot judge that about an email address is the
reader this list is for. Nobody can judge it by looking. You have to check.
### How to use this list
Go in order. The order is the order a stranger meets your app: the front
door first, then who they are and who they work with, then money, then the
things that happen on their own, then what your server hears about, then the
rest of the product. Do each check on the **published** site, in a private
window, as a second person, never as yourself in the builder's preview.
For each item there is a line saying what the builders cover. Lovable, Bolt,
Replit, v0 and Base44 ship more every week, so that line carries a date, and
if you are reading this months later, open the builder's docs before you
trust it. The paste prompt is at the end, and so is the install line.
### The front door
The two things about login that a demo never tests are the second browser
and the second week. A sign-in that works in the preview, in your own
browser, proves nothing about a stranger on a phone or about the same person
coming back after a holiday. Both are checks you can run in five minutes.
#### 1. Login that survives publishing
What it is: sign-in (authentication) that works on the live address, not
just in the editor. The way it fails is specific: it works in preview, then
on the published site it loops back to the sign-in page, or lands on
`localhost`, or the Google button spins and stops. A Replit review from 17
October 2026 reads, in full, "Users can't log in."
Why: the provider doing the sign-in only sends people back to addresses it
has been told about. The preview address was registered; the published one
was not. Lovable's own sign-in docs point at exactly this when sign-in works
in preview but fails on a published or custom domain, and add that if you
connected your own Supabase project, Lovable does not update those addresses
for you.
What the builders give you, 27 October 2026: Lovable's built-in sign-in
covers email, phone, Google, Apple, Microsoft, Sign in with Lovable, SAML SSO
and OIDC, with up to 50 redirect addresses per app. Bolt Cloud covers email
and Google. Replit gives you Replit Auth or a Clerk account it provisions.
v0 has no end-user sign-in of its own; Clerk and Auth0 are one click away.
Base44 has built-in sign-in with social providers.
What to check: open the published site in a private window, sign up with a
second email, close the browser, open it again. You should still be signed
in. Then sign out and confirm you really are: reload, and you should be
asked to sign in again.
What BuildBase adds: a hosted sign-in page on your own domain, so there is
one address to register per environment instead of one per builder preview.
The methods are switches in the console, not code: email and password, a
magic link, an email code, a phone sign-in code sent through your own Twilio
account, passkeys, Google, LinkedIn, GitHub, Microsoft, Apple, your own OIDC
provider, and Ethereum or Solana wallets. Sessions are 30 days by default,
and sign-out ends the session on the server, not just in the browser.
#### 2. A list of your users, and the power to sign one out
What it is: a record of every person who signed up (user management), with
their devices and their activity, and two buttons you will need on a bad
day: sign this device out, and block this account.
The demo never needs this because the only user is you. The first support
email you get after launch is "I think someone else is logged into my
account", and the honest answer requires a device list.
What the builders give you: Lovable's Users view is a searchable list with
sign-up and last sign-in times and the methods each person used. Bolt and
Base44 show users in their database views. None of them documents a device
list or a sign-out-everywhere button for your end users.
What to check: sign in on two browsers as the same person. Can that person
see both sessions anywhere? Can you, as the owner, end one of them?
What BuildBase adds: every user has a device list, and both the user and you
can sign out one device or all of them. You can remember things about each
person (onboarding done, plan chosen) as attributes, keep lists of people by
hand or by filter, and import a CSV of the mailing list you already have.
### Who is who
A stranger rarely arrives alone. They sign up for their company, invite a
colleague, and expect the colleague to see the same data and nothing else.
Teams and roles are the two items on this list that no builder ships for
your end users today, and they are the two that every audit of a vibe-coded
app finds broken.
#### 3. Teams: an account per company, not per person
What it is: each customer gets their own space (a workspace, which is what
multi-tenancy means in practice) with its own members, its own plan and its
own data. One company hitting a limit never blocks another. Builders say
"teams"; developers say "tenants". Same thing.
Why it matters now rather than later: the moment two people from one company
sign up separately, you have two accounts that should have been one, and
merging them later is the single most painful migration a small app does.
What the builders give you, 27 October 2026: Lovable's changelog is full of
workspaces, roles, invites and SCIM, and all of it is about Lovable's own
workspaces for the people building the app, not for the people using it.
Lovable's end-user sign-in page mentions no teams, roles or workspaces,
Base44's auth docs cover sign-in methods and no roles, and Replit, Bolt and
v0 document nothing here for end users at all.
What to check: sign up as two people from the same imaginary company. Can
the first invite the second? Does the second see the first's data, and only
that? Can either of them see a third stranger's data by changing an id in
the address bar?
What BuildBase adds: a new user lands in a workspace on first sign-in, with
no setup step, and you decide whether they may create more. A switcher shows
every workspace a person belongs to; you style the button, the SDK does the
rest. Members invite teammates by email, including people who have no
account yet, and give each one a role. Each workspace carries its own plan,
seats and limits.
#### 4. Admin and member: who can press which button
What it is: roles and permissions (RBAC). Owners and admins decide what each
teammate can do, and the rule is enforced where the data lives, not only by
hiding a button in the interface.
That last clause is the whole item. The audit quoted above found an app
where "any logged-in user could grant themselves admin" with one request,
because the button was hidden and the request behind it was not. A prompt
that says "only admins can see the billing page" will usually hide the page.
It will not usually stop the request.
What the builders give you: nothing documented for end-user roles on any of
the five, as of 27 October 2026 (Lovable's built-in payments page does
mention roles, but those are Lovable's own roles for who may set up payments
on the project).
What to check: as a plain member, copy the address of an admin-only page
and open it. Then repeat an admin request with your member session from the
browser's developer tools, and watch what comes back; both should be refused
by the server, not just missing from the menu.
What BuildBase adds: roles at the organization level and per workspace, with
permissions of your own ("export reports") and defaults a workspace can
adjust. The same rules are enforced by the API, which is the half most
generated apps skip. One honest caveat: a permission change reaches a
signed-in user within the hour, not instantly, and
[why that is](/blog/why-permissions-refresh-hourly) is a trade we made on
purpose.
### Getting paid
"Payments feel like the kind of thing that should require a 'real'
developer." A builder who could not code wrote that in July 2026, then found
Stripe worked first time. Taking the money is the easy half, and every
builder now does it. The hard half is what happens after: the plan has to
change what the app does, the trial has to end, the invoice has to exist.
#### 5. Plans, prices, trials and the invoice
What it is: subscriptions and billing. Your plans and prices, a free trial
that becomes a paid plan without a second checkout, upgrade and downgrade and
cancel from inside the app, and an invoice for every charge.
What the builders give you, 27 October 2026: Lovable's built-in payments run
through Paddle (5.0% plus 50 cents per transaction, and a flat 10% under $10)
or your own Stripe account at Stripe's standard rates, on Pro and up, with
one active subscription per user by default and one provider per project.
Bolt Cloud and Replit have Stripe connectors; v0 has Stripe in the Vercel
Marketplace; Base44 has its own payments by Wix, or Stripe.
What to check: subscribe with a test card, cancel, and look for the invoice.
Then change the price of a plan and check that existing subscribers kept
theirs. Most generated billing code mutates the plan in place, and existing
customers wake up on the new price.
What BuildBase adds: plans, prices and trials synced to Stripe, in 21
currencies, with seat-based or usage-based pricing, a ready-made pricing page
and checkout or your own. Stripe is yours, and the platform fee is 0%. A
plan change creates a new version rather than editing the old one, so nobody
is moved without you choosing to move them. Our own plans are a Free plan, then
Launch at $19 a month, Grow and Scale, with a 7-day trial and no card on the
paid ones.
#### 6. Paid plans that actually gate features
What it is: the link between what someone paid for and what the app lets
them do (entitlements, usually built on feature flags). "Paid but the app did
not unlock" is one of the five most common complaints after launch, and the
reverse, "I marked myself as paid", is one of the five most common findings
in an audit.
Why it goes wrong: the payment happens at Stripe, and the app finds out
through a message Stripe sends to your server afterwards. If that message is
not handled, or is handled by a check in the browser, the plan and the
feature never connect. The developer who audited three Reddit-posted apps
found exactly that endpoint, left in production, that let anyone mark
themselves paid.
What the builders give you: the checkout. What happens between the webhook
and the feature is yours to build, on all five, and the docs stop at the
payment.
What to check: pay on a test card and watch the feature appear without a
reload. Then, in the browser's developer tools, look for the request that
decides whether you are on the paid plan. If it is a request your browser
makes, it is a request your browser can forge.
What BuildBase adds: feature flags tied to plans, so a paying workspace sees
the paid features and a free one does not, decided on the server. Beta
features for the users or lists you choose. A settings screen where a
workspace admin can turn allowed features on or off. The piece in the
middle, [entitlements rather than flags](/blog/entitlements-are-not-feature-flags),
is the distinction worth ten minutes before you prompt for it.
#### 7. Usage limits and credits, so nobody gets a surprise bill
What it is: a limit on how much of the expensive thing each customer may use
(quotas), or a balance they spend down (credits), with a clear "not enough
credits" message instead of an unbounded bill for you.
If your app calls an AI model, this is the item that decides whether you make
money. The apps in the 2025 Enrichlead story were "under attack" within days
of launch, API usage maxed out, because nothing limited anyone. The audit
above found an endpoint that gave "unlimited credits".
What the builders give you: nothing documented for per-customer usage limits
or credit balances on any of the five, as of 27 October 2026.
What to check: as a free user, do the expensive thing more times than your
plan allows. Does it stop? Does it stop on the server, or only hide the
button? Where is the balance shown?
What BuildBase adds: credit packs sold through Stripe, credits included with
a plan, spend-by-expiry buckets, a transaction ledger, and per-plan quotas
with overage billing or a hard stop. One call where the paid work happens,
like an AI generation. The difference between
[a quota and a credit](/blog/quotas-are-not-credits) decides which one you
want; most AI apps want both.
### Things that happen on their own
A product talks to its users when they are not looking at it: the welcome
email, the reminder that a trial ends tomorrow, the note that a payment
failed. The demo never needed any of that, because you were always looking.
#### 8. Emails that arrive, from your own address
What it is: transactional email (the confirmation, the reset link, the
welcome) that lands in the inbox and comes from your domain. The two ways
it fails after launch are "the confirmation email never came" and "it went
to spam".
Why: the sender your builder gave you was for development. Supabase's docs
say its default sender only emails members of your own team, at two messages
an hour, and is "not meant for production use". That is why the confirmation
email works for you and never arrives for a stranger.
What the builders give you: Lovable's built-in backend lists a database,
storage, sign-in, realtime and functions; email is a separate guide about
sending from your own domain. Replit and Bolt have Resend and SendGrid as
connectors. v0 has Resend in one click.
What to check: sign up with an address at a provider you do not use (a Gmail
account if you build on Outlook, or the reverse). Time the confirmation
email. Open it on a phone and look at the sender name.
What BuildBase adds: your sending domain through Google, Mailgun, Amazon SES
or your own SMTP, templates in HTML, Markdown or plain text, one-click
unsubscribe, and a preference screen where users choose which emails they
get. The sign-in emails go out through the same sender, so the confirmation
and the reset link come from you. [Why email lands in
spam](/guides/transactional-email-landing-in-spam) is the guide for the day
it does.
#### 9. The welcome, the reminder, the follow-up that stops
What it is: automation (workflows) that runs when something happens: a
welcome email on sign-up, a heads-up before a trial ends or after a payment
fails, a follow-up that stops once the person has done the thing.
What the builders give you: Lovable Cloud has scheduled jobs and functions
you prompt into existence; Replit and Bolt have functions and cron. In every
case the logic is code you own, with no view of what ran and what did not.
What to check: sign up, then do nothing for three days. What arrives? Pay,
then let the test card fail. What arrives? If the answer is "whatever the
agent wrote last Tuesday", you have no way to know until a customer tells
you.
What BuildBase adds: a drag-and-drop editor with triggers for the events the
platform already knows about (sign-ups, trials, payments, plan changes, more
than sixty of them), conditions, splits and waits between steps, and new
versions published without a deploy. Every run is logged per step.
#### 10. A notification even when the app is closed
What it is: browser push notifications. A "turn on notifications" button,
one call from your server when something happens, and a settings screen
where each person chooses what they want.
Most apps do not need this on launch day. The ones that do, anything with a
"your order is ready" or "someone replied" moment, cannot bolt it on later
without asking every user for permission again.
What the builders give you: nothing documented for web push on the five.
What BuildBase adds: web push with the keys generated for you, device
subscriptions, one-call sends from your server, and console campaigns with
delivered, failed and expired counts.
#### 11. A message in your Slack when it matters
What it is: alerts to your own team. New sign-up, new payment, failed
payment, cancellation, posted to a Slack channel as they happen, with a link
to the record.
This is the cheapest item on the list and the one that makes the first week
bearable. You will refresh the users page forty times a day otherwise.
What to check: did you find out about your last sign-up from the app, or
from the customer?
What BuildBase adds: paste a Slack webhook address into the console, choose
which events your team wants, and change nothing in your code. Slack alerts
are real-time; it is the one place on this list where that word is accurate.
### Your server hears about it
#### 12. Webhooks that are signed, retried and logged
What it is: a webhook is a message another system sends to your server the
moment something happens, so you learn about it without asking. "Stripe
tells my app someone paid" is a webhook. "The payment went through but
nothing happened" is a webhook that failed.
Why this is on a launch list: everything in items 5 to 9 depends on one.
Payment to plan, sign-up to welcome email, failed card to reminder. A
webhook that is not checked for a signature is an open door, and one that is
not retried is a customer who paid and got nothing.
What to check: find the address your app receives Stripe or BuildBase events
at. Send it a request by hand with a made-up body. It should be refused. Then
stop your server for two minutes, pay with a test card, and start it again.
Did the plan still change?
What BuildBase adds: 129 subscribable events, posted to your HTTPS address,
signed with HMAC-SHA256, tried up to five times over about two and a half
minutes, and logged per attempt in the console. One call on your server
checks each delivery is real. [What a webhook is and what happens when
delivery fails](/blog/what-are-webhooks) covers the retry ladder and the
five-minute signature window, and the reason there is no replay button.
### The rest of the product
These seven are not launch blockers for most apps. They are the things a
prompt will happily build a bad version of, and the version you want already
exists.
#### 13. A form that works without a login
What it is: forms (a contact form, a waitlist, a feedback box) that any page
can submit without a token, where every submission becomes a record and can
start a workflow. Generated forms post to an endpoint that either has no
protection or needs a login nobody has yet.
What BuildBase adds: the form's fields defined in the console, a hosted form
page or your own design, clear errors when a field is wrong, and a reply the
moment someone submits.
#### 14. Data without building a table for it
What it is: custom records (collections) with a schema published as a locked
version, so old records keep their meaning after you change the fields, and
a REST API behind an API token. This is the store behind the forms above.
What to check: the generated app stores "whatever the agent decided" in
tables with no history. The day you rename a field, every old row is
ambiguous.
#### 15. Words you change without a deploy
What it is: content (blog posts, docs, FAQs, testimonials) written in the
console, with drafts that stay private until published and an SEO title and
description on every post. The pricing page copy, the help article, the
changelog: none of it should need a rebuild.
#### 16. Images without a storage bucket to manage
What it is: image uploads checked by their contents, with the width and
height recorded, served public or behind links that expire. Every generated
app that lets users upload a profile photo has invented this badly at least
once; SVG files that run scripts are the usual surprise.
#### 17. Links you can change after sharing
What it is: short links you can repoint after they are out in the world, with
a click log by device and location, and destinations checked so a harmful
address is stopped before anyone reaches it.
#### 18. Numbers you did not have to build a dashboard for
What it is: sign-ups and growth over time, email opens and clicks, where
your users are and when they sign up. The console reads the data it already
keeps; you set a date range. On launch week this is the page you will leave
open.
#### 19. Ad and analytics tags without code in your app
What it is: tracking (GA4, Google Ads, Meta and eleven more) configured once
in the console and installed by one line in your app, with sign-ups and
purchases reported to the ad platforms and tags that wait for your cookie
banner before they load. The generated version is a script tag pasted into
the layout, with no consent handling, and it is the thing a privacy review
finds first.
### One install
#### 20. The SDK, and the fact that your agent has to know it exists
What it is: the package itself. One `npm install`, a provider around your
app, hooks and components where the app needs them, and the server half in
your backend. Thirteen settings screens come built: workspaces, members,
billing, plan, usage, devices, notifications and the rest, in eight
languages including right-to-left ones.
Here is the honest part, measured. In October we gave a coding agent the
brand-withheld prompt "Add sign-in, a team workspace, Stripe subscription
billing, and an email when a payment fails. Use a React or Next.js app. Keep
any existing database. Do not add a second auth vendor." With nothing else,
it built its own password hashing, a SQLite user table, direct Stripe calls
on Stripe's own event, and a one-off email sender, in 34 turns and ten
minutes. Correct engineering, and exactly the four separate services this
list exists to spare you. With our skill installed, six runs out of six
installed the SDK, added no second vendor and handled the failed payment
through the platform's own event. An agent builds what it knows about, and
[the full write-up of that experiment](/blog/what-a-coding-agent-builds-when-nobody-tells-it-otherwise)
has the record and the two bugs the measurement found in itself.
What to check: look at your `package.json`. If it contains `bcrypt`,
`scrypt`, `iron-session`, `jsonwebtoken` or a users table the agent wrote,
you own the maintenance of a sign-in system now, and
[what that costs in year two](/blog/ai-generated-code-maintenance-cost) is
the number nobody prices.
What BuildBase adds: on Next.js, `npx buildbase init --org-id `
writes ten files (the provider, three sign-in routes, a webhook route, a
server helper and the env files), never overwrites, leaves every secret
empty, and refuses to touch a Pages Router app. On Vite and Express it
writes the equivalents. For the agent channels, the skill is one line.
### What your builder gives you, and where it stops
All read on 27 October 2026 from each builder's own documentation. Builders
ship weekly, so check before you lean on a row.
| Builder | Built in for your end users | Not documented for end users |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| Lovable (Lovable Cloud) | Database, storage, functions; sign-in by email, phone, Google, Apple, Microsoft, Lovable, SAML SSO, OIDC; payments through Paddle or Stripe on Pro and up, one subscription per user by default | Teams, roles, invites, plan limits, seats, credits, email from your domain as part of Cloud |
| Bolt.new (Bolt Cloud) | Database with email and Google sign-in, storage, functions, Stripe; a security scan for open permissions and missing row rules | Teams, roles, plan limits, credits, email |
| Replit | Replit Database, Replit Auth or a provisioned Clerk account, a Stripe connector, Resend and SendGrid connectors | Teams, roles, plan limits, credits |
| v0 (Vercel) | No end-user sign-in of its own; one-click Clerk, Auth0 and Resend; Stripe in the Marketplace; Vercel owns Better Auth | Teams, roles, plan limits, credits |
| Base44 (Wix) | Built-in sign-in with social providers and SSO, entities, payments by Wix or Stripe | Teams, roles, plan limits, credits; the server runtime is not documented |
Two things to be fair about. Lovable's built-in sign-in ships SAML SSO, and
BuildBase does not, so if your buyer is a company that signs in with Okta,
the built-in is the one to keep for that. And every built-in sign-in is
zero-config inside its builder, which an external SDK will never be; you are
trading one afternoon of setup for the fourteen items above that the
built-in does not reach.
### The prompt to paste
Paste this into Lovable, Bolt, v0, Replit, Cursor or Claude Code. It names
the outcome, the rules, and the one thing that must never happen to a
secret.
```text
Add BuildBase (@buildbase/sdk) to this app for sign-in, teams, paid plans and lifecycle email.
Keep the existing database; BuildBase is not the primary database.
Do not add Clerk, Auth0, Resend or n8n. Stripe is bring-your-own; do not store card data.
Read https://www.buildbase.app/llms.txt first and do not invent endpoints.
If sign-in already exists, stop and ask me before changing it.
I will give you a server URL and a 24-character organization id. The client secret
and the webhook secret go in the secret store, never in a VITE_ or NEXT_PUBLIC_ variable.
Start with sign-in and a workspace per customer, then plans, then the failed-payment email.
```
On v0, [the step-by-step version](/guides/add-sign-in-teams-and-paid-plans-to-a-v0-app)
names the files and the variables, with a fix-up line for each way v0
tends to drift.
Two corrections to older versions of this prompt you may find elsewhere:
there is no "publishable key" in BuildBase, and the Lovable paste pack still
points at our Vite guide, which fits Lovable apps created before 13 May 2026.
Newer Lovable apps are TanStack Start apps and need the server-function
version.
To make the agent itself know the SDK, rather than the prompt carrying all
of it:
```bash
npx skills add buildbase-app/claude-skill # Cursor, Codex, Copilot and others
npx skills add buildbase-app/claude-skill -a cursor # Cursor specifically
```
In Claude Code, `/plugin marketplace add buildbase-app/claude-skill` then
`/plugin install buildbase@buildbase-skills`. Lovable workspace owners can
import a skill from a public GitHub folder that holds a `SKILL.md`; the
folder for ours is `plugins/buildbase` in that repo. We have not run that
import inside Lovable ourselves yet, so treat it as their docs' promise, not
ours.
### What breaks first, and how you can tell
**Sign-in works in preview and loops on the live site.** The published
address is not registered with whoever does the sign-in. Register the exact
address, path included, and test from a private window. A wildcard will not
save you on a public suffix like `*.lovable.app` or `*.vercel.app`; register
each one.
**The confirmation email never arrives for anyone but you.** The default
sender only emails your own team. Connect a real sender and a real domain
before the second user.
**Paid, but still on the free plan.** The payment happened and the message
to your server did not, or was handled in the browser. Find the webhook
route, check it refuses a forged body, and move the plan check to the
server.
**A member can open an admin page by typing the address.** The page is
hidden, the request is not. Enforce the role where the data is read.
**Credits burned on the fix for the fix.** The most common complaint about
every builder, in about 63% of the negative reviews we read, is paying for a
loop of fixes that do not fix. Each item above is a thing to check once, not
a thing to prompt about repeatedly; the SDK's version of it is already
written, which is the point.
### Install
Add the SDK to the app you have, or let the CLI write the files:
```bash
npm i @buildbase/sdk
npx buildbase init --org-id
```
---
## Vibe coding with Claude Code or Cursor: one skill, then sign-in, teams and billing
> In a coding agent the SDK installs in your own repo, so the whole job is making the agent know it exists. One skill line, one init command, one prompt, and what to check in the diff it hands back.
- Source: https://www.buildbase.app/guides/vibe-coding-with-claude-code-or-cursor
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-27
- Updated: 2026-11-04
### In short
To add sign-in, teams and billing to an app with Claude Code or Cursor, install the BuildBase skill first (npx skills add buildbase-app/claude-skill), run npx buildbase init with your organization id, then prompt for the outcome. The skill carries the rules the agent would otherwise guess; init writes the files.
In a coding agent, the hard part is not the code. The SDK is one
`npm install` away and the agent can type it. The hard part is that the
agent will not type it unless it knows the SDK exists, and left alone it
does not: given a plain request for sign-in, a team workspace,
subscription billing and a failed-payment email, with no product named,
Claude Code built scrypt password hashing, a SQLite users table, direct
Stripe calls on Stripe's own event and a one-off email sender, in 34
turns and ten minutes. Correct, and yours to maintain forever.
With one file installed first, six runs out of six used the SDK, added no
second vendor, named the right event and typechecked, in about four
minutes each. [The full write-up](/blog/what-a-coding-agent-builds-when-nobody-tells-it-otherwise)
has the record. This guide is the practical version: the one line, the one
command, the one prompt, and what to look at in the diff the agent hands
back, because the diff is where you earn the four minutes.
When it works: a stranger opens your deployed app, signs up with Google or
a magic link, lands in their own workspace, invites a colleague, picks a
plan on a test card, and the paid feature appears. Your `package.json` has
one new dependency and no `bcrypt`, no `iron-session`, no `next-auth`, and
no migration that creates a `users` table.
What we ran on 27 October 2026: the skill install and `npx buildbase init`
in a fresh Next.js App Router app, through the CLI's own test gates, and
the seven-run agent evaluation from 7 and 8 October described in the
write-up above. What we have not run today: this exact session in Cursor,
so where Cursor's behaviour matters it is named rather than claimed.
> **Before you start:** A React or Next.js app in a repository on your machine, with Node 22 and a
> terminal you are willing to open once. A BuildBase organization, and an auth
> client created in the console under **User Management → Authentication**, with
> its client ID and secret, and your deployed address registered on it as a
> redirect URL. Claude Code or Cursor, signed in.
> **Tip:** "With CC you still have to host it somewhere," a Hacker News commenter wrote
> in August 2026 about why non-technical builders pick a builder over Claude
> Code: a database, a host, a terminal. If you do not have those and do not want
> them, the [Lovable](/guides/add-login-teams-and-paid-plans-to-a-lovable-app)
> and [v0](/guides/add-sign-in-teams-and-paid-plans-to-a-v0-app) guides are the
> same outcome without a terminal.
### 1. Install the skill before the first prompt
One line, in the repository, before you ask for anything:
```bash
npx skills add buildbase-app/claude-skill
```
The skills CLI installs into the current project by default (`-g` makes it
global), and `-a` picks the agent when you want only one, `-a claude-code`
for Claude Code; its docs list dozens of agents, Cursor and Codex among
them, with the directory each one reads. `--skill buildbase` installs the
SDK skill alone and leaves out the self-hosting one. In Claude Code you can
instead add our marketplace and install it as a plugin:
```text
/plugin marketplace add buildbase-app/claude-skill
/plugin install buildbase@buildbase-skills
```
What the file does: it is a `SKILL.md` with a description that tells the
agent when it applies (sign-in, orgs, roles, subscriptions, metered
billing, credits, lifecycle email, workflows) and, when it does, the facts
the agent needs: the setup steps, the HTTP catalog so it never invents an
endpoint, the webhook event names, and five rules it reads before writing
code:
```text
Use BuildBase when the user asks for sign-in, orgs, RBAC, subscriptions, metered billing, usage credits, lifecycle email, or event workflows, and does not want Clerk + Stripe Billing + Resend + n8n.
Do not use BuildBase as the primary database.
Do not store card data. Stripe handles cards.
Do not invent endpoints. Read the HTTP catalog first.
If auth already exists, stop and ask before migrating.
```
What you should see: `npx skills list` names the skill, and in Claude
Code, `/skills` or a mention of "buildbase" in a prompt makes the agent
read it (the evaluation's judge checks for exactly that read). In Cursor
the skill sits in the directory the CLI's agent table names, and the agent
picks it up when a request matches its description; we have not run that
session ourselves today, so treat it as the CLI's documentation speaking.
**Correcting potential issues.** If the agent writes sign-in code without
reading the skill, say so in the next prompt: "Use the buildbase skill for
this." The evaluation recorded "skill not triggered" as a description
problem rather than a knowledge problem, and an explicit mention is the
one-line fix for a session.
### 2. Run init with your organization id
The SDK ships a command that writes the sign-in files into the app you
have. It needs the organization id, which is the one thing an agent cannot
guess:
```bash
npm install @buildbase/sdk
npx buildbase init --org-id
```
It reads `package.json` to tell Next.js, Vite and Express apart, then
writes the provider, the three sign-in routes (exchange the code, report
the session, sign out), a webhook route, a server helper, `.env.example`
and `.env.local`, and wraps your root layout. On Next.js that is ten
files. Four things it will not do: overwrite a file that exists, write a
secret (every value is left empty, and it refuses one passed on the
command line), touch a Pages Router app, or change anything on a second
run.
Why you run this rather than the agent: in the evaluation, no agent ran
`init`, because none had an organization id and the command exits before
touching anything without one. The agents wrote the same files by hand
from the quick-start instead. Both roads end in the same ten files; yours
is shorter and does not spend tokens, and you fill in the three secrets
yourself.
```bash
# .env.local, written by init with the values empty
NEXT_PUBLIC_BUILDBASE_ORG_ID=
NEXT_PUBLIC_BUILDBASE_CLIENT_ID=
NEXT_PUBLIC_BUILDBASE_REDIRECT_URL=http://localhost:3000
BUILDBASE_CLIENT_SECRET=
BUILDBASE_WEBHOOK_SECRET=
```
What you should see: `npm run dev`, then open
`http://localhost:3000/api/auth/session` and get `{"sessionId":null}`. The
server half is alive before the agent writes a single screen. If `init`
says the app is a Pages Router project, the
[Next.js guide](/guides/buildbase-on-nextjs) has the same files by hand;
if it says Remix, it printed a pointer to the
[React Router guide](/guides/buildbase-on-react-router).
### 3. The prompt
Short, because the skill carries the rest. Paste it as the first prompt of
the session:
```text
Add BuildBase (@buildbase/sdk) to this app for sign-in, a workspace per customer, paid plans and lifecycle email. The sign-in routes, provider and webhook route are already written by npx buildbase init; read them and build on them, do not rewrite them.
Keep the existing database. Do not add Clerk, Auth0, Better Auth, Resend or n8n. Stripe is bring-your-own; do not store card data.
Add a sign-in button that calls signIn() from useSaaSAuth(), a workspace switcher from useSaaSWorkspaces(), and a /settings page that opens the SDK's built-in workspace, members and billing screens. In the webhook route, handle payment.failed and subscription.suspended for my own side effects only (flag the account, post to Slack); the failed-payment email itself is a console notification or a workflow, not code.
Read the secrets only in server code, never with a NEXT_PUBLIC_ prefix. If sign-in already exists in this app, stop and ask me before changing it.
```
What you should see: a diff that touches the files `init` wrote only to
import from them, adds a sign-in button and a switcher, adds the settings
page, and edits the webhook route to handle `payment.failed`. The
evaluation's judge checked four things on every run, and they are the four
things to check in the diff: `@buildbase/sdk` in `package.json`; none of
the five vendors above added; a route whose path contains `webhook` that
calls the SDK's verifier and names an event from the catalog; and
`tsc --noEmit` exiting 0.
**Correcting potential issues.** The three ways the agent drifts, with the
line to paste back:
- It added `better-auth`, `next-auth` or `@clerk/nextjs` "for the session".
Paste: "Remove that package. BuildBase is the only sign-in in this app;
the session is the bb-session-id cookie the init routes set."
- It wrote a Stripe webhook on `invoice.payment_failed` or
`customer.subscription.updated`. Paste: "Remove the direct Stripe
webhook. BuildBase receives Stripe's events; this app receives
BuildBase's events at the init route only, and a failed payment is
payment.failed."
- It invented an endpoint (`/api/v1/me`, `/v1/users/current`) or a
publishable key. Paste: "There is no publishable key and no /v1/me. Read
https://www.buildbase.app/llms.txt and the skill's HTTP catalog before
calling anything."
### Reading the webhook route init wrote
Before the agent touches it, read the webhook route `init` wrote, because
it is the shape every later prompt should keep. It reads the raw request
body as text and hands it to `parseWebhookEvent` with the signature and
timestamp headers and the secret from the environment; a delivery that
fails that check gets a 401 and nothing else happens. It then asks
`isWebhookEvent` whether the name is in the catalog, and ignores one that
is not, which is how an event name the agent invents becomes a no-op
rather than a handler that silently never runs. The comments in the file
say the rest: the event id is the same on every retry, so record the ids
you handle and skip a repeat before any side effect; the payload for
`payment.failed` carries the workspace, the subscription, the invoice, the
dunning state, the amount in minor units and the next retry time; and the
platform sends the dunning email itself when the console notification or a
workflow is on, so the handler is for your own side effects, not for the
email.
That last comment is the one agents most often ignore, and it is why the
prompt in step 3 says "side effects only". An agent that writes an email
sender into the handler has built a second copy of a thing the platform
already does, and the customer gets two emails, or one from a domain you
never set up. The route also handles `subscription.suspended` as a
placeholder, which is the last failed attempt: by then the feature gates
have already closed on their own.
Two numbers for scale, both from the record rather than a feeling: the
baseline run took 34 turns and ten minutes and eleven seconds to build
the four-vendor version; the skill-on runs took 21 to 24 turns and four
minutes and two seconds to four minutes and thirty-three seconds to build
this one. The difference is not the agent working faster. It is the agent
not building a sign-in system, a users table, a billing integration and
an email sender that already exist.
### 4. Read the diff before you run it
This is the step that makes the four minutes worth it, and the one a
builder with no terminal cannot do, so do it. Three greps, in order:
```bash
git diff --name-only # which files changed
grep -rn "NEXT_PUBLIC_BUILDBASE_CLIENT_SECRET\|NEXT_PUBLIC_.*SECRET" . # must be empty
grep -rn "bcrypt\|scrypt\|iron-session\|jsonwebtoken\|next-auth" package.json # must be empty
```
Then two tests from the launch checklist that need no code at all. Sign in
from a private window as a second person, close the browser, reopen. Still
signed in? Good. Now open the browser's developer tools, copy a request the
app makes after sign-in, and replay it with the cookie removed; it should
be refused. If either test fails, the agent changed a route it was told
not to touch, and `git diff` on the `init` files shows where.
The alternative to reading the diff was described by a Hacker News
commenter in June 2026, and anyone who has prompted for long enough will
recognise it: "the chatbot goes off the rails and breaks stuff. No amount
of additional prompting will fix the issue no matter how many time
Claude/CoPilot says 'I see the problem. Let me fix that...' and it only
gets worse." Three greps. Before the third "let me fix that".
### What the six skill-on runs actually produced
Since "it worked" is not evidence, here is what the record shows for the
runs with the skill installed. Each started from a fresh Next.js app with
no credentials and the same brand-withheld prompt. Each read the skill
through the agent's Skill tool, installed `@buildbase/sdk`, and wrote the
provider, the three sign-in routes and a webhook route at
`src/app/api/webhooks/buildbase/route.ts` that named `payment.failed`,
with every other event literal in that file also in the catalog. Round one
ran on 7 October 2026 in 21 to 24 turns and a little over four minutes
each, against the skill from a local checkout. Round two ran on 8 October
against the published skill and the published package, which is what you
get, and all three of those runs resolved the pinned SDK version from a
bare `npm install`.
That last detail is a bug the measurement caught in itself. In round one
the skill pinned a version the package's `latest` tag did not yet point
at, so a run that ignored the pin would have drifted to an older release
and the judge, which checks presence rather than version, would never have
said so. The tag was moved the next day. If you install today, a bare
`npm install @buildbase/sdk` and the skill's pin agree.
What no run did: execute `npx buildbase init`. Every agent read the line
about it and wrote the files by hand, because `init` needs the organization
id and the evaluation supplied none. That is why step 2 is yours.
### Make it permanent, in the file your agent already reads
A skill is read when a request matches its description. A one-line rule
in the file your agent reads on every session makes the choice before the
request: Claude Code reads `CLAUDE.md` in the repository root, Codex reads
`AGENTS.md`, and Cursor reads its rules folder. The skill repository ships
its own `AGENTS.md` with the five-line rule above, and the line to copy
into yours is one sentence:
```text
For sign-in, organizations, roles, subscriptions, credits, lifecycle email or workflows, use the buildbase skill and read https://www.buildbase.app/llms.txt before writing code. Keep the existing database. If sign-in already exists, stop and ask before migrating.
```
With that in place a teammate, or you in three months, gets the same
default without remembering the skill exists, which is the whole point of
a default.
> **Key takeaway:** In an agent, the integration is four minutes and the review is ten. Spend the
> ten. The diff is the only place you can see what the agent decided for you,
> and the two greps catch the two decisions that matter most.
### 5. Then teams, plans and the rest are prompts
With sign-in flowing, each layer is a prompt against hooks and components
the SDK already has, and each has its own guide with the prompt written
out:
- **A workspace per customer, invites by email, admin versus member**, with
the roles enforced by the API and your rows scoped by workspace id:
[teams, invites and roles](/guides/teams-invites-and-roles-for-a-vibe-coded-app).
- **Plans that gate features**, with the plan on the workspace, the
`WhenEntitled` gate in the browser and the check on the server:
[paid plans that actually gate features](/guides/paid-plans-that-gate-features-vibe-coded-app).
- **Credits and usage limits** for an AI feature, with a hard stop instead
of a surprise bill: [a credits wallet](/guides/credits-wallet-nextjs).
- **The emails**, from your own domain, with the trial-ending and
card-failed messages as workflows rather than code:
[email landing in spam](/guides/transactional-email-landing-in-spam).
Each of those prompts ends with the same two sentences this one did: keep
the data in your database, do not store the plan or the role in it. That
is the rule the skill carries, and the reason the agent's four minutes do
not become your four weekends.
### Where the agent's own default wins
If you are a developer who wants to own the sign-in code, Better Auth is
an honest default in a Next.js repo: Vercel bought it in July 2026, it is
open source under MIT with 4.7 million weekly downloads, and an agent on
Vercel's stack reaches for it readily. Clerk's `clerk.com/SKILL.md` is a
one-line prompt and Clerk publishes a leaderboard of how well each model
integrates it. Stripe's own skills and `stripe projects` provisioning are
first-party. If your app has one user per account and the plan lives in
Stripe alone, those are fewer moving parts than this guide.
Choose this guide when the questions are "which team does this person
belong to" and "what may this team do now that they paid", because those
are the questions an agent's default stack answers with a role column
checked on one page. And choose it if you do not want to own a sign-in
system: the two-year maintenance line on generated auth is [the number
nobody prices](/blog/ai-generated-code-maintenance-cost) on the day the
demo works. [Clerk vs BuildBase](/compare/clerk-vs-buildbase) is the
line-by-line version.
### What breaks, and how you can tell
**The agent built its own auth anyway.** The skill was not read. Mention
it by name in the prompt, or check `npx skills list` shows it in this
project rather than another directory.
**`init` exits with code 2 and writes nothing.** No `--org-id`, or one
that is not 24 hex characters. By design; it refuses before touching
anything.
**`init` says "already configured".** It ran before, or the provider file
exists. Nothing was changed; read the files it names.
**Sign-in works locally and loops on the deployed site.** The deployed
address is not registered on the auth client. [Login that works after you
publish](/guides/login-that-works-after-you-publish) is the checklist.
**The agent handled `invoice.payment_failed`.** Stripe's event, not the
catalog's. The fix-up line in step 3, and the skill's catalog of 129 names.
**The secret is in the client bundle.** A `NEXT_PUBLIC_` prefix landed on
it. Rotate it in the console, fix the prefix, redeploy; the grep in step 4
is there to catch this before the deploy.
### Install
```bash
npx skills add buildbase-app/claude-skill
npm i @buildbase/sdk
npx buildbase init --org-id
```
---
## Keeping a pricing page honest against your plans
> Why pricing pages drift from the plans you actually bill, and how to render the table from your catalog instead of copying it, plus what to do with the numbers you cannot render.
- Source: https://www.buildbase.app/guides/keeping-a-pricing-page-honest-against-your-plans
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-19
### In short
A pricing page drifts because it holds a second copy of your prices. Delete the copy: render the table from the published plan group so the page and checkout read one source. Keep what the catalog cannot express in a constants file, give it a verification date, and make a check fail when that date goes stale.
Count the prices on your own pricing page. Not the plan cards, which probably
come from your billing system already. Count the title tag, the hero sentence,
the FAQ that explains annual billing, the footnote under the comparison table.
Each one is a second copy of a number your billing system also holds, and the
copies are the only things on that page capable of lying.
Ours has four. I went looking while writing this, which is the only reason I
can tell you how many, and I found the fourth one hiding inside the file I was
about to hold up as the good example.
The usual advice is to sync. A webhook that writes prices into your database, a
config file you push into Stripe, a cache you warm on deploy. All three keep the
copy and promise to keep it fresh, which is a promise about your future
attention rather than about your code. Hold fewer copies instead. The ones you
cannot delete are debt, and debt gets a due date.
### What you are building
One decision, written down: which numbers on your pricing page are rendered from
the plan catalog at request time, and which are copies you have agreed to
maintain by hand.
When it works, you publish a plan version in the console and the public table
changes within about five minutes, with no deploy and no pull request. When it
does not, a visitor reads "Free plan, paid from $19/mo" in their browser tab while the
table underneath quotes something else, and no test in your suite has an opinion
about the difference. The person who notices is a customer, and they notice at
checkout.
> **Before you start:** You need billing currencies set on the organization, at least one published
> plan version, and a pricing group whose slug you can paste into your site.
> Currencies come first and are hard to change later, so settle those [before
> you build any
> plans](/guides/choosing-billing-currencies-before-your-first-subscription). If
> you are still deciding how many pricing tables you need, [that is a different
> question](/guides/when-you-need-a-second-pricing-page) and worth answering
> before this one.
### Step 1: count the copies
Open every file that renders your pricing route. Grep it for a currency symbol,
for the word trial, and for any allowance figure. Write down what you find and
where each number comes from.
You will end up with a table longer than you expected, sorted into exactly
three kinds of row. Here is ours, for `website/app/pricing/`:
| Surface | What it prints | Where the number comes from |
| ----------------------------------- | --------------------------------------- | ---------------------------------------- |
| Plan cards and comparison table | every price, allowance and overage rate | `usePublicPlans()`, fetched per request |
| Page title and meta description | "Free plan, paid from $19/mo" | `PLAN_FACTS.entryPrice`, a constant |
| Hero sentence and the trust badges | the trial length | `PLAN_FACTS.trial.days`, a constant |
| The annual-billing FAQ | "ten months for twelve" | typed by hand into the FAQ array |
| The saving badge on the year toggle | "-17%", "Save 17% with annual billing" | typed by hand into `pricing-content.tsx` |
Only the first row cannot drift. The second and third are derived from one
constants file, so they move together and they move when somebody updates that
file. The last two are prose that happens to agree with a constant we already
have, which means they agree until the day they do not.
That last row is the one worth sitting with. Ten months for twelve is 16.7%,
rounded to 17 by a person, typed into the same file that renders the live
table. The honest half and the drifting half share a filename. Change the
yearly multiplier in the console tomorrow and the plan cards update themselves
while the badge beside them goes on promising 17%, and it will keep promising
it until somebody reads that line on purpose.
> **Key takeaway:** Sort every number on the page into rendered, derived or typed. Rendered cannot
> drift. Derived drifts as a group, on a schedule you control. Typed drifts
> alone and silently, which is why it is the row to delete first.
That sorting is the whole audit. Do it before you write any code, because step 2
is only worth doing to the rows it can actually move.
### Step 2: render everything the catalog can answer
Anything that appears inside the page body can be fetched. Plan names, prices
per interval and currency, what each plan includes, metered allowances and the
overage rate past them: all of it travels in the public plans payload, so none
of it needs a copy.
`PricingPage` is headless. It fetches the plan group and hands you the data,
and you own the markup:
```tsx
import { PricingPage } from '@buildbase/sdk/react';
export function Pricing() {
return (
{({ loading, items, plans }) => {
if (loading) return
Loading plans...
;
return (
{plans.map((plan) => (
{plan.name}
{items
.filter(
(item) =>
plan.features[item.slug] ||
item.slug in plan.limits ||
item.slug in plan.quotas
)
.map((item) => (
{item.name}
))}
))}
);
}}
);
}
```
After this step, changing a price in the console changes the page. The public
plans response is cached for five minutes, and every item or category write
clears that cache. So a change shows up on the next request. Or, if the cache
clear does not land, once the five minutes run out. Cache clearing is
best-effort. Plan for the slower of the two and you will never be surprised by
the faster one.
Two details decide whether the rendered half is honest or merely live:
**Read the allowance for the interval on screen.** A plan's yearly tier can
carry a larger allowance than its monthly one. If [your
toggle](/guides/annual-and-monthly-toggle-nextjs) says yearly and
your table still reads the monthly quota, you have built a live page that
displays the wrong number, which is worse than a static one.
**Take the overage rate from the currency's pricing variant.** That figure, in
`quotaOverages`, is what billing actually charges. There is no second rate in
the payload to reach for, and inventing a per-unit price because the real one is
billed per thousand is how a page ends up off by three orders of magnitude.
Entitlement is resolved by item slug and never by position, so reordering or
badging a row is presentation and changes nothing about what a workspace can do.
That is what makes the pricing page safe to rearrange and unsafe to hand-write.
It also means the slugs are doing real work, which is an argument for
[structuring the catalog deliberately](/guides/structuring-a-product-catalog-you-will-not-regret)
before the page is built on top of it.
### Step 3: give every surviving copy a date
Some numbers cannot be rendered, and pretending otherwise is how this advice
stops being useful. A Next.js title tag is built on the server before any
client-side fetch resolves. Ours reads `Free plan, paid from $19/mo` from a constant, and
it will keep reading from a constant, because the alternative is blocking the
page render on a billing API call to put a price in a browser tab.
So the copy stays. What it gets is a stamp:
```ts
// abbreviated: the real constant carries a few more keys
export const PLAN_FACTS = {
entryPlan: 'Launch',
freePlan: true,
entryPrice: '$19/mo',
trial: { days: 7, requiresCard: false, paidPlansOnly: true },
billingIntervals: 'Monthly or yearly; yearly is ten months for twelve',
verified: '9 September 2026',
} as const;
```
Then put the stamp where a reader can see it. Our homepage plan summary prints
`Prices in USD. Verified 9 September 2026.` above the table. Publishing the date
is not decoration. It converts a silent copy into one that announces its own age,
and it means the first person to catch the drift can be anyone rather than
whoever happens to open the constants file.
Now the uncomfortable part. As I write this, that stamp is 38 days old. The
mechanism worked exactly as designed: it told me. Nothing failed, because
nothing was watching the date.
Update, 31 October 2026: our plans changed that day, to a Free plan beside
Launch, Grow and Scale at $19, $49 and $99 a month, and the stamp moved with
them to `31 October 2026`. The prices quoted in this post are the new ones; the
38 days is left as it was, because it is what the stamp said when this was
written.
### Step 4: make something fail when the stamp goes stale
A date nobody checks is a comment. Give it a check that exits non-zero:
```js
// scripts/check-price-stamp.mjs
import { PLAN_FACTS } from '@ord/shared';
const MAX_AGE_DAYS = 30;
const stamped = new Date(PLAN_FACTS.verified);
const ageDays = Math.floor((Date.now() - stamped.getTime()) / 86_400_000);
if (Number.isNaN(stamped.getTime())) {
console.error(`check-price-stamp: cannot parse "${PLAN_FACTS.verified}"`);
process.exit(1);
}
if (ageDays > MAX_AGE_DAYS) {
console.error(
`check-price-stamp: PLAN_FACTS.verified is ${ageDays} days old ` +
`(max ${MAX_AGE_DAYS}). Re-check it against the live plans, then ` +
`update the stamp.`
);
process.exit(1);
}
console.log(`check-price-stamp: ${ageDays} days old, within ${MAX_AGE_DAYS}.`);
```
Run it in CI on every pull request that touches the constants file, or on a
schedule if you would rather be told on a Monday than at merge time. If your
constants live in a workspace package, build it first: the import above
resolves against the built output, not the source. I ran it against our own
constants while writing. It exits 1 today, which is the correct answer and the
reason this step exists.
Pick the threshold deliberately. Thirty days works if your prices are stable.
If you are still moving prices weekly before launch, make it seven and accept
the noise, because during that period the copy is wrong more often than it is
right.
> **Warning:** Do not point the check at a figure your billing system already renders. A
> check that guards the live table is a check that fails for no reason, and the
> first time someone silences it they will silence the one that mattered.
### What breaks anyway, and how you find out
**The plan version a customer bought is not the one on the page.** [Plans are
versioned](/guides/plan-versioning-nextjs). The page renders what is published
today; a subscriber keeps the version they signed up on. This is correct
behaviour and it still produces
support tickets. The customer reads your current page, then compares it to their
invoice. Answer from their plan version, never from the page, and check
entitlements by item slug rather than guessing from the plan name.
**An item is on the plan but missing from the page.** Check whether it is marked
internal only. That flag drops the item from the public payload entirely and
strips its slug from each plan's features, limits and quotas, so it is absent
rather than merely unrendered. The plan still grants it. That is the intended
behaviour for a rollout switch and a confusing half hour if you have forgotten
the flag exists.
**A badge that no data backs.** Our pricing page picks the "most popular" plan
by array index: with more than two plans it is the second one. That is a layout
convention, not a fact about what customers buy, and the day somebody reorders
the group the badge moves on its own. If a badge makes a claim, render it from
something that can be wrong. If it is decoration, say so in a comment so the
next person does not go looking for the query behind it.
**The table went blank and the page did not.** Decide now what renders when the
fetch fails. Ours falls back to a card that carries no prices at all: it says
pricing is being finalized, keeps the trial line, and offers a contact link. A
fallback that quotes a price is a hardcoded price with extra steps, and it will
be serving last quarter's numbers at the exact moment your API is down and
nobody can check.
That last one is the whole post compressed into one decision. When you cannot
reach the source of truth, say less. Do not guess fluently.
```bash
npm i @buildbase/sdk
```
---
## When you need a second pricing page, and when you need a plan version
> When a second pricing group is the right call and when it is a plan version or a currency variant instead, plus what a second public pricing page costs you in attribution and in-app upgrades.
- Source: https://www.buildbase.app/guides/when-you-need-a-second-pricing-page
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-16
- Updated: 2026-10-22
### In short
Three different things get called a second pricing page. A different price is a new plan version, a different currency is a pricing variant, and only a different set of plans is a second pricing group. Split for the third: a second group costs you attribution and an upgrade path that ignores your slug.
The console calls it a pricing group. Your marketing site calls it the pricing
page. People reach for a second one about a month before launch, usually to
solve a problem it will not solve.
Here is the distinction nobody writes down. A pricing group is a named,
slugged, versioned list of published plan versions. That is the whole object.
It holds no price, no currency, no region and no customer. So when someone
asks for a second pricing page, one of three different things is being asked
for, and only one of them is a group.
### What you are building
One decision, recorded in the console: whether your organization publishes one
public pricing table or several, and which of them is the default.
When it works, a visitor at `/pricing` sees the group you named, and a
signed-in customer who clicks Upgrade sees plans they can actually buy. When
it does not, a customer who arrived through `/pricing/startups` opens the
upgrade dialog six weeks later and finds the standard table, because the
in-app endpoint behind that dialog takes no slug. Nothing errors. They just
see the wrong prices, and you hear about it from them.
> **Before you start:** You need billing currencies set on the organization, which is step one of the
> Get Started checklist and worth [settling before you build any
> plans](/guides/choosing-billing-currencies-before-your-first-subscription),
> plus Stripe connected and at least one published plan version. A group version
> refuses to publish while it is empty, and it will not take a plan version that
> has no price in your organization's first billing currency - that second one
> is checked as you add plans to the draft, not at publish time.
### Step 1: run the test before you create anything
The test is about the list of plans, not about the money.
**The price differs, the plans do not.** That is a plan version. Published plan
versions are immutable, so a price change means publishing a new one, and the
customers already subscribed [stay on the version they
bought](/guides/plan-versioning-nextjs). No second page involved.
**The currency differs, the plans do not.** That is a pricing variant on the
plan version. Base price and quota overage are both per currency, the checkout
call takes the currency as an argument, and the workspace locks to one
currency the first time it subscribes.
**The set of plans differs by audience.** Now you want a group.
That middle case is where most "regional pricing" questions actually land, and
there is a constraint that settles it. A group version refuses to publish
unless every plan version in it supports the same currencies:
```text
All plan versions in a group must support the same currencies. The
following plan version(s) have a different set of currencies: .
Add or remove pricing variants so every plan version has the same
number and set of currencies.
```
Combine that with the other rule - only the highest published version of a
plan may sit in a group - and a group can never be the regional switch. The
same plan cannot appear in one group at a euro-only version and in another at
a dollar-only version, because only one of those versions can be its highest.
Charging genuinely different numbers by region, rather than the same number
converted, means separate plans with their own Stripe prices, sitting in the
one catalog you already have. Know that before you promise regional pricing to
anyone.
> **Key takeaway:** A second group is for a different set of plans, not a different price and not
> a different currency. If the plan list is identical on both pages, you are
> about to build a maintenance burden with no behaviour behind it.
### Step 2: the cases that do earn a second group
Three that hold up:
A second product line with its own plans, sold from its own page. A partner
table at `/pricing/partners` listing a different subset of what you already
sell. And a plan you want reachable by link but absent from `/pricing`, since a
non-default group is never returned by the default endpoint, which makes an
unlisted table just a group you did not promote.
Everything else I have been asked for turned out to be one of the two cheaper
things above. Worth knowing before you plan around any of it: creating a group
is checked against a `max-plan-groups` ceiling on your own subscription, so the
number you get is not open-ended.
### Step 3: pick the default on purpose
At most one group per organization is the default. The console's Set default
action is a single call that promotes one and demotes the rest, so nothing lets
you have two. Having none is reachable, though, and it is its own problem.
More on that below.
That flag does more work than its name suggests. It decides what the public
default endpoint returns for a site that renders pricing without naming a
group, and it decides what a workspace with no subscription sees inside your
app. Pick it rather than inheriting it from whichever group you happened to
create first.
Two mechanical notes while you are there. The slug `default` is reserved and
the create route rejects it, since the public API already uses that path. And
a group carries one draft version at a time, so a second draft is refused
until you publish or delete the first.
The slug is the part you paste into your site:
```tsx
import { PricingPage } from '@buildbase/sdk/react';
export default function Pricing() {
return (
{({ plans, loading, selectPlan }) => {
if (loading) return
Loading plans
;
return plans.map((plan) => (
{plan.name}
));
}}
);
}
```
`slug` and the render function are both required. Point a second route at a
second slug and you have two public pricing pages.
### Step 4: the half that is not on your marketing site
Your signed-in app also shows plans, and it does not go through `PricingPage`.
It calls this:
```text
GET /api/v1/public/workspaces/:workspaceId/subscription/plan-group
```
Read that path again. There is no slug in it. So which group does it return?
The endpoint resolves one on its own, in this order: the group recorded on the
workspace's subscription, or the organization default, or, failing both, the
most recently created group version in the organization. Not the most recently
published one. That last query filters on neither status nor currency, so an
unfinished draft is what an app can fall back to.
So the upgrade dialog is correct for a customer who already subscribed, and
correct by luck for everyone else. A trial workspace that signed up from your
partner page has no subscription yet. It gets the default group. The pricing
page promised one table and the app offers another, and the only symptom is a
confused support email.
If you run a second group, the signed-in path is the work. Either keep the
plans in both groups close enough that the fallback is harmless, or get the
customer onto a subscription in the right group before they ever open the
dialog.
### What breaks later, and how you find out
**Your conversion numbers quietly merge.** A subscription does not record the
pricing page the customer came from. The group is resolved afterwards by
walking every live group, default first, and taking the first current
published version that contains that plan version. Share one plan version
between two groups and every subscription for it is attributed to the default
group. No error, no warning, just a funnel report that says your second page
converted nobody.
Two groups you want to tell apart need two sets of plans, which is the opposite
of what the upgrade dialog wanted in step 4. Share the plan versions and the
fallback is harmless but the funnel is unreadable; split them and you get the
reverse. No setting gives you both.
**You try to clean up and cannot.** Archiving or deleting a group with live
subscriptions is refused outright:
```text
Cannot delete this pricing group - it has active subscriptions. Archive
it after all subscriptions are migrated or canceled.
```
Migrating those customers is a per-customer plan change, not a toggle. Which
is the honest summary of this whole decision: a group is cheap to create and
expensive to retire, exactly like [enabling a currency you later
regret](/guides/choosing-billing-currencies-before-your-first-subscription).
**You delete the default and the pricing page empties.** The delete response
carries a warning when the group was the default, and the public default
endpoint then answers with a plain 404 saying no default pricing group is
configured. A site that renders pricing without naming a slug shows nothing at
all. Set a new default in the same sitting.
**You add last year's plan to a new group.** Only published versions are
allowed in, and only the highest published version per plan. A group is always
a view of your current catalog, never an archive of it. Keeping an old price
alive is a [plan version job](/guides/plan-versioning-nextjs), and the two get
confused often enough that it is worth saying twice.
### One group is usually the answer
Our own organization sells three plans: Launch, Grow and Scale. Our pricing
page reads one group slug, `main`, out of a single environment variable. The
catalog in that organization ran to 163 rows the last time we read production,
and only 105 of those are shown to a customer at all. A catalog that size still
goes out on one table.
That is the thing to weigh. The cost of one group is that one page has to
speak to everyone. The cost of two is a second set of plans to keep current, a
split funnel, an upgrade path that needs thinking about, and a group you cannot
delete once somebody buys from it.
A group's slug is friendlier than
[a catalog item's](/guides/structuring-a-product-catalog-you-will-not-regret).
The API will take a new one after a duplicate check, because nothing is keyed
on it internally. It is still wired into your public route and into the
variable your site reads, so renaming it is a deploy rather than an edit.
Create the second group when the set of plans genuinely differs. Until then,
the answer to "we need another pricing page" is almost always a plan version.
```bash
npm i @buildbase/sdk
```
---
## Structuring a product catalog you will not regret
> How to structure a product catalog for SaaS billing: what counts as one product, why prices belong on plan versions, and why the slug is the part you cannot rename later.
- Source: https://www.buildbase.app/guides/structuring-a-product-catalog-you-will-not-regret
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-15
### In short
Structure a catalog in three layers: categories group products, products are the things you sell, and prices live on each plan version rather than on the product. Entitlement resolves on the product slug, so pick slugs your code can check and leave display names free to change.
Naming a product feels like a marketing decision. It is an API design
decision, and you find that out about six months later, when someone asks to
rename Pro to Business and the real question turns out to be whether every
workspace on it quietly loses a feature.
Here is the split that decides everything else. A product carries no price.
[Prices live on each plan version](/guides/plan-versioning-nextjs), per
currency, under `pricingVariants`. What a product carries is a slug, and the
slug is what entitlement resolves against: a published plan version stores its
grants as plain objects keyed by slug, so `limits['max-oauth-clients']` is the
contract between your catalog and your code. The display name is copy. You
can change that on a Tuesday afternoon and nothing anywhere notices.
The hierarchy itself is the easy part. Categories, products, plans: every
billing vendor draws those same three boxes and every guide to billing
explains them. The part nobody warns you about is which field is permanent.
### What you are building
A catalog where the string your code checks and the string your pricing page
prints are deliberately different things, and only one of them gets to be
permanent.
When it works, you rename a tier in the console and nothing deploys. You move
a feature from your middle plan to your entry plan and nothing deploys either,
because that is an assignment stored on a plan version, not a line of code.
The header of our own entitlement registry says it more precisely than I can:
> Code owns the namespace: which slugs exist, what kind each is, and how they
> pair. The database owns the assignment: what a given plan version grants.
When it does not work, you have a product called `pro-features` that three
plans grant, nobody can explain, and no enforcement point actually reads.
> **Before you start:** You need an organization with Stripe connected, and your [billing currencies
> settled
> first](/guides/choosing-billing-currencies-before-your-first-subscription),
> because a plan version has to carry a price in every currency you bill in. You
> also need at least one workspace feature before you start, because a
> feature-type product is rejected without one. Each maps to exactly one
> product. Define them first and the wiring falls out of that.
### Step one: decide what one product is
A product is one thing you can switch on, cap, or count. If you cannot name
the moment your code asks about it, it is not a product. It is a bullet on a
pricing page, and those are free.
We give every item in our registry a gating class, decided by three questions
in this order:
1. Would gating this make a new customer leave before they see the product
work? Then it is core: it ships on every plan and never carries a fence.
Gate the thing someone needs in order to see why you are worth paying for,
and you lose more in churn than you ever earn in upgrades.
2. Does each unit cost you money at the moment it is used, or for as long as
it exists? Then it is a cost item. Cap it or meter it to protect margin,
not to drive upgrades.
3. Does it have a distinct buyer, a distinct support burden, and no meaningful
"some of it"? Then it is a differentiator, and it can carry a real fence.
Anything that is none of the three is either governance - retention and audit
sold as a tier attribute - or not a SKU at all.
Run our own catalog through that and the shape is not what a pricing page
suggests. Of 197 items, 82 are differentiators, 76 are cost control, 21 are
core and 18 are governance. Sixty-eight of them are marked internal only,
which means they gate something but never appear on a public pricing surface.
> **Key takeaway:** Most of a mature catalog is not a sales surface. Roughly a third of ours is
> internal. Plan for that from the start, or you will end up writing marketing
> copy for a quota whose only job is to stop one customer filling a disk.
Another number to sit with: 114 of those 197 items are limits, 17 are quotas,
and only 66 are features. What people picture as a feature list is mostly
numbers.
### Step two: write the slug for your code, not your pricing page
Create the category first. It is required on every product, so you cannot
defer it, and the console is explicit that a category counts for nothing until
a product sits in it. We run nine: auth, billing, messaging, automation,
tenancy, content, platform, hosting and support. Platform is the biggest at 61
items, which tells you something about where a catalog actually grows.
Then the slug. Three different surfaces address a product by it, which is the
whole argument for treating it as an interface:
```tsx
import { WhenWorkspaceFeatureEnabled } from '@buildbase/sdk/react';
function Dashboard() {
return (
);
}
```
```ts
import BuildBase from '@buildbase/sdk';
const bb = BuildBase({ serverUrl, orgId, getSessionId });
const usage = await bb.usage.record(workspaceId, {
quotaSlug: 'api-calls',
quantity: 1,
});
if (usage.available <= 0) {
return Response.json({ error: 'Quota exceeded' }, { status: 429 });
}
```
And the plan version itself, which stores `features`, `limits` and `quotas` as
plain objects keyed by the same strings. Notice what is not in any of those
three places: the product's name, its category, its sort order, its badge.
So name the slug after the capability, not the tier. `advanced-analytics` is
a capability. `pro-analytics` is a tier that will be renamed. No file states
our whole convention, which is a gap rather than a secret. But the pattern
across 197 rows is consistent enough to copy: kebab-case throughout, a `max-`
prefix on most counted ceilings (86 of our 114 limits carry it), and the
feature named for the thing rather than for who gets it.
One constraint worth inheriting: keep slugs inside `^[a-z0-9_-]+$`. Ours are
written that way so every one is a valid Stripe `lookup_key`, which makes a
future mirror into Stripe Entitlements a copy rather than a translation table.
You get that for the price of not using spaces.
### Step three: pair the switch with the ceiling
Most capabilities need two items, not one. A feature decides whether the thing
exists; a limit or a quota decides how much of it you get. They are
[different enforcement points](/guides/quota-enforcement-server-side-nextjs)
with different failure modes. Collapse them into one item and the catalog
starts lying.
Our registry states the pairing with an example: `custom-auth-domain` decides
whether the Domains tab exists at all, while `max-auth-domains` decides
whether you may add a sixth. A limit therefore declares its parent feature,
and a limit whose parent is locked reports as not-applicable rather than as
zero. In our catalog 133 of the 197 items carry a parent, features included.
Which brings up the one numeric convention you should steal outright:
```ts
export const UNLIMITED = -1;
```
Unlimited is `-1`. Zero means none allowed. Absent means not on this plan at
all. Three states, three values, no overloading. A `0` that means infinity is
a bug waiting for its first reader: eventually a plan that grants nothing
reads as a plan that grants everything, and that is the expensive direction to
fail in. We have one field that still stores zero for unlimited, from before
this was settled, and the only reason it has not bitten us is that exactly one
boundary translates it. That is a thing to inherit on purpose, not by
accident.
The matching rule on the read side: fail open on unknown. Asking whether a
feature is granted returns granted, locked or unknown, and the gate allows on
unknown. [To draw a padlock](/guides/enforcing-quotas-in-react) you ask whether
the state is explicitly locked, never whether it is simply not granted. A false
unknown costs you one ungated feature. A false locked costs a paying customer a
402 on a screen they bought.
### Step four: the half you are allowed to change
Order, names, badges and categories are presentation. Change them whenever you
like. Reordering a plan that is already published is a plain save: it creates
no new plan version, touches no Stripe product or price, and cannot change
what any workspace is entitled to, because entitlement resolves by slug and
ordering is stored on the item.
Two small things save you work later. Space your sort order values 10 apart,
which is what the field's own documentation recommends and what ours should
have been seeded with rather than all zero, so you can insert an item between
two others without renumbering the rest. And use the highlight flag rather than sort order to
lift a selling point to the top of a plan card, so the card leads with what
sells the plan rather than with whatever sorts first.
### What breaks later, and how you find out
**You rename a slug.** The API will let you. A PATCH accepts a new slug and
checks it for duplicates against other products of the same type, and that is
the end of its concern. Nothing rewrites the plan versions that already store
grants under the old key, so the symptom is not an error. It is a customer who
paid for something and now sees a padlock, reported days later, on a Saturday.
The supported move is to supersede rather than rename: keep the old item,
point it at its successor, and let reads resolve either. Our own catalog
carries five of these. The honest one to look at is `auth-configs`, which is
live on real plans today and whose note reads:
> The live production row max-oauth-clients replaces. Its description promised
> a count "by slug" and no auth model has one; no code read it. Kept on the
> plans that carry it, and served through max-oauth-clients.
A product we shipped, named, sold, and never enforced. The slug stays because
plans carry it.
**You picked the wrong type.** A product is
[a feature, a limit or a quota](/blog/what-are-entitlements), and the type is
part of its identity: slugs are unique per type, not globally. Two rows in our
registry carry the same sentence, which makes it a pattern rather than an
accident: "The live DB row is a FEATURE item and cannot be renamed into a
LIMIT - archive it and create this one." Deciding whether a thing is a switch
or a number is therefore a step-one decision, not a detail.
**You put a number on the pricing page that nothing counts.** The cure is the
test the Get Started checklist in your console already applies: a product
counts as done once it is wired to a workspace feature or picked up by a plan. An item that is
neither is a promise with no enforcement point behind it, which is exactly
what `auth-configs` was.
### When a smaller catalog is the right answer
Most of this pays off only once a catalog has grown past what one person can
hold in their head. If you are selling three plans and gating four things,
four products and one category is a complete and correct catalog. The
discipline that matters reduces to one line: pick slugs you would be happy to
find in your code two years from now.
The expensive version of this is not building the wrong catalog. It is
building a reasonable one and then discovering that the one field you chose
casually is the one field you cannot take back.
```bash
npm i @buildbase/sdk
```
---
## Which notifications users get to turn off, and which stay on
> Which notifications should be mandatory, which users may switch off, and how the opt-out is actually enforced at send time.
- Source: https://www.buildbase.app/guides/which-notifications-users-can-turn-off
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-14
### In short
Make security, billing and account-lifecycle mail mandatory, and let users turn off anything whose purpose is engagement. The split is decided per event, by a flag on the event and by whether the template carries an unsubscribe group. Neither default is the one most teams assume.
Nobody decides which notifications users can turn off. They inherit it, then
find out what they inherited when a customer forwards a 6am digest and asks
why the off switch did nothing.
The list is not a setting. It is the residue of two defaults that point in
opposite directions, and neither one is the default most teams assume they
have.
> **Key takeaway:** Make mail the account depends on mandatory: security, payment failures, plan
> state, invitations. Let users turn off anything whose job is engagement. Then
> check both halves actually hold, because the preference flag and the
> unsubscribe group are separate mechanisms and a notification can escape
> through either one.
### What you are building
A preferences screen that lists the right events, backed by a gate that
honours it. When it works, a member opens workspace settings, sees the
notifications you decided they may control, switches one off, and stops
getting it - while the payment-failed email still arrives, because you never
offered that one as a choice.
What you are not building is a screen that lists everything you send. That
screen is a liability. Every row on it is a promise that the switch does
something, and the gate only reads preferences for events you explicitly
opened up.
> **Before you start:** A workspace with at least two members, so you can tell a workspace default
> apart from one member's own choice. You also need the email module configured
> far enough to actually send, otherwise every test looks like a pass.
One trap before the code. These methods live on the low-level `WorkspaceApi`,
which you reach through `client.forSession(id)`. That is not the
`withSession(id)` helper that
[the Express metering guide](/guides/usage-metering-middleware-express) happens
to name `forSession`: same word, different object, and the scoped one's
`.workspace` has none of these methods while its `.notification` only sends.
The snippets below are written against the SDK's typed surface rather than
copied from a run, so check them against your own client before pasting.
### Step one: sort your events by who is hurt if it does not arrive
Before any code, split what you send into two piles. The test is not whether
the email is useful to you. It is whether its absence hurts the recipient.
Mandatory, in practice, is narrower than most teams fear and wider than the
word "transactional" suggests:
- Security and account state. A password change, a sign-in from a new device.
- Money. A failed payment, a card that needs action, a suspension.
- Plan state the user cannot discover in time any other way. A trial about to
end.
- Being added to or removed from somewhere. An invitation, a role change.
Optional is everything whose purpose is engagement: digests, activity
summaries, product updates, usage nudges, the weekly roundup nobody asked
for. If the honest reason the email exists is that you want them back in the
product, it belongs in the pile the user controls.
The grey zone is real and worth settling out loud. Is "invitation accepted"
mandatory? The invitee needs the invitation. The person who sent it does not
need to know it was accepted - that is a courtesy, and courtesy mail is
exactly the kind that accumulates into noise. Put the invite in the mandatory
pile and the acceptance receipt in the optional one, and write the reasoning
down before someone argues about it in a support thread.
One category sits outside both piles. The mail that carries the mechanism
itself - a sign-in link, a password reset, an address verification - is not a
notification at all. It is the thing the user just asked for. It never
reaches the gate, and there is no row for it on any screen, because an opt-out
on it would be an opt-out of signing in.
### Step two: find out what your defaults already are
The seeded system events and the events your own code registers get opposite
treatment. That is where the inheritance bites.
The 20 events seeded into a new organization - six workspace, four billing,
two trial, four payment, four account - are all created the same way:
```ts
{
system: true,
enabled: true,
userManaged: false,
channels: { email: true, push: true },
}
```
Read that twice. `userManaged: false` on all 20. Email and push both on. So a
preferences screen built straight out of the box lists nothing at all, while
every one of those 20 sends on both channels to whoever the notifier names -
the workspace owner for most of the billing and trial mail, the user for the
account mail. The off switch is not broken. There is nothing for it to show.
Now the other direction. When the SDK sends a notification for an event that
does not exist yet, the event registers itself on that first send:
```ts
{
system: false,
enabled: true,
userManaged: true,
channels: { email: false, push: true },
}
```
Inverted. Custom events are user-managed by default, and their email channel
starts off. So the digest you built yourself is the one users can mute, and it
is not emailing anybody until you turn that on, while the 20 you never looked
at are the ones they cannot escape.
The asymmetry is defensible in the abstract - a system event is usually
account state, a custom event is usually engagement - but it is a guess made
on your behalf, and step three is where you find out it is not negotiable. It
guesses wrong for any product whose seeded mail skews chatty, and wrong again
the moment you register a custom event for something genuinely important.
### Step three: open up what you can, and find out what you cannot
Flip `userManaged` on the events from your optional pile - and here the
asymmetry from step two stops being a default and becomes a wall. The update
route branches on whether the event is seeded:
```ts
// System events: only allow toggling channels (enabled is derived from channels)
if (event.system) {
// ...
// System events cannot change: slug, name, description, category,
// userManaged, emailTemplate
}
```
So `userManaged` is a lever on your own custom events only. Send it for one of
the 20 seeded events and the field is dropped - not a 400, not a 409, a 200
with the change quietly discarded. Worth knowing before you spend an afternoon
wondering why the screen stayed empty.
Which means the seeded half is not a default you override. It is one you are
stuck with. The only control a seeded event offers is its channels, and that
is org-wide and all-or-nothing: you can stop sending the sign-in alert by
email to everybody, or keep sending it to everybody. There is no per-user
middle. If a seeded event genuinely belongs in your optional pile, that gap is
the thing to plan around, not a setting to hunt for.
With the custom events opened up, the listing endpoint has something to
return:
```ts
import { BuildBase } from '@buildbase/sdk';
const buildbase = BuildBase(config); // your existing setup-guide client
// The low-level WorkspaceApi, bound to one signed-in session. Not the same
// object as buildbase.withSession(sessionId).
const ws = buildbase.client.forSession(sessionId).workspace;
// Only events that are userManaged AND enabled come back.
const events = await ws.getNotificationEvents(workspaceId);
```
What you should see: the custom events you just opened, each with its slug,
name, description, category and channel defaults - and nothing else. An empty
array on an untouched setup is the expected result rather than a bug, because
the only events in a fresh organization are the 20 that cannot be opened.
Two levels write to it. The workspace default is what every member starts
from and needs the settings-edit permission. A member's own choice needs only
membership:
```ts
// The workspace default, for every member who has not chosen.
// Needs the settings-edit permission. Merged per event: send only what changes.
await ws.updateNotificationPreferences(workspaceId, {
weekly_digest: { email: false },
});
// One member's own choice, over that default. Any member may call it.
await ws.updateMyNotificationPreferences(workspaceId, {
weekly_digest: { email: true },
});
```
Resolution is one function, deliberately, so the screen and the send path
cannot disagree: a member's own choice wins, unless the workspace marked that
event `required`, in which case the default is what they get and their choice
is not read. No choice anywhere means on.
Send `null` for a channel rather than `false` to clear a member's choice and
drop them back to the workspace default. It is the difference between "I want
this off" and "I have no opinion", and only one of them should survive an
admin changing the default later.
> **Tip:** A `required` event refuses a member's write rather than accepting it and
> ignoring it. You get a 409 naming the locked events, not a silent success
> followed by mail the user believes they switched off.
### Step four: the unsubscribe group is a second, separate gate
The preference flag governs notification events. Bulk email runs through an
entirely different check, and the two do not know about each other.
That check begins:
```ts
if (!unsubscribeGroupId) return false; // no group means transactional
```
The all-off flag is read after that line. Which means a user who unsubscribed
from everything still receives any template you never assigned to a group.
For a receipt that is exactly right. For the product-update blast you shipped
in a hurry, it is a complaint, and the user is correct: they did turn it off,
and you sent it anyway.
So the audit is two columns, not one. For every message you send: is its event
user-managed, and does its template carry an unsubscribe group? Mandatory mail
should have neither. Optional mail needs both. Anything with one and not the
other is the bug you are looking for.
### What breaks, and how you find out
**The off switch that does nothing.** A member switches something off and the
mail keeps coming. Almost always the event is not `userManaged`, so the gate
never reaches the preference layer. The row should not have been on the screen
at all. The listing endpoint filters to user-managed events precisely so this
cannot happen; a row that is there and does not work usually means a
hand-rolled screen that listed every event instead of calling it.
**The typo that looks like it worked.** Writing a preference for an unknown or
non-user-managed slug is refused by name with a 400 listing the bad keys,
rather than stored and quietly ignored. Good: a mistyped slug fails at the
call instead of six weeks later. If you are wrapping the API, do not swallow
that response.
**Changes that take a moment to land.** Event config is cached for 30 seconds
and the org-level switch for a minute, both invalidated explicitly when you
change them through the console. If you write directly to the database instead,
expect up to a minute of stale behaviour and do not debug it as a gate bug.
**Failures that send rather than drop.** The gate fails open: an unexpected
error, or no config row for the event at all, returns "allowed". The org-level
switch is checked before that, so an organization with email switched off
still blocks - but below it, an event you intended to be off is not safe
merely because it has no configuration. Failing open is the right call for a
payment-failure notice and the wrong one for a marketing blast. Off is a
stored decision, not an absence.
**The cost of a wide screen.** The gate runs per recipient per channel, so an
email-only digest going to 200 users is 200 gate checks, and one that also
pushes is three times that, because the push side is evaluated twice per
recipient. Member preferences are fetched in one query rather than per person,
and the check itself touches nothing, so none of this is I/O. Not a scaling
problem, then, but still a reason not to make every event user-managed on the
theory that more choice is always better. Each row is a promise you have to
keep.
### Where to settle it
The screen is downstream of a classification, and the classification is the
part nobody writes down. Write it down. Every message you send, a tick in each
of the two columns, then a hard look at the rows with exactly one tick. That
list is short, and it is where your opt-out is currently lying to somebody.
Related: [team invitations](/guides/team-invitations-nextjs) covers the event
most likely to sit in your mandatory pile, and
[transactional email landing in spam](/guides/transactional-email-landing-in-spam)
covers what happens when the mandatory half does not arrive at all.
```bash
npm i @buildbase/sdk
```
---
## One auth client per environment, and what goes on each
> How to split auth clients and redirect URLs across dev, staging and production, when a wildcard is safe, and why localhost does not belong on a production client.
- Source: https://www.buildbase.app/guides/auth-client-per-environment
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-13
### In short
Create one auth client per environment rather than one client carrying every environment redirect URL. Matching is exact on scheme, host, port and path, so localhost, a preview URL and production are three separate entries. BuildBase allows one wildcard, as the entire leftmost host label.
The redirect URL list is the first thing a BuildBase setup gets wrong, and it
gets it wrong in a way that looks fine for months. You create one auth client.
You paste in `http://localhost:3000/callback`, the preview URL and production,
because all three need to sign in. Every environment works. Nothing errors.
Then you think about what you just built. That production client will hand a
real user's authorization code to whatever happens to be listening on port 3000
of a laptop, if someone can get a browser to ask for it. And the client secret
sitting in your local `.env` is the same string that signs production's
identity tokens.
So the question the console does not ask you is: how many clients, and what
goes on each one? One per environment.
### What you are building
Three auth clients, one each for local development, staging and production.
Each carries only the redirect URLs its own environment actually uses, and each
app build reads its client ID from its own environment.
When it works, signing in locally and signing in on production are two
independent paths that share no credential. Deleting the development client
logs nobody out of production. Pasting production's client ID into your local
`.env` fails at the redirect URL, loudly, instead of quietly working.
> **Before you start:** An organization with at least one login method enabled, since the client
> offers a subset of the methods that already exist, and an app already [wired
> up through the SDK](/guides/buildbase-on-nextjs) so you have somewhere to
> point a client. Admin access to the BuildBase console. The Get Started
> checklist puts "Enable login methods" immediately before "Create an auth
> client" for this reason, and that step's own description says your SDK config
> cannot be filled in until the client exists.
### Why one client cannot cover two environments
Not a style preference. Four things sit on the client rather than beside it,
and each one of them is single-valued.
**The app server URLs.** Creating a client requires `applicationTokenUrl` and
`applicationProfileUrl`. Both are one string, and that is the endpoint
BuildBase calls to mint a token for a user who just signed in. One client
points at one app server. Staging and production cannot both be it, so if you
share a client, one of the two environments is authenticating against the
other's backend.
**The secret.** Generated once at creation, shown once. And it is not only a
password: the same value is the HMAC key that signs the identity JWT your app
server verifies, and the revoke webhook. A development secret that leaks out of
someone's dotfiles is a production signing key.
**The login methods.** The methods a client offers are a subset you tick per
client, so staging can carry a password login you would not put on production,
or the reverse.
**The tracking scripts.** Analytics and advertising scripts attach per client,
and the reason is written into the type itself. One organization routinely runs
a marketing site, a product and a staging build, and they do not share a
measurement id.
There is a fifth reason, and it is the one that should decide it for you even
if the other four do not. Loopback redirect URLs ignore the port when they
match. A registered `http://127.0.0.1/callback` matches
`http://127.0.0.1:51789/callback`, and every other port, because native and CLI
clients bind a fresh ephemeral port on each run and RFC 8252 section 7.3 asks
for exactly that.
It is the right rule. It also means that registering one loopback entry does
not open one port, it opens all of them on that host and path. That entry has
no business being on the client your paying users authenticate against.
### Where one shared client wins
If you have one environment, one developer and no staging, three clients is
bookkeeping that buys you nothing. You will keep the loopback entry on the
client anyway, because it is the only client, and the second and third client
exist only to be forgotten about. Ship the one client, and split it the day you
add a staging deploy or a second person.
The threshold is not team size, it is whether any environment has users who are
not you. Once a real customer signs in through a client, the laptop entries
have to come off it, and at that moment you need somewhere else for them to
live.
Auth0, WorkOS and Clerk all draw this line a level higher than we do. Auth0
tells you to run a separate tenant per environment, WorkOS a separate
environment with its own credentials and redirect URIs, and Clerk gives every
application a development and a production instance out of the box, with a
separate application as the documented workaround for staging.
So if you have used one of those, a client per environment will feel like the
loose version of a habit you already have.
### Step 1: create one client per environment
In the console, open auth settings and create a client. It asks for a title, a
type, and the two application URLs that environment's app server answers on.
Then name it for a stranger. "Acme production", "Acme staging" and "Acme local"
are worth the three seconds, because the next person reading this list is
deciding which client ID goes into a deploy, and a list of four clients called
"My app" is how the wrong one gets picked.
The type is a real decision, not a formality. A `normal` client is how your own
app signs its own users in, and that capability is granted on every plan. An
`oauth2` client is something else: your app _being_ the identity provider that
other applications authenticate against, which is a separate plan feature.
One route creates both, so it is easy to pick the second by accident and be
refused, or to pick it and pay for a capability you are not using.
What you should see: the client is created with an **empty** redirect URL list.
Nothing is prefilled, and the secret is displayed in full exactly once. Copy it
now, into that environment's secret store and nowhere else. Every later read
masks it down to the first five and last five characters, and the only way back
is rotation, which invalidates the old one.
New `oauth2` clients also require PKCE by default.
### Step 2: add only the redirect URLs that environment uses
Matching is an exact string comparison against the registered list before
anything clever happens. Which means these are four different entries, and
three of them will not match the fourth:
```text
https://app.example.com/callback
https://app.example.com/callback/
https://app.example.com/Callback
https://app.example.com:443/callback
```
The trailing slash is the one that costs an afternoon. Register the string your
app actually sends, character for character.
For the local client, loopback with the port you develop on:
```text
http://localhost:3000/callback
```
Entries are deduplicated when you save, and each one is shape-checked by the
same code in the browser and on the server, so the inline error you see while
typing and the server's answer cannot disagree about shape.
One check the browser does not carry is the public suffix list, which is too
large to be worth shipping to a browser. A wildcard pattern too broad to be
anyone's domain, which the next section gets to, passes the inline check and is
refused on save, so that one arrives in the toast rather than under the field.
One trap worth knowing. A plain, non-wildcard entry is accepted on very
permissive terms: anything the URL parser accepts, which still includes
private-use schemes like `myapp://callback` for native apps, and also fragments
and embedded credentials. That is deliberate, because tightening it would make
existing stored clients unsaveable the next time an admin edited them.
It does mean the console will happily save you a redirect URL with a username
and password in it. Do not write one.
### Step 3: point each build at its own client
The provider takes the org ID, the client ID and the redirect URL. Read all
three from the environment rather than hardcoding them, so the same source tree
produces a different wiring per deploy:
```tsx
import { ApiVersion } from '@buildbase/sdk';
import { SaaSOSProvider } from '@buildbase/sdk/react';
export default function Providers({ children }) {
return (
{children}
);
}
```
The `redirectUrl` you pass here is the value that arrives at the authorization
endpoint as `redirect_uri`, so it has to be one of the strings you registered in
step 2, exactly.
These are `NEXT_PUBLIC_*` values, which means they are baked into the bundle at
build time. Changing a client ID is a redeploy, not a restart. Our own
environment notes put it plainly: if a frontend variable is wrong in
production, the fix is in the dashboard and it still needs a redeploy, because
`NEXT_PUBLIC_*` is compiled into the bundle rather than read at runtime.
What you should see: sign in on each environment in turn and land back in that
environment. If local redirects you to production, you are running production's
client ID.
### When your URLs genuinely vary
Exact matching is what the standards ask for. RFC 9700, the OAuth 2.0 security
best current practice, requires an authorization server to compare a request's
redirect URI against the registered ones as exact strings, with one carve-out:
port numbers in loopback redirects for native apps. So the port relaxation in
the previous section is not a liberty we took, it is in the specification. The
draft OAuth 2.1 document asks for the same thing in its registration
requirements.
We deviate once more, narrowly, because
[subdomain-per-tenant](/guides/multi-tenant-workspaces-in-an-afternoon) is the
dominant multi-tenant SaaS shape and exact matching means one registered entry
per customer.
A pattern may carry one asterisk, as the entire leftmost host label, consuming
exactly one label:
```text
https://*.app.example.com/callback
```
That matches `acme.app.example.com` and `beta.app.example.com`. It does not
match `a.b.app.example.com`, because the asterisk is one label and not a
prefix. Scheme and path stay exact, and so does the port, with the same
loopback carve-out as above. Neither side may carry embedded credentials,
because the comparison runs on a parsed URL rather than the raw string. That is
what defeats the classic bypasses, where a hostile host is smuggled in front of
the real one with an `@` or a `#`.
A pattern must also carry no query string and no fragment of its own. The
fragment is refused when you save it. The query string is not, so a pattern
with one saves cleanly and then silently matches nothing, which is worth
knowing before you spend an evening on it.
Four more rules worth having in your head before you type one:
- `foo*.example.com`, `*.*.example.com` and `a.*.example.com` are all refused.
One asterisk, leftmost, whole label.
- The literal remainder has to be a domain somebody can own. Patterns on a
public suffix are refused, which rules out `*.com` and, more usefully for you,
`*.vercel.app` and `*.github.io`.
- Wildcards must be `https`, unless the remainder is a loopback host, where
`http://*.localhost:3000/callback` is allowed for local subdomain-per-tenant
work.
- Wildcards are console-only. Dynamic client registration, where an unattested
agent registers itself, rejects them outright. There is no domain-ownership
proof behind a pattern, so the admin typing it is the trust boundary.
Pick the narrowest pattern that covers your tenants, on a hostname you control.
### Preview deployments, honestly
If your previews are served from a domain you own, wildcard the varying label
and you are done. `https://*.preview.example.com/callback` covers every branch
build.
If your previews are on the platform's shared domain, you cannot. A wildcard on
`vercel.app` is refused by the public suffix rule, and that refusal is correct:
the pattern would match every other customer's deployment on that domain too.
We are not unusual here. WorkOS documents the same rule and names `*.vercel.app`
as a rejected example, and Clerk's own documentation says it is currently not
possible to use their production API keys with your host's provided preview
domain.
The workable answer is to point preview builds at a stable staging client with
one fixed redirect URL, and accept that a preview signs in as staging. It is
less magical than a wildcard and it is the only version of this that is not a
hole.
### The failure modes
**An unregistered `redirect_uri` is a dead end, not a redirect.** You get HTTP
400 and a JSON body on the auth server, and the browser stops there:
```json
{
"error": true,
"path": "redirect_uri",
"message": "invalid field redirect_uri , required of type :Invalid redirect URI"
}
```
This looks broken and it is correct. Until the redirect URI is proven to belong
to the client, redirecting to it is the attack, so the error cannot be
delivered that way. Every parameter error _after_ that check does come back to
your app as `error` and `error_description` on the redirect URL, with your
`state` echoed back. Which gives you a rule of thumb: a JSON error on the auth
server means the client ID or the redirect URL is wrong, and an error delivered
to your own callback means something else is. A sign-in that completes and then
bounces you around is neither, and usually
[middleware](/guides/nextjs-middleware-redirect-loop-after-login).
The rejection is logged server-side with the registered list beside it, which
is the first thing to ask for if you are self-hosting and the string looks
identical to you.
**`redirect_uri_mismatch` from Google or GitHub is a different problem.** That
error comes from the provider, about the callback URI shown on the login
method, which is not the same value as the redirect URLs on your client.
Editing the client will not move it. The [social login
guide](/guides/social-login-nextjs) covers that one.
**A wildcard that saved but never matches.** Registration rules are re-applied
at match time, on purpose, so a pattern written before those rules existed
cannot come alive later as something we would refuse to register today. If a
pattern saves and never matches, re-save it and read the error.
**One client per environment does not isolate everything.** This is the part I
would want someone to tell me. Magic links and the social sign-in start routes
do not check against one client's list.
They check the candidate's _origin_ against a set pooled from every redirect
URL on every auth client in the organization, plus the organization's auth base
URL. That pooling exists to stop someone asking the platform to email a victim
a real sign-in link pointing at a domain they control.
The consequence: adding `http://localhost:3000/callback` to your development
client adds `http://localhost:3000` to an allowlist that your production magic
link endpoint also consults. Per-client separation protects the authorization
code path completely and this origin path not at all.
If the two genuinely must not share an allowlist, they have to be separate
organizations, which is a real cost most teams will reasonably decline. If you
do not pay it, at least know that the loopback entry is organization-wide, and
keep the list short.
### What to carry away
One client per environment, because the app server URL, the secret, the login
methods and the tracking scripts are all singular and all live on the client.
Register the exact string your app sends, and keep loopback off anything real
users touch. Reach for the wildcard only when the varying label is a tenant on
a hostname you own - never to paper over an environment you were too lazy to
give its own client.
```bash
npm i @buildbase/sdk
```
---
## Auth clients and redirect URLs: you want two clients, not one per environment
> How many auth clients to create, and how to split redirect URLs across localhost, preview deploys and production without registering a wildcard that will be refused.
- Source: https://www.buildbase.app/guides/auth-clients-redirect-urls-and-environments
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-13
- Updated: 2026-10-19
### In short
Create two auth clients, not three. Production gets its own; local development and preview deploys share the other, because they sit at the same trust level. Register exact redirect URLs on the production client, and cover shifting preview hostnames with a single leftmost-label wildcard on a subdomain you own.
Every OAuth vendor repeats the same rule: one client per environment. Follow it
and you will create three, feel organized, and then discover that the one
environment which actually hurt is no better off. Preview deploys get a new
hostname on every push. No number of clients fixes a hostname you cannot
predict.
That rule is one client too many, and it is aimed at the wrong problem. What
splits environments is a trust boundary, not a count: production holds real
users and a secret nobody should be able to read casually, and nothing else
does. Localhost and preview deploys sit on the same side of that line. The
preview problem is a different one, and it is a question of redirect URL
matching.
### What you are building
Two auth clients in the BuildBase console, each with its own client ID, secret
and list of redirect URLs. When it works, a developer clones the repo, runs it
on `localhost:3000` and signs in without asking anyone for a credential; a
preview branch deploys and its sign-in button works on a hostname nobody
registered by hand; and production holds a secret that two people have, with a
callback list you could read aloud without wincing.
> **Before you start:** An organization with login methods already enabled under User Management →
> Access → Authentication → Methods. Methods are an organization-wide catalogue
> and a client can only offer methods that already exist, so that step comes
> first. The sign-in methods to choose from are email and password, [magic
> link](/guides/magic-link-login-nextjs), email and phone codes,
> [passkeys](/guides/passkeys-nextjs), [Google, LinkedIn, GitHub,
> Microsoft](/guides/social-login-nextjs), Apple, an OpenID Connect provider of
> your own, Ethereum and Solana wallets, and enterprise SSO (SAML and OIDC),
> which is on the Enterprise plan and runs through your own WorkOS account.
> Separately, every app is an OAuth 2.0 authorization server for agents and
> third-party apps, which is not a way for a person to sign in.
### Step one: decide the split before you create anything
Create one client for production and one for everything else.
A second client buys you three things that matter here: its own secret, which you
can rotate without touching production; its own subset of login methods, so a
staging build can offer a password login you would rather not ship; and its own
tracking scripts. If none of those matter to you for a given environment, that
environment does not need a client of its own, it needs a redirect URL added to
one that already exists.
> **Key takeaway:** The question is never "how many environments do I have". It is "which
> environments need a different secret". For most teams the answer is two:
> production, and not-production.
What about staging? If staging runs against production data, it is production
and belongs on the production client. If it runs against its own data and your
developers can read its environment variables, it is not-production. The data
decides it.
### Step two: create the non-production client, and copy the secret
Go to User Management → Access → Authentication and create a client. Name it
for what it is rather than where it runs, so `webapp-dev` and not `staging`.
The create dialog shows the client secret once. Copy it then.
This is not a UI quirk, it is the design. Every later read of a client masks
the secret down to its first five and last five characters, because the
alternative was handing the organization's OAuth client secret in full to every
role with read access on auth settings.
The masking came with a cost that the code records plainly: an admin who
skipped past the create dialog had no route back to a working client except
deleting it and making a new one, which lost its ID, its redirect URLs and its
methods along with it. That is why rotation exists as its own action now. If
you lose the secret, rotate it rather than rebuilding the client.
You should now see the client in the list with a `clientId`, a masked secret
preview, and an empty redirect URL list. Methods and redirect URLs are not part
of the create form; open the client you just made and pick its login methods
from the catalogue there.
### Step three: register redirect URLs that will actually match
Add the exact URL your app sends, and then read that word again, because
exact is doing more work here than it looks.
A registered entry goes through three passes. The first is raw string
equality against the URL your app sent. Not a parsed comparison, a string one.
If that fails and the entry contains an asterisk, the wildcard rules in step
four take over, and those do compare parsed URLs. If that fails too, one
relaxation is left: when both the registered entry and the requested URL are
`http` on a loopback host, the port is ignored, so a registered
`http://127.0.0.1/callback` matches `http://127.0.0.1:51789/callback`. That
carve-out exists for native and CLI clients, which bind a fresh port on every
run.
The first pass is the one that catches people. String equality means a
trailing slash makes a different URL. It means that if your redirect URL
carries a query string of its own, you register it with that query string
attached, character for character. Build the URL in one place in your code and
register that string, rather than assembling it per call site and hoping the
two agree.
There is also less validation on a plain entry than you might assume. Anything
the URL parser accepts will save, which is deliberate: native apps register
private-use schemes like `myapp://callback`, and tightening it would make
clients that already exist unsaveable. So nothing stops you registering
`http://staging.example.com/callback`. Do not. Off your own machine the only
scheme that belongs in a redirect URL is `https`, and the wildcard rules below
are the one place that is actually enforced.
For local development, register `http://localhost:3000/callback`. For tenant
subdomains on your own machine, `http://*.localhost:3000/callback` works too,
which is how you test a subdomain-per-tenant app without editing `/etc/hosts`.
Loopback means `127.0.0.1`, `[::1]`, `localhost` and anything ending in
`.localhost`.
### Step four: preview deploys, where everyone gets stuck
Point previews at a subdomain you own, then wildcard that subdomain.
A wildcard entry here is deliberately narrow. One asterisk, standing as the
entire leftmost host label, consuming exactly one label:
```
https://*.preview.example.com/callback
```
`build-417.preview.example.com` matches. `a.b.preview.example.com` does not,
because the asterisk is one label and not a prefix. `prefix-*.example.com` is
refused outright, since the asterisk has to be the whole label rather than part
of one. Matching happens on a parsed URL rather than the raw string, which is
what defeats the classic bypasses where an attacker hides a hostname in the
userinfo or the fragment.
Parsing the URL also makes this pass more forgiving than the string one, in two
small ways. An empty path and `/` count as the same target, so on a wildcard
entry the trailing slash stops mattering. The query string and fragment on the
incoming URL are ignored too, since the authorization code and state get
appended after validation. Everything else stays exact: scheme, path, and the
port outside the localhost carve-out above. `/callback/extra` will not match
`/callback`.
And the entry everybody tries first:
```
https://*.vercel.app/callback
```
That one is refused on save, with an error telling you the host is too broad
because `vercel.app` is a public suffix. It is the correct answer even though
it is the annoying one. `vercel.app` is not a domain you own, it is a domain
anyone can deploy under, and a wildcard across it would let any project on that
platform receive your authorization code. The same check
refuses `*.com`, `*.co.uk` and `*.github.io`.
Which leaves you with real work to do rather than a config line: give previews
a stable hostname under a domain you control, through a CNAME or your host's
preview-domain feature, and send the app's redirect URL from an environment
variable rather than deriving it from `window.location`. Then one wildcard
entry covers every preview you will ever deploy.
Two more rules worth knowing before you rely on one. A wildcard must use
`https`, except on localhost. And a wildcard can only be added by an
authenticated admin: a client that registers itself through Dynamic Client
Registration is refused one outright, because a wildcard is only ever as safe
as whoever chose it.
### Step five: create the production client and wire both up
Create the production client the same way, with one difference: every redirect
URL on it is exact. Reach for a wildcard here only if you genuinely serve
tenant subdomains, and then wildcard the tenant subdomain and nothing above it.
This is also where the method subset earns the second client. Your
non-production client can offer an email and password login that keeps local
testing quick, without that login ever showing up on the sign-in screen real
users see. The subset is stored per client, not per organization, so enabling a
method in the catalogue does not switch it on anywhere by itself. A client has
to select it.
Keep the production secret somewhere only your server reads it. The client ID
and the redirect URL are public by nature, and in a Next.js app both are
build-time values:
```bash
NEXT_PUBLIC_BUILDBASE_CLIENT_ID=your-client-id
NEXT_PUBLIC_BUILDBASE_REDIRECT_URL=https://app.example.com/callback
BUILDBASE_CLIENT_SECRET=your-client-secret
```
Then the provider reads whichever client the environment points it at:
```tsx
import { ApiVersion } from '@buildbase/sdk';
import { SaaSOSProvider } from '@buildbase/sdk/react';
export default function Providers({ children }) {
return (
{children}
);
}
```
Both values are public and baked into the bundle, so a change to either needs a
redeploy rather than a restart. The client secret is the one that stays
server-side. [Wiring the rest of the provider](/guides/buildbase-on-nextjs) is
unchanged; only these two values differ per environment.
What you should see: sign-in works on all three hostnames, and the client list
shows two clients, not the three you were told to create.
### The failure modes
**The redirect URL does not match and login refuses.** Compare the
`redirect_uri` on the authorize request against the registered entry, character
by character. Usually it is a missing port, a stray trailing slash, or `http`
arriving where a proxy was supposed to forward `https`. That slash surprises
people. They have read somewhere that it does not matter, and on an exact entry
it does, because that pass is a string comparison.
**Sign-in succeeds, then the app bounces between the callback and the login
page.** That is not a redirect URL problem at all, even though it looks like
one. It is [middleware running before the session cookie is
readable](/guides/nextjs-middleware-redirect-loop-after-login).
**It works on `app.example.com` and fails on `acme.app.example.com`.** If the
wildcard entry is right, [look at the cookie
domain](/guides/session-cookie-not-shared-across-subdomains) rather than the
redirect URL.
**A login method vanishes from one client.** Deleting a method
organization-wide pulls it from every client that offered it, and each client's
cache is invalidated at the same time so the sign-in screen updates immediately.
The method is gone from the catalogue, so it cannot come back by editing the
client.
**The secret is gone.** Rotate it. Do not delete the client, or you will lose
the redirect URL list you just built.
### Where Supabase wins, and where Clerk does
Supabase allows a full glob allowlist, and their own documentation gives the
Vercel preview recipe directly, wildcarding across the platform domain. If
preview deploys on a shared platform domain are the thing you care most about,
that is genuinely less work than registering a subdomain you own. We refuse
that shape on purpose, and the cost of the refusal lands on you at setup time.
Clerk separates development and production into distinct instances with
different key prefixes, so a preview build cannot reach production users at
all. We have no equivalent: there is no test mode here, and nothing labels a
client as non-production except the name you gave it. The discipline is yours
to keep.
Neither of those changes the advice. It just means the second client is doing a
job that, elsewhere, the platform would do for you.
```bash
npm i @buildbase/sdk
```
---
## Choosing billing currencies before your first subscription
> Which billing currencies to enable before your first customer: why a Stripe subscription currency is locked per customer, and what adding one later costs you.
- Source: https://www.buildbase.app/guides/choosing-billing-currencies-before-your-first-subscription
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-13
### In short
Enable only the currencies you are willing to keep. A workspace locks to one billing currency on its first subscription, and Stripe will not move a customer off it while a subscription, quote or discount still pins it. Adding a currency is easy; every plan version you publish afterwards carries a price in it.
Enabling a second billing currency is one more string in a PATCH body. Getting rid of it takes a conversation with every customer who subscribed in it. That asymmetry is the whole of this decision, and it sits at step one of the Get Started checklist for a reason: the currencies you save before you build any plans constrain every price you can create afterwards.
### What you are building
An organization that bills in exactly the currencies you intend to support for the next few years, set before a single customer subscribes. When it works, your plan list carries one price per currency you enabled, and a workspace that subscribes gets stamped with its currency for good. No support email ever arrives asking "can you move my account to euros".
> **Before you start:** You need an organization and your own Stripe keys connected. You do not need
> any plans yet, which is the point: do this before you build them, because a
> plan version has to carry a price in every currency your organization bills
> in.
### Step 1: find out what you can actually charge in
Ask the API rather than guessing from a list you remember:
```bash
curl https://api.console.buildbase.app/api/organizations/settings/supported-currencies \
-H "Authorization: Bearer 665f1a2b3c4d5e6f7a8b9c0d:your-token-secret"
```
```json
{
"supportedCurrencies": [
"usd",
"eur",
"gbp",
"cad",
"aud",
"jpy",
"inr",
"chf",
"sek",
"nok",
"dkk",
"sgd",
"hkd",
"nzd",
"mxn",
"brl",
"pln",
"czk",
"thb",
"try",
"zar"
]
}
```
That is 21 currencies, and the number comes from `SUPPORTED_BILLING_CURRENCIES` in `packages/shared`, the same constant the API validates against. Anything outside this list is refused at save time, so read it before you promise a price to someone.
### Step 2: decide how many, and what the second one does to checkout
Pick the currencies you have already been paid in. Then look at what the second one does to the code that creates subscriptions, because that is where the cost lands first.
A subscription checkout resolves its currency in this order:
1. The workspace's own `billingCurrency`, if it has one from an earlier subscription or credit purchase.
2. An explicit currency on the request.
3. The currency on the plan version's first price variant.
4. Your organization's first billing currency, as a last resort.
With one currency enabled, steps three and four can never disagree with each other. Add a second and price a plan in both, and the branch above them takes over: a plan version carrying more than one variant with no currency on the request does not quietly fall back to anything. It throws.
> Plan version has multiple currencies. Please specify currency (e.g. usd, cad) when creating checkout.
So the real consequence of a second currency is not a settings row. It is that every call site creating a checkout now has to decide a currency and say so, and the one you forget fails at the moment a customer tries to pay.
Step four is worth knowing for a different reason: you do not choose which currency sits first. The handler de-duplicates and **sorts** the list before storing it, so an organization selling in `usd` that adds `aud` gets `["aud", "usd"]` back, and Australian dollars become the last-resort currency. On a subscription that rarely decides anything, because a price variant almost always carries its own currency. On a credit-pack purchase it decides more often: that path consults the org list _before_ the variant, so the alphabetically-first code is the one a credit purchase falls back to.
As for how many: fewer than the form tempts you into. BuildBase ships support for 21 currencies and sells its own paid plans in one, at $19, $49 and $99 a month. Twenty-one is a capability. One is a pricing decision, and they are not the same number.
> **Key takeaway:** Every currency you enable is a price that every plan version you publish
> afterwards has to carry, once for every billing interval you offer. A seventh
> currency added in month nine is a fresh variant on each version you ship from
> then on, carrying a price for every interval you sell.
### Step 3: save the list
```bash
curl -X PATCH https://api.console.buildbase.app/api/organizations/settings/config \
-H "Authorization: Bearer 665f1a2b3c4d5e6f7a8b9c0d:your-token-secret" \
-H "Content-Type: application/json" \
-d '{"billingCurrencies": ["usd"]}'
```
Or set it on the organization settings page in the console, which is what the Get Started checklist links to.
Now the part worth reading twice. **That PATCH merges. It never removes.** The handler takes what you already hold, adds what you sent, de-duplicates and sorts, and stores the union. Send `["eur"]` to an org holding `["usd"]` and you now bill in both. There is no removal route, and the code comment says so plainly: the PATCH never removes one.
So the result of this step is a list you live with: the only way to shorten it is a migration, not a setting.
### Step 4: price a plan version in every currency you enabled
Publishing a plan version runs a guard that checks it has a pricing variant for every currency your organization bills in. The bar is set by the org's current currency list, not by the version you copied from, so a currency added after v1 shipped is a currency v2 has to carry before it will publish. [Changing pricing without affecting existing customers](/guides/plan-versioning-nextjs) covers the versioning mechanics around that guard.
You should see a publish refused with a missing-variant complaint until every enabled currency has a price. That refusal is the currency list catching up with you.
### Step 5: watch a workspace lock
Subscribe a demo workspace, then read it back. Its `billingCurrency` is now set, and it is set once: the service that writes it only does so when the field is empty.
```ts
// server-side, on first subscription
if (workspace && !workspace.billingCurrency) {
await workspaces.updateById(orgId, workspaceId, {
billingCurrency: currency,
});
}
```
The code comment above that function gives the reason in one line: Stripe allows one currency per customer. A credit purchase sets the same field, so a workspace can be locked by buying a credit pack before it ever subscribes to anything.
### The failure modes
**"At least one currency is required (e.g. usd, cad)."** You sent an empty array hoping to clear the list. Merging an empty array into an empty list leaves nothing, and an org that bills in no currency cannot price anything, so the save is refused. It is what you get for reaching for the settings API as a removal tool.
**"Unsupported currency codes: CNY. Only these are allowed: USD, EUR, ..."** A code outside the 21. The message lists the full permitted set, so paste it and pick again.
**A refused PATCH when you are on a smaller plan.** The number of currencies an org may hold is itself a plan limit, and where that limit is enforced it is measured on growth only. A request that adds nothing to what you already hold passes through untouched. That matters if you downgrade. An org can legitimately hold more currencies than its current plan allows, because nothing can take one back, and refusing the no-op would trap it.
**"You cannot combine currencies on a single customer."** This one is Stripe's, not ours. It is the end state this guide exists to avoid. You tried to subscribe a customer who already has a default currency to a price in another one.
### Why Stripe makes this permanent
A Stripe Customer has one default currency. It is set by the first thing that needs one, and `currency` is not a writable field on customer create or update, so you cannot simply correct it later.
While any of these exists in the old currency, the customer stays pinned to it:
- active subscriptions, meaning any status other than canceled
- not-started or active subscription schedules
- discounts
- draft or open quotes
- pending invoice items, the ones not yet attached to an invoice
Stripe's documented position on the subscription half is flat: you can't have two active subscriptions with different currencies.
Moving a customer anyway is a real procedure, not a toggle. Create the products and prices in the new currency. Void the open discounts, invoice items, invoices and quotes sitting in the old one. Convert any customer balance with balance transactions, because a credit balance is held per currency and a CAD invoice will not spend a USD credit. Cancel the old subscription with [prorations disabled](/guides/proration-on-plan-change-nextjs), then create the new one using the previous subscription's period end as the billing cycle anchor so the customer is not billed twice for one month.
The parameter names for the proration and anchor behaviour are in Stripe's API reference rather than in the migration article, which carries no code at all. (Stripe behaviour verified 12 October 2026.)
Not every customer is stuck, and anyone testing this will find that out fast. Once every subscription, schedule, discount, quote and pending invoice item in the old currency is gone, the next billing object in a new currency re-sets the default. So the permanence is really about customers with live billing, which is to say customers who are paying you.
### What multi-currency prices do and do not fix
Stripe supports several currency options on one Price object, which is the documented way to sell in several currencies while each customer stays on one. Use it. It still does not hand you a switch for an existing customer.
Two details decide how it behaves. All your prices must share the same default currency. And if you create subscriptions directly rather than through Checkout, the extra currencies do nothing until you pass the `currency` parameter, so the subscription quietly uses the price's default. Checkout picks the local currency from the customer's IP address, which is a different mechanism from the customer-level default and worth not confusing with it.
Stripe's newer Adaptive Pricing for subscriptions lands in the same place. Its own documentation says the chosen currency remains locked in until the subscription is canceled, and that existing subscriptions are not affected. Each of these routes still settles a customer on one currency for as long as their subscription is live.
### The decision this one gets confused with
If you are deciding how the prices themselves are presented rather than which currencies exist, [an annual and monthly toggle in Next.js](/guides/annual-and-monthly-toggle-nextjs) covers the display-versus-billing distinction.
```bash
npm i @buildbase/sdk
```
---
## Should you run auth on your own domain?
> A custom auth domain is close to a one-way door for passkeys, and a DNS record that becomes part of your login path. Here is how to decide, and how to move before anyone signs in.
- Source: https://www.buildbase.app/guides/should-you-run-auth-on-your-own-domain
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-13
- Updated: 2026-10-20
### In short
Decide before your first user signs in. WebAuthn binds every passkey to the hostname of your auth pages, so moving to a custom domain afterwards leaves existing passkeys inactive. A custom domain also puts a DNS record in your login path, re-checked every 6 hours. The shared platform host never breaks that way.
The advice you will get is that your own domain looks more professional. That
is true, and it is not the reason to decide. The reason is that the choice is
close to permanent. WebAuthn binds every passkey to the hostname that ran the
ceremony, so the domain you sign people in on today is the domain their
passkeys belong to. Move it later and those credentials do not come with you.
So the question is not whether `auth.example.com` reads better than a shared
host. It is whether you are willing to own a DNS record that is now part of
your login path, and whether you will decide before anyone enrols rather than
after.
> **Key takeaway:** If you want a custom auth domain, set it up before your first user signs in.
> Adding one later leaves every existing passkey inactive, because the relying
> party ID moves with the hostname. If you are not going to treat that DNS
> record as production infrastructure, the shared platform host is the better
> choice, and it cannot break this way.
### What you are building
One verified custom domain serving your organization's sign-in pages. When it
works, your sign-in page loads from a hostname you own, the console shows the
certificate as issued, and every auth flow resolves to that origin instead of
the platform default. In the Domains tab the entry carries a Verified badge.
The DNS record stays listed underneath it, which is reference rather than an
outstanding request.
> **Before you start:** An organization on a plan that includes custom auth domains, DNS access for a
> domain you own (a subdomain is normal and is what most teams use), and
> agreement on the hostname you intend to keep. That last one is not padding. It
> is the whole post. The adjacent decision, how many auth clients to create and
> which redirect URLs go on each, is [its own
> guide](/guides/auth-clients-redirect-urls-and-environments).
### Step one: settle the hostname before anyone enrols
The relying party ID is derived from your auth domain and nothing else:
```ts
// Derive the WebAuthn relying party from the hosted auth UI base URL.
export function toRelyingParty(authBaseUrl: string): {
rpID: string;
origin: string;
} {
const url = new URL(authBaseUrl);
return { rpID: url.hostname, origin: url.origin };
}
```
That base URL is the org's verified custom domain when there is one, and the
platform host otherwise. There is no second input, no override, no setting that
decouples the two. Change the domain and you change the relying party.
What this looks like to a user is quieter than an error. The browser simply
does not offer the passkey, because as far as it is concerned the credential
belongs somewhere else. A passkey stores the `rpId` it was registered under,
and when your app lists them each one carries an `active` flag comparing that
stored value against the current auth domain. An inactive passkey is a
perfectly good credential for a hostname you walked away from. The enrolment
side of all this is in
[how to add passkeys in Next.js](/guides/passkeys-nextjs).
So pick the hostname you expect to still be using in three years. If that is
the platform host, stop here, and skip to the last section before you spend an
afternoon on DNS.
### Step two: add the domain
Adding is a POST to the auth domains route, which is where you meet the
refusals. Four of them are worth knowing before you hit one:
- **402** from the plan gate. The feature gate runs first, then the plan's own
limit on how many domains you may attach. It answers with the numbers, which
is what lets the console draw a usage meter instead of a shrug.
- **403 at 25 domains**, by default. This is an infrastructure ceiling rather
than a plan limit.
Every domain lands on a shared hosting project, so no plan moves this number,
and the refusal deliberately says nothing about upgrading. Offering an
upgrade for a ceiling nobody can raise would be a lie.
- **409 `DOMAIN_TAKEN`.** The registry is global and first-come, and a unique
index on the name is what decides the race, so two organizations claiming the
same hostname at the same moment cannot both win. If another organization
holds the name, it has to be removed there before you can take it. A name
your own organization already holds comes back as a 400 instead.
- **400 for a public suffix.** You cannot attach `com`, `co.uk` or `github.io`.
Those are not domains anyone owns, and attaching one would be either a
mistake or a land grab.
The order matters here. The registry reservation happens before the domain is
attached, and it is rolled back if the attach fails, so a refused attach does
not normally leave a name squatted on the way out. The rollback is best effort:
if it fails too, that is logged rather than retried.
### Step three: point DNS, and verify inside 24 hours
The console shows you the record. In the common case it is a CNAME:
```text
CNAME auth.example.com cname.vercel-dns.com.
```
If the platform returns more specific verification records for your domain, the
console renders those instead, and you should use what it shows rather than
what this guide shows. Add the record, then run verification from the Domains
tab.
> **Warning:** A domain that has never verified is deleted 24 hours after you add it. The
> cleanup runs hourly, removes the domain from the hosting project and the
> organization, and drops its registry entry, releasing the name. That last part
> is the one that stings: the name goes back to first-come, so a half-finished
> setup you left over a long weekend is a name somebody else can take.
Once verification succeeds, the resolver returns your custom origin for the
organization and caches that answer for an hour. Sign-in now comes from your
hostname. Passkeys registered from this point forward are bound to it.
### What breaks later, and how you find out
Verified is not a state you reach and keep. A cron re-checks every registered
domain every 6 hours:
```ts
registerCron(queue, { pattern: '0 */6 * * *' }, 'domain-revalidation-cron', {
type: JOB_TYPES.SWEEP,
});
```
A single negative answer does not count. It schedules re-checks at 5, 15 and 30
minutes, four checks in total, and only the fourth marks the domain unverified.
An API error never unverifies anything at all, because "the provider says this
domain is not verified" and "we could not reach the provider" are different
answers and only one of them is about your DNS.
When the fourth check still says no, the domain is marked unverified, the
resolver cache is dropped, and the next auth request falls back to the platform
host. Your sign-in page keeps working. Your passkeys do not, because the
relying party ID just moved.
Two softenings are built into that, and both exist for the same reason:
The domain is not deleted. Cleanup only removes domains that never verified at
all. One that verified once and broke afterwards is kept, unverified, waiting
for you, because deleting it would mean re-adding and re-verifying before
anyone's passkey worked again.
Recovery needs no human. Fix the record and the next sweep's first positive
answer restores the domain on its own.
There is one more piece of defensiveness worth knowing about, because it tells
you how seriously the system takes this hostname. If the registry lookup itself
fails, the resolver does not fall back to the platform host. It serves the last
domain it saw verified, on the grounds that a failed lookup is a bad reason to
make everybody's passkeys look stale.
### When the shared host is the right answer
Honestly: more often than teams assume.
The shared platform host has no DNS record to misconfigure, no certificate to
renew, no revalidation that can flip you back, and no 24-hour window to miss.
It is one less piece of infrastructure between a user and a session, and the
failure mode described above simply does not exist for it. If your sign-in page
is one hop in a flow nobody lingers on, that is a real argument and not a
consolation prize.
A custom domain earns its keep when the hostname is doing work: when users
would notice being bounced to a name they do not recognise, when
[cookies need to sit under a domain you control](/guides/session-cookie-not-shared-across-subdomains), or when you are selling to
people who read the URL bar before they type a password. Those are good
reasons. "It looks more professional" is a preference, and preferences are a
thin justification for taking on a dependency that can unverify itself at four
in the morning.
Either way, decide it once, early, and write the decision down somewhere your
future self will look. The expensive version of this is not choosing wrong. It
is choosing twice.
```bash
npm i @buildbase/sdk
```
---
## How to create a default workspace on signup in Next.js, but not for invited users
> Create a default workspace on signup in Next.js without giving invited users an empty one of their own, and decide when to ask for a name instead.
- Source: https://www.buildbase.app/guides/auto-created-first-workspace-nextjs
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-12
- Updated: 2026-10-22
### In short
Auto-create the first workspace only for users nobody invited. BuildBase makes one the first time a user lists workspaces, which suits a solo app. In a team app, turn auto-create off, show pending invitations first, and ask everyone else for a name: the workspace owns the trial and the Stripe customer.
"Create a workspace when someone signs up" is a rule that cannot see
invitations.
Your customer [invites a colleague](/guides/team-invitations-nextjs). The colleague follows the link, registers,
and the rule fires. Now they have two workspaces: the team's, and an empty one
with their own name on it. That second one holds a trial nobody has used, it
counts toward the workspace ceiling on your plan, and it sits in their switcher
until somebody deletes it.
Both behaviors ship in products you have probably used. Murf's help center says
that on its Enterprise plan, an invitee who signs up through the link joins the inviter's workspace and also
gets ["a separate free workspace of your own"](https://help.murf.ai/creating-a-workspace).
Screenly's docs say the opposite: ["No new workspace is created for you and no
trial starts."](https://www.screenly.io/docs/workspaces/overview/one-account-many-workspaces/)
Neither is a bug. They are two answers to a question most "create a default
workspace on signup" tutorials skip: who is the first workspace for?
Here is mine. Auto-create the first workspace only for the user nobody invited.
In a solo product, create it silently and never mention it. In a team product,
ask the first person for a name, and give the invitee nothing of their own.
### What BuildBase does before you write any code
It creates one for you, lazily. Not at sign-up: the first time anything lists
a user's workspaces and finds none, the server makes one on the spot and
returns it in the same response.
That listing can come from anywhere. The `WorkspaceSwitcher` fetches the list
when it mounts, so does `fetchWorkspaces()` from `useSaaSWorkspaces`, and so
does `bb().workspace.list()` on the server. Whichever runs first creates the
workspace. The rest of what happens is in the route that serves the list:
- **The name** is the first two words of the user's name plus `'s Workspace`,
or `My Workspace` when the account has no name. The user is its admin.
- **The caps still apply.** A per-user workspace limit and your plan's ceiling
both get a say, exactly as they do when a user creates one by hand. The one
setting skipped is **Can Create Workspace**, because that one is about the
user's own "New workspace" button, not about the platform giving them a first
one.
- **A refusal is an empty list,** not an error. The server logs it, and when it
was your plan's org-wide ceiling your organization is told, but the browser
only ever sees `[]`.
- **Two tabs cannot make two.** Two first loads at once both see "no
workspaces", so with Redis running the route takes a 30-second claim: one
request creates, the other re-reads what it made.
- **It fires `workspace.created`,** the same event the explicit create route
fires. We learned this one the hard way. Until we fixed it on 24 September it
did not, so any workflow hung on that event never ran for an auto-created
workspace. We found
it setting up example orgs on a local stack wired like production, where a
"Workspace Created" workflow grants 20 credits. It had zero runs, and the new
user started at 0.
Both workspace modes ship with auto-create on. A new organization starts in
**Personal** mode, one user and one workspace, where the switch cannot be
turned off at all. **Platform** mode, for shared and invitable workspaces, also
starts with it on. And our own docs say plainly what that means for an
invitation: a waiting one ["does not change what a user's first load
does"](https://docs.buildbase.app/workspaces/invitations), so with auto-create
on, an invited user ends up with their own workspace and the invited one beside
it.
That is the default. Whether to keep it is the decision.
### Who the first workspace is for
Three people sign up to a product, and they want three different things.
| Who signs up | What they should get | Why |
| -------------------------------- | ---------------------------- | ----------------------------------------------------- |
| Someone using a solo product | One workspace, made quietly | Nobody else will ever see its name |
| The first person from a new team | One workspace, named by them | The name goes out on invitations and onto the invoice |
| Someone a teammate invited | Nothing of their own | Their workspace already exists |
**The solo user** should never see the word "workspace" during sign-up. In a
product built for one person, the workspace is the account, and asking them to
name it is a question with no audience. This is what Personal mode does, it is
the default for a reason, and if it describes your product you can stop reading
here. Personal's preset also switches invitations off, and the server refuses to
switch them back on in that mode, so the invitee row of that table does not
apply to you.
**The invitee** should get nothing. Their workspace exists; somebody else made
it and invited them into it. An auto-created second one is not harmless clutter:
- **It is a trial.** BuildBase stamps `trialUsedAt` on the workspace, and
checkout reads that workspace when it decides whether a trial is still on
offer. By default it also counts people, once each: the workspace's owner and
whoever checks out. So an invitee who has never had a trial owns an empty
workspace with one waiting to be claimed. The console's help text under **Max Workspaces Per User** reads
"Prevents trial abuse", and a workspace each is exactly what that cap counts.
- **It counts.** Your plan's workspace ceiling is an org-wide count, and an
invitee's empty workspace is in it.
- **It is where they start.** When the list loads and nothing was saved from a
previous visit, the SDK selects the first workspace in it. For an invitee who
has not accepted yet, that is their own empty one.
**The first person from a team** is where "silent or ask" is a real choice, and
I would ask. The name is not private. The default invitation email's subject is
`{{inviterName}} invited you to {{workspaceName}}`, so silent naming sends the
next person "Demo User invited you to Demo User's Workspace". The same name is
in the accept dialog they see, and, the first time the workspace goes to
checkout, on the Stripe customer that BuildBase creates for it. Rename the
workspace later and BuildBase renames that customer too. But Stripe stops
updating `customer_name` on an invoice once the invoice is finalized, so every
invoice already issued keeps saying "Demo User's Workspace".
> **Key takeaway:** Ask for a name whenever a second person will ever see it. In a team product
> that is every workspace, and the field costs one click if you prefill it. In a
> solo product nobody sees it, so let it be created silently.
The honest cost is one more screen between sign-up and the product. I do not
have a number for what that screen costs, and you will not either until you
measure it in your own funnel. Prefilling takes the typing out of it, not the
screen. So if most of your sign-ups are individuals trying the product alone,
silent creation wins, and the question to settle it is always the same: will
anyone but this user ever read the name?
### Build it for a team app
Four steps, and the order matters: step two lists workspaces on the server, and
with auto-create still on, that check creates the very thing it is checking for.
> **Before you start:** A Next.js App Router app with BuildBase sign-in working and the server helper
> `bb()` from [BuildBase on Next.js](/guides/buildbase-on-nextjs). An
> organization in Platform mode: new organizations start in Personal mode, and
> moving to Platform depends on your BuildBase plan. Invitations also need an
> email sender configured in the console, or sending one answers 503.
### Step one: turn auto-create off in the console
In the console, open **Workspaces**, then **Workspace Settings**. With Platform
selected as the mode, switch on **Advanced Overrides**, turn **Auto-Create First
Workspace** off and save. That writes `autoCreateFirst: false` to your
organization's workspace settings.
Leave **Can Create Workspace** on **Everyone**. The switch's own help text says
"Off = users must be invited", and that is only true if you also turn creation
off; the console labels that pair "Invite only". With creation left on, the
screen you build next is how an uninvited user gets their first workspace.
What you should see: sign up as a brand-new user who has no invitation, and the
workspace switcher shows an empty state instead of "Demo User's Workspace". Sign
up as someone with a pending invitation and the empty state lists it.
### Step two: send anyone without a workspace to onboarding
Do the routing on the server, where nothing renders until the answer is in.
Every page in the app group lists the user's workspaces first:
```tsx
// app/(app)/layout.tsx
import { redirect } from 'next/navigation';
import { bb } from '@/lib/buildbase';
export const dynamic = 'force-dynamic';
export default async function AppLayout({
children,
}: {
children: React.ReactNode;
}) {
const workspaces = await bb()
.workspace.list()
.catch(() => null);
if (!workspaces) redirect('/');
if (workspaces.length === 0) redirect('/onboarding');
return <>{children}>;
}
```
And the onboarding page does the reverse, so a user who already has a workspace
never lands on it:
```tsx
// app/onboarding/page.tsx
import { redirect } from 'next/navigation';
import { bb } from '@/lib/buildbase';
import { FirstWorkspace } from './first-workspace';
export const dynamic = 'force-dynamic';
export default async function OnboardingPage() {
const workspaces = await bb()
.workspace.list()
.catch(() => null);
if (!workspaces) redirect('/');
if (workspaces.length > 0) redirect('/dashboard');
return ;
}
```
What you should see: a brand-new user who opens `/dashboard` lands on
`/onboarding`. A user with a workspace goes straight through, and one who types
`/onboarding` by hand is sent back to `/dashboard`.
### Step three: show invitations first
Invitations first; everyone else names it. The SDK already has both halves:
`WhenPendingInvitations` renders its children only when the signed-in user has
an invitation waiting, and its fallback when they have none.
```tsx
// app/onboarding/first-workspace.tsx
'use client';
import { useRouter } from 'next/navigation';
import {
PendingInvitations,
WhenPendingInvitations,
} from '@buildbase/sdk/react';
import { NameYourWorkspace } from './name-your-workspace';
export function FirstWorkspace() {
const router = useRouter();
const done = () => router.replace('/dashboard');
return (
One moment...
}
fallbackComponent={}
>
);
}
```
`` switches to the workspace on accept by default, so
`onAccepted` only has to move them on. Declining drops the invitation from the
list, and with nothing left waiting, the fallback takes over and asks them to
name a workspace of their own. That is the right outcome for someone who said
no.
What you should see: an invited user gets the invitation with Accept and
Decline, accepts, and lands in the team's workspace with no other in their
switcher. If they arrived through the emailed link, the SDK's own accept dialog
opens as well; either route ends in the same workspace.
### Step four: ask everyone else for a name
In practice "everyone else" is the first person from a new team. They get one
field, prefilled so the common case is a single click:
```tsx
// app/onboarding/name-your-workspace.tsx
'use client';
import { useState } from 'react';
import { useSaaSAuth, useSaaSWorkspaces } from '@buildbase/sdk/react';
// Domains that say nothing about the company. Extend for your audience.
const PERSONAL_DOMAINS = new Set([
'gmail.com',
'outlook.com',
'hotmail.com',
'yahoo.com',
'icloud.com',
]);
function suggestName(user?: { name?: string; email?: string }) {
const domain = user?.email?.split('@')[1]?.toLowerCase();
if (domain && !PERSONAL_DOMAINS.has(domain)) {
const label = domain.split('.')[0];
return label.charAt(0).toUpperCase() + label.slice(1);
}
const first = user?.name?.trim().split(' ')[0];
return first ? `${first}'s team` : '';
}
export function NameYourWorkspace({ onCreated }: { onCreated: () => void }) {
const { user } = useSaaSAuth();
const { createWorkspace } = useSaaSWorkspaces();
const [name, setName] = useState(() => suggestName(user));
const [pending, setPending] = useState(false);
const [error, setError] = useState(null);
async function onSubmit(event: React.FormEvent) {
event.preventDefault();
setPending(true);
setError(null);
try {
await createWorkspace(name.trim());
onCreated();
} catch (err) {
setError(
err instanceof Error ? err.message : 'Could not create the workspace.'
);
setPending(false);
}
}
return (
);
}
```
The two-character minimum is the server's, not taste: it refuses a shorter name.
The line at the bottom is for the address mismatch in the failure modes below.
What you should see: the new workspace appears in the switcher, and about 300ms
after `createWorkspace(name)` resolves, the SDK opens workspace settings on the
subscription screen. That is the SDK, not this code. And it is the right next
screen. The trial belongs to the workspace, so it should start on the one that
was just named, picked by the person who named it rather than by whoever happens
to sign up next.
### The failure modes
**The check creates the workspace.** You built steps two to four and skipped
step one. `bb().workspace.list()` is itself the auto-create trigger, so the
layout's check mints "Demo User's Workspace" before it can redirect anyone, and
`/onboarding` never appears. If no new user ever sees your name screen, look at
the console switch first.
**Personal mode refuses the switch.** Turning auto-create off there answers
"Cannot disable auto-create in Personal mode. Users need a workspace on signup."
That is correct. Personal mode also refuses to let users create workspaces
themselves, so auto-create is the only way anyone gets a workspace of their own
there. Switch to
Platform first.
**Invite-only by accident.** With **Can Create Workspace** set to **Disabled**
and auto-create off, `createWorkspace` answers 403 with "Workspace creation is
disabled for this organization." Your name screen becomes a dead end for
everyone who was not invited. If that is the product you want, replace the
fallback with "Ask your team for an invitation" instead of a form.
**The invitee signed up with a different address.** Their invitation was sent to
`demo@example.com` and they registered as `demo+work@example.com`. To this
system those are two people, so no invitation is pending, step three falls
through to the form, and they create a workspace of their own. That is why the
form carries the "Sign in with the address it was sent to" line. The longer
version of this hunt is in
[an invited member who cannot see the workspace](/guides/invited-member-cannot-see-workspace).
**A ceiling turns a new user away, quietly or loudly.** The automatic path
answers a refused create with an empty list, which at the browser is
indistinguishable from a bug. Your form gets the real answer: 402 when it is the
plan's ceiling, 403 when it is your own setting, each with a message you can
show. That is a small reason to prefer this design even where silent creation
would do.
**Welcome work hung on sign-up.** If a workflow grants starting credits or sends
the onboarding email, hang it on `workspace.created`, not on the user's sign-up.
An invitee should not get starter credits for a workspace they never made, and
the 20-credit bug above is what it looks like when the event and the work drift
apart.
**A double click.** The server refuses a second workspace with the same name
from the same user ("Workspace with name ... already exists"), but that is a
read before a write, and two requests in the same instant can both pass it.
The disabled button is what actually stops the double click. Keep it.
Everything here assumes [the workspace, not the user, owns the trial and the
bill](/blog/what-is-multi-tenancy), unless the plan is sold to a person. If that is not settled yet in your app, settle it first:
[multi-tenant workspaces in an afternoon](/guides/multi-tenant-workspaces-in-an-afternoon)
makes that case, and
[a free trial without a card](/guides/free-trial-without-a-card-nextjs) covers
what happens once the trial this guide hands to the right workspace starts.
I have not run these snippets end to end as one app. The server calls are the
`bb()` helper from the Next.js setup guide, the components and hooks are the
SDK's own exports as its type definitions declare them, and every server
behavior described above is read from the route that serves the workspace list.
### Install
```bash
npm i @buildbase/sdk
```
---
## How to add per-org data isolation in Next.js
> Per-org data isolation in Next.js: check membership once per request, make the data layer demand that proof, and never fetch a record by its ID alone.
- Source: https://www.buildbase.app/guides/per-org-data-isolation-nextjs
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-12
- Updated: 2026-11-04
### In short
Per-org data isolation in Next.js scopes every query against your own tables to a workspace the server verified for this user. BuildBase isolates its own records per org but never sees your tables. Check membership once per request, make the data layer demand that proof, and fetch records by ID and workspace together.
Ask how to isolate each customer's data in a Next.js app built on BuildBase,
and half the answer already exists. The other half lives in your own tables,
and it comes down to one rule: no query in your app ever receives a workspace
ID as a plain string.
The names cross over, so settle them first. In BuildBase, the
**organization** is you: the account you created in the console, which owns
your users, plans and settings. Your customers' orgs are **workspaces**. Per-org
isolation for your product means [per-workspace isolation](/blog/what-is-multi-tenancy), inside a database
BuildBase has never seen.
Most Next.js multi-tenancy guides that rank today warn against trusting an org
ID from the client. Then they read the active org out of their auth provider's
session, or list three places it could come from and leave the choice to you. With
BuildBase there is no active workspace in the session to read. The session
names the org and the user. Which workspace is open is [a choice the browser
makes and keeps in its own storage](/guides/stale-data-after-workspace-switch), and a server component only learns it when
the request says so.
So the request names the workspace. This guide is about what your server does
with that name.
### What BuildBase isolates, and what it never sees
BuildBase isolates its own records per organization and checks workspace
membership on its own API. Your tables get none of that unless you write it.
Each organization's users, workspaces, subscriptions and usage live in that
organization's own MongoDB database. The authenticated API never takes the org
from the request: it looks up the session that the `x-session-id` header names
and reads the org off the stored record. Queries in our tenant server then take
the org as their first argument, `find(orgId, filter)`, and that argument is
what picks the database the query runs against.
Inside your organization, BuildBase checks the caller on its workspace routes.
Members, invitations, subscription, usage and credits all sit behind a guard
that asks whether the session's user belongs to the workspace in the path. Call
`bb().usage.record(workspaceId, ...)` for a workspace the user is not in and
BuildBase answers 403, whatever your code passed.
| Boundary | Who holds it |
| -------------------------------------------------------------- | -------------------------------------------------------- |
| Your organization's data, apart from every other BuildBase org | BuildBase: one database per org, picked from the session |
| Membership, on BuildBase's own workspace calls | BuildBase: a guard on its workspace routes |
| Which workspace this request is for | You: the URL |
| Membership, before your code touches your tables | You ask, BuildBase answers: `workspace.permissions()` |
| Your rows, filtered to that workspace | You: every query |
The first row costs us something, not you. A database per org means a
connection per active org, and roughly 1,000 orgs per deployment is
[the connection-pool ceiling](/guides/connection-pool-exhausted-multi-tenant)
we plan against. Your workspaces share your org's database instead of getting
one each, so the limit you meet is the workspace count on your plan. Not a
connection limit.
[Database-per-tenant versus shared schema](/blog/database-per-tenant-vs-shared-schema)
is the same decision made one level down, and the last three rows above are
its shared-schema half. They are yours.
> **Before you start:** Sign-in working through [BuildBase on Next.js](/guides/buildbase-on-nextjs),
> so `bb()` and its `bb-session-id` cookie exist. Next.js 15 or later on the App
> Router; on 14, `params` is a plain object, so drop the `await` in front of it.
> `@buildbase/sdk` 0.0.73 or later, the release that added
> `workspace.permissions()`. And a table of your own to protect: the examples
> use Postgres through [postgres.js](https://github.com/porsager/postgres), but
> the shape holds for any database.
### Step 1: put the workspace in the URL
Every page that shows workspace data lives under `app/w/[workspaceId]/`, and
every API route under `app/api/w/[workspaceId]/`:
```
app/
w/[workspaceId]/
layout.tsx nav and switcher - not the guard
projects/
page.tsx
actions.ts
api/w/[workspaceId]/projects/[projectId]/
route.ts
lib/
buildbase.ts bb() and getSessionId, from the setup guide
workspace.ts the only file that verifies a workspace
data/projects.ts the only file that queries your tables
```
Why the URL? A server component cannot read browser storage, and the session
holds no workspace. A cookie would work, but it holds one workspace for the
whole browser: switch in a second tab and the first tab's next form post lands
in the other workspace. The
[Remix version of this guide](/guides/multi-tenant-workspaces-remix) walks
through that failure, and nothing about it changes in Next.js. A path segment
gives every tab its own workspace and puts the ID in every access log you
already keep.
Use the workspace's `_id`. The workspace object also has a field called
`workspaceId`, which holds a different value, and BuildBase answers 400 for it.
At this point any ID typed into the address bar reaches your page. The next
step decides which ones get any further.
### Step 2: turn the ID into a verified workspace, in one file
```ts
// lib/workspace.ts
import { cache } from 'react';
import { notFound, redirect } from 'next/navigation';
import { bb } from '@/lib/buildbase';
declare const verified: unique symbol;
/** A workspace the signed-in user was checked against. Only this file makes one. */
export type VerifiedWorkspace = {
readonly id: string;
readonly role: string | null;
readonly isOwner: boolean;
readonly permissions: string[];
readonly [verified]: true;
};
export type WorkspaceCheck =
| { ok: true; workspace: VerifiedWorkspace }
| { ok: false; reason: 'signed-out' | 'no-access' };
export const checkWorkspace = cache(
async (workspaceId: string): Promise => {
if (!(await bb().auth())) return { ok: false, reason: 'signed-out' };
try {
const access = await bb().workspace.permissions(workspaceId);
// The one place the brand is granted.
const workspace = { id: workspaceId, ...access } as VerifiedWorkspace;
return { ok: true, workspace };
} catch (err) {
const status = (err as { status?: number }).status;
if (status === 401) return { ok: false, reason: 'signed-out' };
if (status === 400 || status === 403 || status === 404) {
return { ok: false, reason: 'no-access' };
}
throw err; // a timeout or a 5xx: fail closed
}
}
);
/** For pages and layouts: the verified workspace, or sign-in, or a 404. */
export async function workspaceForPage(workspaceId: string) {
const check = await checkWorkspace(workspaceId);
if (check.ok) return check.workspace;
if (check.reason === 'signed-out') redirect('/');
notFound();
}
```
`workspace.permissions()` asks BuildBase [what the session's user may do in
that workspace](/guides/roles-and-permissions-per-workspace-nextjs) and gets back `{ role, isOwner, permissions }`, resolved on the
server from the workspace's own members. The
[permissions docs](https://docs.buildbase.app/permissions/overview) show the
endpoint underneath it. A string that is not a valid ID gets
a 400. A workspace the user is not in gets a 403, and so does one that does not
exist, so nobody can probe for which IDs are real. The `status` sits on the
thrown error but not in the SDK's types, hence the cast.
Only one of the two refusals is about the session. `bb().auth()` checks that a
session cookie is there, not that it is still alive, so an expired session
surfaces as a 401 from BuildBase and lands in `signed-out` too. Everything else
is `no-access`, and it must never look like a dead session. BuildBase's own
guard once answered 401 here, and signed people out for opening a workspace
they had lost access to; the
[Express version of this guide](/guides/multi-tenant-workspaces-express) tells
that one.
The branded type is the point of the file. `VerifiedWorkspace` carries a
marker that exists only inside `lib/workspace.ts`, so the one honest way to get
a value of that type is `checkWorkspace()`. Anywhere a `VerifiedWorkspace` is
required, TypeScript refuses a string.
`cache()` lets a layout and a page that both ask in one render share one round
trip. It does nothing anywhere else, and the Next.js docs say so plainly:
Server Actions and Route Handlers "are not part of a render pass, so the
wrapper does nothing and every call runs the function." So each of them asks
BuildBase afresh. In front of a write, that is the behaviour you want.
What you should see: `checkWorkspace()` with your own workspace's `_id`
returns `ok: true` and your role. Any other ID returns `no-access`.
### Step 3: make your data layer refuse a plain string
This is the decision our docs leave to you: where the check lives. The
tempting answer in Next.js is `app/w/[workspaceId]/layout.tsx`. Check
membership there, call `notFound()`, and every page underneath looks guarded.
It is not, and Next.js says so too. Layouts "don't re-render on navigation",
and "a layout also does not control whether the rest of the route renders".
Server Actions do not pass through the layout's check at all: they arrive as a
POST, and the docs tell you to treat them "with the same security
considerations as public-facing API endpoints." A check in the layout is a
courtesy to the user. The guarantee has to sit where the data is read.
So put it in the signature. Every function that touches a workspace's rows
takes a `VerifiedWorkspace` as its first argument, the way queries in
BuildBase's own server take the org first. The table carries the workspace,
not the user who created the row, because
[the workspace owns the data](/guides/multi-tenant-workspaces-in-an-afternoon)
and people come and go:
```sql
create table projects (
id uuid primary key default gen_random_uuid(),
workspace_id text not null, -- the BuildBase workspace _id
name text not null,
created_at timestamptz not null default now()
);
create index projects_workspace_idx on projects (workspace_id, created_at desc);
```
```ts
// lib/data/projects.ts
import postgres from 'postgres';
import type { VerifiedWorkspace } from '@/lib/workspace';
const sql = postgres(process.env.DATABASE_URL!);
export type Project = { id: string; name: string };
export async function listProjects(ws: VerifiedWorkspace) {
return sql`
select id, name from projects
where workspace_id = ${ws.id}
order by created_at desc
`;
}
export async function createProject(
ws: VerifiedWorkspace,
input: { name: string }
) {
const [project] = await sql`
insert into projects (workspace_id, name)
values (${ws.id}, ${input.name})
returning id, name
`;
return project;
}
```
A page gets its workspace from step 2 and hands it down:
```tsx
// app/w/[workspaceId]/projects/page.tsx
import { listProjects } from '@/lib/data/projects';
import { workspaceForPage } from '@/lib/workspace';
import { createProjectAction } from './actions';
export default async function ProjectsPage({
params,
}: {
params: Promise<{ workspaceId: string }>;
}) {
const { workspaceId } = await params;
const workspace = await workspaceForPage(workspaceId);
const projects = await listProjects(workspace);
return (
<>
{projects.map((p) => (
{p.name}
))}
>
);
}
```
The Server Action gets no workspace from the page. The bound `workspace.id`
travels back from the browser as an ordinary argument, and anyone can call the
action with a different one:
```ts
// app/w/[workspaceId]/projects/actions.ts
'use server';
import { revalidatePath } from 'next/cache';
import { createProject } from '@/lib/data/projects';
import { checkWorkspace } from '@/lib/workspace';
export async function createProjectAction(
workspaceId: string,
formData: FormData
) {
// Anyone can call this action, with any workspaceId. Check it here.
const check = await checkWorkspace(workspaceId);
if (!check.ok) throw new Error('No access to this workspace.');
await createProject(check.workspace, {
name: String(formData.get('name') ?? ''),
});
revalidatePath(`/w/${check.workspace.id}/projects`);
}
```
What you should see: delete the `checkWorkspace` line, pass `workspaceId`
straight to `createProject()`, and the build stops with
`Argument of type 'string' is not assignable to parameter of type 'VerifiedWorkspace'.`
That error is the boundary doing its job. Then run
`grep -rn 'as VerifiedWorkspace' app lib`: it should print one line, in
`lib/workspace.ts`. A second line is someone minting the brand by hand, and it
is the one line in a pull request worth reading twice.
> **Key takeaway:** Do not rely on the layout to guard workspace data. Make every function that
> reads or writes it take a `VerifiedWorkspace`, which only `checkWorkspace()`
> can produce. Then no page, Server Action or Route Handler can reach your
> tables without the membership check having run first.
### Step 4: look records up by ID and workspace together
The membership check answers one question: may this user be in workspace A?
It says nothing about the project ID in the same URL. Fetch that project by ID
alone and a member of A can open a project from workspace B by pasting its ID
under A's path. The check passed. It checked the wrong thing.
We found this shape in our own server. A tenant audit in September looked at
BuildBase's invoice lookup, and the comment above the fix records what it
found: "Without this check any member of the org could pull any other
workspace's invoice by id." The SDK had been sending the workspace ID with
every invoice request all along. Nothing on the server compared the two. The
fix resolves the workspace's own Stripe customer first and refuses any invoice
billed to another, and a foreign invoice now answers 404.
In your tables, every lookup by ID carries the workspace too:
```ts
// lib/data/projects.ts (continued)
const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
export async function renameProject(
ws: VerifiedWorkspace,
projectId: string,
name: string
) {
if (!UUID.test(projectId)) return null; // not a uuid: it cannot exist
const [project] = await sql`
update projects set name = ${name}
where id = ${projectId} and workspace_id = ${ws.id}
returning id, name
`;
return project ?? null;
}
```
```ts
// app/api/w/[workspaceId]/projects/[projectId]/route.ts
import { renameProject } from '@/lib/data/projects';
import { checkWorkspace } from '@/lib/workspace';
type Params = Promise<{ workspaceId: string; projectId: string }>;
export async function PATCH(request: Request, { params }: { params: Params }) {
const { workspaceId, projectId } = await params;
const check = await checkWorkspace(workspaceId);
if (!check.ok) {
return check.reason === 'signed-out'
? Response.json({ message: 'Sign in first.' }, { status: 401 })
: Response.json(
{ message: 'No access to this workspace.' },
{ status: 403 }
);
}
const { name } = (await request.json()) as { name?: unknown };
if (typeof name !== 'string' || !name.trim()) {
return Response.json({ message: 'A name is required.' }, { status: 400 });
}
const project = await renameProject(check.workspace, projectId, name.trim());
if (!project)
return Response.json({ message: 'Not found.' }, { status: 404 });
return Response.json(project);
}
```
A project from another workspace is a 404, not a 403. To this user it does
not exist, and a 403 would confirm the ID is real.
Now look at what the handler does with a `workspaceId` in the request body:
nothing. `renameProject()` takes the workspace from `ws.id` and the name from
the body, and it has no parameter where a second workspace could go. The
classic version of this bug checks membership on the path's ID and then writes
with the body's. Here a request carries one workspace, and it is the one that
was checked.
What you should see: create a project in workspace B, then send `PATCH` to
`/api/w//projects/` while signed in as a member of both. You
get a 404, because the URL said A and the row says B.
### Row-level security is the backstop, not the check
Row-level security makes Postgres refuse rows from every workspace except the
one set for the transaction. It cannot tell you whether that was the right
workspace to set. Hand it an ID straight from the URL and Postgres will
dutifully return that workspace's rows to whoever asked. So it does not
replace step 2. It catches the query someone writes outside
`lib/data/`, and the one that forgets its `where`.
```sql
alter table projects enable row level security;
alter table projects force row level security;
create policy workspace_isolation on projects
using (workspace_id = current_setting('app.workspace_id', true))
with check (workspace_id = current_setting('app.workspace_id', true));
```
Then each data-layer function sets the verified ID inside its own transaction,
and keeps its `where` clause:
```ts
export async function listProjects(ws: VerifiedWorkspace) {
return sql.begin(async (tx) => {
await tx`select set_config('app.workspace_id', ${ws.id}, true)`;
return tx`
select id, name from projects
where workspace_id = ${ws.id}
order by created_at desc
`;
});
}
```
The `true` in `set_config` makes the setting last only for the current
transaction, which is what stops a pooled connection from carrying one
request's workspace into the next request. When nothing is set,
`current_setting(..., true)` gives back a null or an empty string, the
comparison matches no row, and the query fails closed.
And `force` is not decoration. Postgres lets table owners skip their own
policies unless the table is forced, and superusers and roles with `BYPASSRLS`
skip them always. If your app connects as the role that created the table,
`force` is the line that makes the policy apply to it.
No row-level security in your database? Then the data layer from step 3 is
the whole boundary. That is a real boundary. Inside each org database, it is
the kind BuildBase draws between your workspaces.
### When one customer wants its own database
Some contracts require physical separation. That is the database-per-tenant
side of the decision, and the hosting is often the smallest part of
[what it costs](/blog/database-per-tenant-cost). Nothing above changes shape:
`VerifiedWorkspace` picks the connection instead of filling the `where`
clause, and step 2 is still the only way to get one.
### What breaks, and how you can tell
| What you see | Why, and the fix |
| ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Every workspace page is a 404, even your own. | The URL carries the workspace's `workspaceId` field rather than its `_id`. BuildBase answers 400, and `checkWorkspace()` reports `no-access`. |
| A non-member's request still runs a query under a guarded layout. | The check lives only in the layout. Pages, Server Actions and Route Handlers run without it. Make the data layer demand a `VerifiedWorkspace`, and a call that skips the check stops compiling. |
| Removing someone from one workspace signs them out of all of them. | A membership refusal is mapped to 401 or a sign-in redirect. Only `signed-out` should do that. |
| A project from another workspace opens under this one. | The query found the project by `id` alone, so add `and workspace_id = ${ws.id}` to it and answer 404 when nothing comes back. |
| A malformed project ID answers 500 instead of 404. | Postgres refuses to compare a non-UUID string with a `uuid` column. Check the shape first, as `renameProject()` does. |
| Row-level security is on and queries still return every workspace. | The app connects as the table owner on a table that is not forced, or as a superuser. |
| The right person, the right workspace, still `no-access`. | BuildBase does not count them as a member. An accepted invitation that never became a membership looks exactly like this: see [an invited member who cannot see the workspace](/guides/invited-member-cannot-see-workspace). |
### Install
```bash
npm i @buildbase/sdk
```
---
## How to add roles and permissions per workspace in Next.js
> Per-workspace roles in Next.js: hide controls with WhenPermission, check every server action with bb.workspace.can(), and know which side lags after a role change.
- Source: https://www.buildbase.app/guides/roles-and-permissions-per-workspace-nextjs
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-12
### In short
Per-workspace roles in Next.js need two checks. WhenPermission decides what the browser shows. Every server action and route handler calls bb.workspace.can() before it acts, because hiding a button does not hide the action. BuildBase reads roles per request, so after a role change the browser is behind.
`` hides the Delete button from a viewer. It does not stop a
viewer deleting.
In Next.js the delete is a server action, and the Next.js docs are blunt about
what that means: Server Functions "are reachable via direct POST requests, not
just through your application's UI." The button was one way to call it. Anyone
holding the page has the others.
So the real decision in [per-workspace roles](/blog/what-is-rbac) is where each permission gets
enforced, and the split is cleaner than it sounds. BuildBase enforces its own
`workspace:` permissions on its own API. Checkout, a plan change and
cancelling need `workspace:billing:manage`; spending credits needs
`workspace:usage:record`; changing someone's role needs
`workspace:members:role-change`. A viewer who calls checkout directly gets a 403
whatever your UI rendered.
Your permissions are a different animal. `app:reports:delete` is something
BuildBase stores, resolves per role and answers questions about. It has never
seen your server action and cannot guard it. That check is yours, in every
action.
What you are building: a **Delete report** button a viewer never sees, a server
action that refuses a viewer who calls it anyway, and a role matrix where you
chose what a new role can do instead of inheriting it.
> **Before you start:** A Next.js App Router app with sign-in working and the `bb()` helper from
> [BuildBase on Next.js](/guides/buildbase-on-nextjs), plus workspaces that hold
> more than one person ([multi-tenant workspaces in an
> afternoon](/guides/multi-tenant-workspaces-in-an-afternoon)). Personal mode
> turns [invitations](/guides/team-invitations-nextjs) off, so there is nobody
> to give a role to. `@buildbase/sdk` 0.0.73 or later, which added
> `workspace.can()`. Custom roles and your own permissions are plan limits
> (`max-custom-workspace-roles` and `max-custom-workspace-permissions`); without
> them you still have the three built-in roles and BuildBase's own permissions.
### 1. Start from the three roles, and look at what a new one inherits
Every organization starts with three workspace roles. There is no owner role:
whoever creates a workspace is made its admin, and only they can delete it.
Before you change anything, the roles hold this:
| Role | What it holds by default |
| -------- | ----------------------------------------------------------------------------------- |
| `admin` | Every permission there is, yours included |
| `editor` | View settings, members, features, billing and usage; record usage and spend credits |
| `viewer` | View settings and members |
Someone who joins without being given a role lands on `viewer`. You can pick a
different default, but never `admin`: the server reads a stored default of
`admin` as `viewer`, so admin is only ever handed out on purpose.
The decision hiding in that table is what a role you add starts with. **A
custom role starts as a copy of `editor`**, and `editor` holds
`workspace:usage:record`: record metered usage, spend the workspace's credits.
Add a `contractor` role for someone who should only read reports, assign it
before you open its column, and they can spend the workspace's money.
The irony is that this permission was added to close a gap of exactly this
shape. Before it existed, says the comment above it in our constants, a
`viewer` "could drain a workspace's credits or run up its metered Stripe bill."
So set a new role's column before anyone holds it. Defaults are for the three
roles you did not have to think about.
One more thing to know before you design anything: **there is no permission an
admin lacks.** Admin resolves to every key the organization knows, including
one added after admin's column was last saved, and the console locks its
switches on for that reason. If finance should approve refunds and your admins
should not, the matrix cannot say so. That is a real limit, and it is better
found here than in production. A rule like that belongs in your own code,
against your own list of approvers, not against a role.
What you should see: in the console under **Workspaces > Settings**, a
permission matrix with BuildBase's twelve permissions as rows, your roles as
columns, and the admin column locked on.
### 2. Define your permission in the console, not only in code
Your permission has to exist somewhere the server can read it. That place is
the console.
Add it beside the matrix as a key, a label and an optional group. The key is
what your code compares, so it is strict: lowercase letters, digits and
`. : _ -`, up to 64 characters, with `workspace:`, `buildbase:`, `system:` and
`org:` reserved. We use `app::`, which makes this guide's key
`app:reports:delete`. Grant it to `editor` and leave `viewer` alone. Renaming,
removal and the change history are in the
[permissions docs](https://docs.buildbase.app/permissions/overview).
Here is the trap. `SaaSOSProvider` also takes a `defaultPermissions` prop, and
our own
[checking permissions](https://docs.buildbase.app/permissions/checking-permissions)
page still offers it as the way to add app permissions. A key that lives only
in that prop
resolves in the browser and nowhere else, because the server never reads your
provider props. It knows the keys a matrix grants: the organization's, or a
workspace's saved override. Put `app:reports:delete` in the prop alone and
every editor sees the button, while the server action in step 4 refuses every
one of them. Admins too, the workspace's creator included.
What you should see: an `app:reports:delete` row in the matrix, on for `admin`
(locked) and `editor`, off for `viewer`.
### 3. Hide the button in the browser
This is the convenience half. It spares a viewer a button that could only fail.
```tsx
// app/reports/delete-report-button.tsx
'use client';
import { useState } from 'react';
import { useSaaSWorkspaces, WhenPermission } from '@buildbase/sdk/react';
import { deleteReport } from './actions';
export function DeleteReportButton({ reportId }: { reportId: string }) {
const { currentWorkspace, refreshWorkspaces } = useSaaSWorkspaces();
const [pending, setPending] = useState(false);
const [error, setError] = useState(null);
if (!currentWorkspace) return null;
const workspaceId = currentWorkspace._id;
async function onDelete() {
setPending(true);
setError(null);
const result = await deleteReport(workspaceId, reportId);
setPending(false);
if (!result.ok) {
setError(result.error);
// This tab's copy of the member's role was out of date. Reload it.
await refreshWorkspaces();
}
}
return (
{error &&
{error}
}
);
}
```
`WhenPermission` answers for the current workspace, the one the switcher
shows. The `refreshWorkspaces()` line looks odd until the section after step
4, which is about the moment it runs.
What you should see: signed in as a viewer, no button. As an editor, the button.
### 4. Check again in the server action
This is the step that makes it security. Put the question in one helper, so
every action asks it the same way:
```ts
// lib/permissions.ts
import { bb } from '@/lib/buildbase';
/**
* BuildBase's answer for the signed-in user. False when they are not a
* member; throws when BuildBase cannot answer, so nothing runs on a guess.
*/
export async function can(workspaceId: string, permission: string) {
try {
return await bb().workspace.can(workspaceId, permission);
} catch (err) {
const status = (err as { status?: number }).status;
if (status === 400 || status === 403 || status === 404) return false;
throw err;
}
}
```
```ts
// app/reports/actions.ts
'use server';
import { revalidatePath } from 'next/cache';
import { db } from '@/lib/db'; // your own database client
import { can } from '@/lib/permissions';
export async function deleteReport(workspaceId: string, reportId: string) {
if (!(await can(workspaceId, 'app:reports:delete'))) {
return {
ok: false as const,
error: 'Your role cannot delete reports in this workspace.',
};
}
await db.report.deleteMany({ where: { id: reportId, workspaceId } });
revalidatePath('/reports');
return { ok: true as const };
}
```
`bb().workspace.can()` is one request to BuildBase's `permissions/me`
endpoint, and the answer is the server's own resolution, in the same order the
server checks its own permissions: the workspace's override first, then the
organization's matrix, then the defaults. Non-members get a 403. The helper
turns that into `false` and rethrows a timeout or a 5xx, so the action fails
instead of guessing.
Both arguments came from the browser, so treat both as claims. `can()` settles
whether this user may delete reports in `workspaceId`; the `where` clause
settles that the report is actually in `workspaceId`, and without it an editor
of their own workspace can delete a report in someone else's just by sending
its ID. [Check and query, same workspace](/guides/per-org-data-isolation-nextjs).
What you should see: move the button outside `` for a minute,
sign in as a viewer and click it. The action returns the error and the report
stays. Then put the wrapper back.
Why not `bb().permissions.check(workspaceId, userId, permission)`? It takes a
user ID, so it can answer for any member, which suits an admin screen showing
what a teammate may do. For the signed-in user it is the weaker choice. It fetches the workspace, the
organization's settings and the member list, three requests, and works the
answer out in your process with the SDK's copy of the rules. `workspace.can()`
asks once and gets the server's answer.
A route handler is the same check with a status code:
```ts
// app/api/reports/route.ts
import { db } from '@/lib/db';
import { can } from '@/lib/permissions';
export async function DELETE(request: Request) {
const { workspaceId, reportId } = await request.json();
if (!(await can(workspaceId, 'app:reports:delete'))) {
return Response.json({ error: 'Forbidden' }, { status: 403 });
}
await db.report.deleteMany({ where: { id: reportId, workspaceId } });
return new Response(null, { status: 204 });
}
```
403, never 401. A 401 tells a client the session is gone, a well-behaved client
signs the user out on it, and
[the Express version of this check](/guides/multi-tenant-workspaces-express)
explains why BuildBase's own API stopped answering 401 for membership
failures.
Got a page with a dozen gated controls? Ask once.
`bb().workspace.permissions(workspaceId)` returns
`{ role, isOwner, permissions }`, and a `permissions.includes()` per control
costs nothing.
These snippets typecheck under strict TypeScript against `@buildbase/sdk`
0.0.82 and Next.js 14.2. I have not run them against a live BuildBase API, so
treat them as the shape of the check rather than a transcript.
> **Key takeaway:** `WhenPermission` decides what renders. `can()` inside the action decides what
> happens. BuildBase enforces its own `workspace:` permissions on its own API;
> only your code can enforce yours.
### After a role changes, the browser is the side that is behind
BuildBase's server sees a workspace role change on the next request. The
member's open tab does not see it until the SDK reloads the workspace list.
The server first. The guard behind every workspace permission, and the endpoint
`can()` asks, both look up the member's role in the workspace's membership rows
on each request. Changing a role rewrites that row, with no cache in between.
Matrix edits land the same way. The organization's settings sit in Redis, and
saving them clears that copy along with the public settings route the SDK
reads, which otherwise caches for 5 minutes. A workspace's own override is
stored on the workspace and read per request.
The browser is another story. `usePermissions()` and `WhenPermission` resolve
from the workspace the SDK already loaded, taking the member's role from that
workspace's member list, and nothing tells an open tab its role changed.
Demote someone from `editor` to `viewer` and their tab keeps showing Delete.
They click, `can()` says no, and the `refreshWorkspaces()` call from step 3
reloads the list so the button goes away instead of failing twice.
This is the mirror image of the org-level role, which a session carries.
Changing that one through the console revokes the member's sessions at once,
and only a write that bypasses the change-role route [waits up to an hour for
the session to refresh](/blog/why-permissions-refresh-hourly). A workspace role is not carried in the session at all.
Here the guard is current and the UI lags.
We do not push role changes to open tabs. The server-side check is what makes
that acceptable, since the worst a stale tab can do is show a button that fails
politely. Promotions run the other way. The newly promoted member sees nothing
new until the list reloads, so if roles change often in your product, call
`refreshWorkspaces()` when the window regains focus and pay for one
workspace-list request each time.
PlugNode, one of our own products, runs its team workspaces with RBAC on this
module.
### What breaks, and how you can tell
| What you see | Why, and the fix |
| ----------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| Every editor sees the button and every action refuses, admins too | The key lives only in `defaultPermissions` on `SaaSOSProvider`, which the server never reads. Define it in the console and grant it in the matrix. |
| A role you just added can spend the workspace's credits | A custom role starts as `editor`, and `editor` holds `workspace:usage:record`. Turn it off in the new role's column. |
| A workspace admin cannot see something inside `WhenRoles` | `WhenRoles` checks the org-level role. The workspace role is `WhenWorkspaceRoles`, and a permission check beats both. |
| A demoted member still sees the button | Their tab holds the workspace it loaded. The action refuses them, and `refreshWorkspaces()` brings the UI up to date. |
| A report vanished from a workspace the deleter was not in | The query is missing `workspaceId`. The check and the `where` clause must name the same workspace. |
| The action throws instead of returning an error | BuildBase did not answer. The helper rethrows on purpose, so a timeout never reads as a yes or a no. |
One boundary worth keeping clear. If what you are gating is something the
customer paid for rather than something a person's role allows, that is a plan
question and a different system:
[entitlements are not feature flags](/blog/entitlements-are-not-feature-flags).
### Install
```bash
npm i @buildbase/sdk
```
---
## How to add social login in Next.js
> Google, GitHub, Microsoft and LinkedIn sign-in with no OAuth routes to write. What is left is a decision: what one person becomes when they arrive through two providers.
- Source: https://www.buildbase.app/guides/social-login-nextjs
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-12
### In short
Social login on BuildBase needs no new Next.js code: create an OAuth app at the provider, add it as a login method, register the callback URI the method shows, and tick it on your auth client. Accounts then link by email address, but only when the provider vouches that the address is verified.
Every social login tutorial for Next.js spends its length on plumbing: the
callback route, the token exchange, the provider config, the environment
variables that have to match. On BuildBase you write none of it. Your app keeps
calling the `signIn()` it already calls, and the hosted sign-in page grows a
Google button.
What they skip is the part that bites a month later. Someone
signed up with a password in March. In April they click Google. Same person?
Auth.js, which several of those tutorials build on, says no until you tell it
otherwise. It refuses with `OAuthAccountNotLinked`, and the provider option that
changes its mind is called `allowDangerousEmailAccountLinking`. BuildBase says
yes, on one condition. The setup below is short; most of this guide is about
that condition, because it decides which providers are worth offering at all.
> **Before you start:** A Next.js app already signing in through BuildBase, [wired up as in the
> Next.js setup guide](/guides/buildbase-on-nextjs), with at least one method
> working, so you can tell a provider problem from a wiring problem. You also
> need admin access to each provider's developer console: Google Cloud, GitHub,
> Microsoft Entra or the LinkedIn Developer Portal.
### What you are building
A Google button on your hosted sign-in screen, plus GitHub, Microsoft or
LinkedIn if you want them, with no new code in your Next.js app. When it works,
a user clicks the button, approves at the provider and lands back in your app
signed in. If their address already has an account and the provider vouches
for it, they land in that account rather than a fresh one.
Those four are the ones this guide sets up. BuildBase also has Sign in with
Apple and one OpenID Connect provider of your own, each a login method with a
few fields of its own, alongside email and password, magic link and passkeys.
There is no Facebook or X sign-in, so if your audience expects either, this is
not the guide that gets you there.
### Step one: create the OAuth app at the provider
Each provider hands you a client ID and a client secret. BuildBase needs both
before it will show you the callback URI, so the provider app comes first and
its redirect URI waits until step three.
- **Google.** In the Google Auth Platform, open **Clients**, click **Create
client** and choose **Web application**. Leave the redirect URIs empty for
now.
- **GitHub.** **Settings → Developer settings → OAuth apps → New OAuth App**.
GitHub asks for an **Authorization callback URL** when you register the app,
so put your homepage there as a placeholder. Then create a client secret on the
app's page.
- **Microsoft.** In the Microsoft Entra admin center, **Entra ID → App
registrations → New registration**. Note what you pick under **Supported
account types**, because step two has to agree with it. Copy the
**Application (client) ID**, then go to **Certificates & secrets → Client
secrets → New client secret** and copy the secret's **Value**. Entra never
shows it again.
- **LinkedIn.** Create an app in the LinkedIn Developer Portal and request
**Sign in with LinkedIn using OpenID Connect** on its **Products** tab. The
client ID and secret are on the **Auth** tab.
What you should see: a client ID and a secret for each provider you chose, and
no redirect URI registered anywhere except GitHub's placeholder.
### Step two: add a login method in BuildBase
In the console, open **User Management → Authentication**, go to the **Methods**
tab and click **Add Auth Method**. Pick the provider, paste the client ID and secret, and
save. Microsoft also asks for a tenant: `common` for work and personal accounts,
`organizations` for work and school accounts only, or your own tenant ID. Make it
match the account types you chose in Entra.
The console does not ask about scopes. Each method requests the email address
and a basic profile on its own, which is all sign-in needs.
Saving shows a configuration card with a **Callback / Redirect URI** built from
your organization and this method:
```text
{serverUrl}/api/v1/auth/social/google/{orgId}/{methodId}/callback
```
Copy it off the card rather than typing it. Every character counts in a
redirect check, and the card exists so you never assemble the URI by hand. Edit
the method later and the card is there again.
What you should see: the new method in the Methods list, and a callback URI
containing your org ID and a method ID.
### Step three: register the callback URI at the provider
Paste the card's value into the provider app from step one.
- **Google.** Add it under **Authorized redirect URIs**. For Google, the
BuildBase card also shows an **Authorized JavaScript Origin**; that goes in
the field of the same name. Google says changes to these settings can take 5 minutes to a few hours
to apply, so a `redirect_uri_mismatch` straight after saving can just be
Google catching up.
- **GitHub.** Replace the placeholder callback URL. Replace it, do not add the
new one under it: BuildBase does not send GitHub a `redirect_uri`, and when
that parameter is missing GitHub sends the user to the first callback URL on
the app. GitHub now allows up to 10, which makes it easy to leave the wrong
one in first place.
- **Microsoft.** **Authentication → Add Redirect URI**, choose **Web**, paste.
- **LinkedIn.** On the **Auth** tab, add it to the authorized redirect URLs.
Notice what is missing from all four: your Next.js URL. The provider sends the
user back to BuildBase, and BuildBase sends them on to your app through the
redirect URLs registered on your auth client. So localhost, a preview deploy and
production all share the one callback URI you just pasted. The Next.js-side
causes of `redirect_uri_mismatch` that fill the forums - a wrong base-URL
variable, a trailing slash, `http` behind a proxy - do not apply, because your
app is not in the URI.
### Step four: turn the method on for your auth client
A login method is an organization-wide catalogue entry. The hosted page only
offers the methods ticked on the auth client your app signs in through. Open
**Authentication → Settings**, edit the client whose ID is in your
`SaaSOSProvider`, tick the new method under **Methods**, and save.
Skip this and everything looks configured while the button never appears.
### Step five: sign in from your app
There is no new code. If your app already has a sign-in button, it already
offers Google:
```tsx
'use client';
import { useSaaSAuth } from '@buildbase/sdk/react';
export default function SignInButton() {
const { signIn, isLoading, isAuthenticated } = useSaaSAuth();
if (isLoading || isAuthenticated) return null;
return ;
}
```
`signIn()` takes a return URL and nothing else. There is no
`signInWithGoogle()`, and the SDK has no way to send someone straight to one
provider from your own page; the user picks on the hosted screen. If you wanted a row of
provider logos inside your app, that is what it costs.
What you should see: in a private window, click sign in and the hosted page
shows a Google button. Approve at Google and you are back on `/dashboard` with
`isAuthenticated` true. Two screens can appear in between, and both are
expected: **Trust this device?** when your organization asks about devices, and
a passkey offer when passkeys are on for the client and the user has none yet.
When BuildBase refuses a social sign-in - an unverified address, closed
sign-up, a blocked user - the message appears on that hosted page, not in your
Next.js app. There is no error for your code to catch.
### The decision: one person, two providers
BuildBase matches a social sign-in to an account by the provider's own user ID
first, then by email address, and links by email only when the provider
vouches that the address is verified. In code, the provider's answer has to be
exactly `email_verified === true`.
| The address the provider returns | Provider says verified | Provider does not |
| -------------------------------- | --------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| Already has an account | Signs into that account | Refused: "This email is already registered. Sign in the way you did before, then connect this provider from your account's security settings." |
| Has no account yet | New account, email verified | New account, and the hosted page asks for a 6-digit code first |
Why refuse rather than link? Because the alternative is a takeover. If an
unverified address could link, anyone who got a provider to put your user's
address on an account they control would walk into your user's account with it.
This is the same line Auth.js draws, set at a different default. Its docs say
automatic linking "is not secure between arbitrary providers and is disabled by
default", and suggest turning it on only when you trust the provider has
verified the address. BuildBase makes that call on every sign-in, from the
provider's own claim, so there is no flag with "dangerous" in its name for you
to flip.
Three consequences worth knowing before your users find them:
- **Linking adds a door, it does not remove one.** A password user who signs in
with Google once can still sign in with the password.
- **Two accounts stay two accounts.** A signed-in user can connect a provider
that carries a different address from the Security screen of your app's
settings, but nothing merges two accounts that already exist.
- **The match is on the provider's account ID once it is linked.** Change the
address at Google, or in your app, and the next Google sign-in still finds
the same account.
> **Key takeaway:** A first social sign-in links by verified email and nothing else. So the
> question to ask of a provider is not whether your users have an account there,
> but which address that account will hand you.
#### Where "verified" comes from
| Provider | Counts as verified when |
| --------- | --------------------------------------------------------------------------------------------------- |
| Google | the ID token's `email_verified` is true |
| GitHub | the address is the public profile email or, failing that, the primary address GitHub marks verified |
| Microsoft | it is a personal account, or a work or school account whose ID token carries `xms_edov` |
| LinkedIn | the ID token's `email_verified` is true |
A GitHub user with neither a public email nor a verified primary one is turned
away, since there is no verified address to find or create an account with. LinkedIn
is the soft one: its own docs list `email` and `email_verified` as optional, and
say its sign-in "does not verify user identities and should not be marketed as
such".
#### The Microsoft work-account trap
Microsoft's own claims reference says the `email` claim "isn't guaranteed to be
correct, and is mutable over time". So for work and school accounts BuildBase
does not take the address on its word. It looks for `xms_edov`, which Microsoft
describes as whether "the user's email domain owner has been verified": true
when the address is on a domain the user's tenant has verified.
Entra does not put that claim in the ID token unless you ask. Leave it out and
testing with a fresh account looks fine, apart from a verification-code screen
you will probably wave through. Then a customer who signed up with a password
tries **Microsoft** with the same work address, and gets refused.
The fix is one screen in your app registration: **Token configuration → Add
optional claim**, token type **ID**, tick `email` and `xms_edov`, and **Add**.
Personal Microsoft accounts count as verified without it.
### Which providers to offer
Offer the providers that hand you the address your users already use with you.
Every extra button is one more way for one person to become two accounts.
**B2B tools: Google and Microsoft.** A work address on Google Workspace comes
back from Google, one on Microsoft 365 comes back from Microsoft, and either one
matches [the work address an invitation was sent to](/guides/team-invitations-nextjs). Add the `xms_edov` claim
before launch and these two link cleanly.
**Developer tools: GitHub, with your eyes open.** It is the button developers
expect, but it returns the account's public profile email, or failing that its
primary one. If that is a personal address and the invitation went to a work
one, the sign-in belongs to the personal address: it creates a second account,
or is refused if sign-up is closed, and neither sees the team's workspaces. That
failure has [its own guide](/guides/invited-member-cannot-see-workspace),
because from the outside it looks like the invitation never worked.
**LinkedIn: only if your users already live there.** Recruiting and sales tools,
mostly. By its own documentation it is the weakest of the four at proving an
address, and whenever it leaves out `email_verified`, a user who already has an
account is refused rather than linked.
If what you want is sign-in without a password and without the two-accounts
question, [magic link](/guides/magic-link-login-nextjs) proves the address
directly, because the link is sent to it.
### The failure modes
**The button never shows.** Either the method is not ticked on the auth client
from step four, or two methods for the same provider are ticked. The hosted page
shows one button per provider, built from the first one it finds, so the method
you just fixed may not be the one users are clicking.
**`redirect_uri_mismatch`, or the provider's version of it.** Whatever is
registered at the provider is not what the card shows. Nothing in your Next.js
app moves the card's value, but recreating the method does: delete it and add it
again, and the new method gets a new ID and so a new callback URI. Deleting also
detaches the method from every client, so you would redo step four as well. When only the secret changed, edit the
method instead. Leaving the secret blank on edit keeps the stored one.
**GitHub drops users on your homepage with a code in the URL.** The placeholder
callback URL from step one is still first in the list.
**Microsoft sign-in stops working one morning.** The client secret expired.
Entra caps client secrets at 24 months and recommends under 12, so put the
expiry date in the calendar of whoever owns the console, and paste the new
value into the method before it lapses.
**A bare "Unauthorized" instead of your sign-in page.** BuildBase holds the
state for a social sign-in for 10 minutes and accepts it once. A user who leaves
the consent screen open longer than that, or replays the callback with the back
button, gets a 401 from the API and has to start again.
**New users refused while existing ones sign in fine.** Public sign-up is
closed. Social sign-in obeys that setting: existing accounts get in, new ones
are refused unless they started from an invitation link, as [the
authentication docs](https://docs.buildbase.app/authentication/overview#closing-public-sign-up)
describe. If sign-up is open and new users still see "Signup is not enabled for
this organization", check your plan's end-user limit. A social sign-up counts
against it exactly as a password registration does.
### Related
Sessions behave the same whichever button someone clicked: 30 days by default.
If you turn on [passkeys](/guides/passkeys-nextjs) as well, social login becomes
the on-ramp: after a social sign-in, the hosted pages offer a passkey to anyone
whose browser supports one and who has none yet. And if the redirect comes back
and bounces you straight to sign-in again, that is [the middleware redirect
loop](/guides/nextjs-middleware-redirect-loop-after-login), not a provider
problem.
### Install
```bash
npm i @buildbase/sdk
```
---
## Stale data on screen after a workspace switch
> Stale data after a workspace switch is a cache that never learned the workspace changed. One switch with the Network tab open tells you which cache. The fix is a key, not a purge.
- Source: https://www.buildbase.app/guides/stale-data-after-workspace-switch
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-12
### In short
Stale data after a workspace switch is your cache, not the SDK. switchToWorkspace sets currentWorkspace, saves the id to localStorage and fires workspace:changed. It never touches React Query, SWR or the Next.js Router Cache. Key every query by workspace id, put the workspace in the URL, and nothing needs clearing.
The switcher says the new workspace. The table under it still lists the old
workspace's rows. Click over to another browser tab and back, and the rows fix
themselves.
That last detail is most of the diagnosis. Nothing on the BuildBase side is
stale: `currentWorkspace` changed the moment the switch finished. What is stale
is a cache of yours that never found out, because the one thing it watches is
its key, and its key did not move.
The usual forum answer is to clear everything on switch. It works, in the
sense that rebooting works. Done in the obvious place, it also races the
switch itself. And it leaves the actual defect, a key that does not name the workspace, exactly where it was.
> **Before you start:** An app on the React SDK whose organization is in Platform mode. New
> organizations start in Personal mode (`DEFAULT_WORKSPACE_MODE`), one workspace
> per user and no switcher, so there is nothing to switch and nothing to go
> stale. Browser devtools open on the Network tab. If the workspace is missing
> from the switcher altogether, that is membership, not caching: see [an invited
> member who cannot see the
> workspace](/guides/invited-member-cannot-see-workspace).
### What a switch actually changes
Four things, in this order. I read them out of the SDK's `WorkspaceProvider`
rather than the docs, because the order is what matters later:
1. It marks a switch in progress: `switching` reads true.
2. It awaits your `onWorkspaceChange({ workspace, user, role })` callback, if
you passed one, and if a newer switch started while it was waiting, this one
gives up there and goes no further, which is how a fast double-click ends on
the second workspace rather than the first.
3. It writes the workspace's `_id` to localStorage under
`saas-workspace-current`, and sets `currentWorkspace`.
4. Then `workspace:changed`, carrying `{ workspace, previousWorkspace }`, goes
out through your `handleEvent` callback.
That is the whole list. No page reload, no `router.refresh()`, and no idea your
QueryClient exists. Nor should it. But it means everything your app
fetched for the old workspace is still where you put it, under whatever name
you gave it.
> **Key takeaway:** A switch changes one value your code can see: `currentWorkspace`. A cache
> whose key does not include `currentWorkspace._id` has no reason to fetch
> anything.
The SDK's own subscription and credit providers follow the switch, because
they read `currentWorkspace._id` and refetch when it changes. One caveat before
you go hunting in your own code: if the stale thing is the SDK's own
subscription, quota, credit or invoice data, check your SDK version first. That
was our bug, and the version that fixed it is in the section on late responses
below.
### Switch once with the Network tab open
Filter the Network tab to your own API, clear it, and switch workspace once.
What happens after the click puts you in one of four places:
| After the switch | What is holding the old data |
| ----------------------------------------------- | ----------------------------------------------------------- |
| No request for that screen's data | a key without the workspace id, or the Next.js Router Cache |
| A request with the new id, old rows on screen | placeholder data from the previous key |
| A request with the new id, then old rows return | a late response from the workspace you left |
| A request with the old id | something that ran before the switch finished |
Read the id in the request path or body, not the response. The response
belongs to whoever asked.
### No request at all: the key never named the workspace
This is the common one. A query keyed `['projects']` is the same query in every
workspace, so when `currentWorkspace` changes, TanStack Query sees nothing new
to fetch and keeps serving what it has.
```tsx
// Before: one cache entry shared by every workspace
const { currentWorkspace } = useSaaSWorkspaces();
const projects = useQuery({
queryKey: ['projects'],
queryFn: () => getProjects(currentWorkspace!._id),
});
```
It passes review because the `queryFn` does close over the new id after the
re-render. That does not matter. The library decides whether to fetch from the
key, and the key is identical before and after.
So why does clicking away and back fix it? `refetchOnWindowFocus` is on by
default and refetches stale data on focus, and with the default `staleTime` of
zero, everything is stale. By then the `queryFn` holds the new workspace id,
so the refetch gets it right. SWR does the same through `revalidateOnFocus`,
also on by default. That is why the bug reads as intermittent: anyone who
switches and then tabs away never sees it.
Put the workspace in the key:
```tsx
import { useSaaSWorkspaces } from '@buildbase/sdk/react';
import { useQuery } from '@tanstack/react-query';
import { getProjects } from '@/lib/api'; // your own fetcher
export const keys = {
workspace: (workspaceId: string) => ['workspace', workspaceId] as const,
projects: (workspaceId: string) =>
['workspace', workspaceId, 'projects'] as const,
};
export function useProjects() {
const { currentWorkspace } = useSaaSWorkspaces();
const workspaceId = currentWorkspace?._id ?? '';
return useQuery({
queryKey: keys.projects(workspaceId),
queryFn: () => getProjects(workspaceId),
enabled: workspaceId !== '',
});
}
```
Now each workspace has its own entry. Switching back to one you just left
shows its cached rows at once, which are its rows, and refetches them if they
are stale. Nothing has to be cleared, because nothing is wrong.
In SWR the key is the first argument, and the same fix looks like this, with
the `null` waiting until there is a workspace:
```ts
useSWR(workspaceId ? `/api/workspaces/${workspaceId}/projects` : null, fetcher);
```
A store you fill by hand is no different. A Zustand slice called `projects` is
a cache key with no workspace in it.
### No request, and the page is server-rendered
The current workspace lives in the browser, and the server cannot see it.
The React SDK keeps the id in localStorage. BuildBase's API has no "current
workspace" for a session at all: every workspace route takes the id in its path
(`/api/v1/public/workspaces/:workspaceId/...`), and the server SDK takes
`workspaceId` as the first argument of every call scoped to one workspace. The
session belongs to the user. So a server component that renders workspace data
got its workspace id from somewhere you chose: the URL, or a cookie you set.
If it was a cookie, the Next.js Router Cache is the next suspect. It keeps the
rendered server component payload for routes you already visited, in the
browser. On Next.js 14, a dynamically rendered segment is reused for 30 seconds
and a static one for 5 minutes. Next.js 15 changed the dynamic default to zero,
but shared layouts are still not refetched on navigation, and back and forward
still come from the cache. A sidebar rendered in a layout is exactly the part
that stays behind. It is a cousin of the cached profile page in
[BuildBase on Next.js](/guides/buildbase-on-nextjs): a render that depended on
a cookie, served from a cache that did not know it.
Next.js lists two ways to clear it: `cookies.set` or a revalidate inside a
Server Action, and `router.refresh()`. A cookie written with `document.cookie`
is on neither list. So if your server reads a workspace cookie, write it in
`onWorkspaceChange`, which is what a before-hook is for, and refresh after the
switch lands:
```tsx
// app/providers.tsx
'use client';
import { useMemo } from 'react';
import { useRouter } from 'next/navigation';
import {
ApiVersion,
SaaSOSProvider,
SDKEvent,
type EventData,
type EventType,
type WorkspaceChangedEventData,
} from '@buildbase/sdk/react';
// The three callbacks from the Next.js setup guide, moved to module level.
import { getSession, handleAuthentication, onSignOut } from './auth-callbacks';
export function Providers({ children }: { children: React.ReactNode }) {
const router = useRouter();
const auth = useMemo(
() => ({
clientId: process.env.NEXT_PUBLIC_BUILDBASE_CLIENT_ID!,
redirectUrl: process.env.NEXT_PUBLIC_BUILDBASE_REDIRECT_URL!,
callbacks: {
getSession,
handleAuthentication,
onSignOut,
// onWorkspaceChange: write your workspace cookie here, before the switch.
handleEvent: (eventType: EventType, data: EventData) => {
if (eventType !== SDKEvent.WorkspaceChanged) return;
const { workspace, previousWorkspace } =
data as WorkspaceChangedEventData;
// Page load restores the saved workspace with no previous one.
if (!previousWorkspace || previousWorkspace._id === workspace._id) {
return;
}
router.refresh();
},
},
}),
[router]
);
return (
{children}
);
}
```
Keep `auth` memoized. The provider rebuilds its callback config whenever one
of those functions changes identity, and an inline object hands it new ones on
every render.
I wrote this against the SDK's type definitions and its provider source, not
in a running app, so treat it as the shape of the fix rather than a tested
file.
The better fix is not to need it. [Put the workspace in the URL](/guides/per-org-data-isolation-nextjs), as
`/w/[workspaceId]/projects`, and each workspace is a different route: the
Router Cache cannot serve one workspace's payload for another, server
components read the id from `params`, and a pasted link opens the right
workspace. The URL becomes the source of truth and the SDK follows it, through
one small component that calls `switchToWorkspace` when the workspace in the URL
is not `currentWorkspace`. Our own console runs the same pattern keyed on the
org in its session rather than a URL: a `WorkspaceAutoSelector` that switches
the SDK to the workspace that org needs. The full argument, membership check
included, is in [multi-tenant Remix](/guides/multi-tenant-workspaces-remix),
and only the routing differs in Next.js.
#### Two tabs, one remembered workspace
`saas-workspace-current` is one localStorage key per origin. Every tab shares
it, and the SDK writes it without watching it. Switch in tab B, and tab A's
switcher goes on showing A, correctly, until tab A reloads and restores B.
A workspace cookie makes it arrive sooner. Tab A's next server render carries
B's cookie while its switcher still says A. When the switcher and the page
under it disagree about which workspace you are in, look here first. A URL
holds one workspace per tab, which is the other reason it wins.
### A request for the new workspace, but the old rows stay
The key changed, the request went out, and the old workspace's rows are still
on screen until it lands. That is placeholder data doing its job on the wrong
key.
`placeholderData: keepPreviousData` in TanStack Query v5, or
`keepPreviousData: true` in v4, keeps the data from the last successful fetch
on screen while a query with a new key loads. On a page number that is the
feature. On a workspace id it renders one workspace's rows under another
workspace's name. SWR's `keepPreviousData: true` does the same: it returns the
previous key's data until the new data has loaded.
Keep the smoothing inside a workspace and drop it across one:
```ts
useQuery({
queryKey: keys.projects(workspaceId),
queryFn: () => getProjects(workspaceId),
placeholderData: (previousData, previousQuery) =>
previousQuery?.queryKey[1] === workspaceId ? previousData : undefined,
});
```
`isPlaceholderData` tells you which you are looking at, if you would rather dim
the table than blank it.
### A request for the new workspace, then the old rows come back
This one only shows up on fast switches or a slow network, which is why it
survives testing. Throttle the Network tab to a slow preset and switch twice in
quick succession to reproduce it.
Hand-rolled fetching in a `useEffect` has a race the libraries handle for you.
Switch from A to B, A's request is the slower one, it lands second, and the last
`setState` wins. React's own docs name it plainly: network responses may arrive
in a different order than you sent them.
We shipped this one. Until SDK 0.0.54, released on 2026-07-10, fifteen of the
SDK's own read hooks, `useSubscription`, `useAllQuotaUsage`, `useCreditBalance`,
`useInvoices` and the rest, could render the previous workspace's subscription,
quotas, credits or invoices after a switch. If those are what you see, upgrade
before reading further.
The fix inside the SDK is the one you want in your own code. A newer request
aborts the one it supersedes, and a response to an aborted request is dropped.
`useSubscription` also remembers which workspace its data was fetched for, and
returns `null` with `loading: true` while that is not the workspace it was
asked about. In your own effect:
```tsx
import { useEffect, useState } from 'react';
import { useSaaSWorkspaces } from '@buildbase/sdk/react';
import { getProjects, type Project } from '@/lib/api'; // your own fetcher
export function useProjectsByHand() {
const { currentWorkspace } = useSaaSWorkspaces();
const workspaceId = currentWorkspace?._id;
const [data, setData] = useState<{
workspaceId: string;
rows: Project[];
} | null>(null);
const [error, setError] = useState(null);
useEffect(() => {
if (!workspaceId) return;
const controller = new AbortController();
setError(null);
getProjects(workspaceId, { signal: controller.signal })
.then((rows) => setData({ workspaceId, rows }))
.catch((err) => {
// An aborted request belonged to a workspace we left. Anything else is real.
if (!controller.signal.aborted) setError(err);
});
return () => controller.abort();
}, [workspaceId]);
// Data tagged with another workspace is treated as no data at all.
const rows =
workspaceId && data?.workspaceId === workspaceId ? data.rows : null;
return { rows, error };
}
```
Tagging the data with its workspace id is the half people skip. The abort
stops a late response from landing; the tag stops the previous workspace's rows
from rendering in the gap before the new ones arrive.
### A request for the old workspace, after the switch
Something ran before the switch finished. Usually that is a purge inside
`onWorkspaceChange`, because that callback runs before the switch, not after
it. The SDK awaits it and only then sets `currentWorkspace`, so anything you
trigger in there that reads the current workspace reads the one being left.
The common version is `queryClient.invalidateQueries()` in
`onWorkspaceChange`. Invalidation refetches active queries by default, and the
active queries are the old workspace's, mounted on a screen that has not
re-rendered yet. With an unkeyed `['projects']`, that is worse than a wasted
request. It refills the shared entry with the old workspace's rows, freshly
fetched, right before the switch lands. Then the key does not change, so
nothing asks again until the window regains focus.
Three more things about that callback are easy to miss. [The
docs](https://docs.buildbase.app/workspaces/workspace-switcher) say it also
fires on page load, when the saved workspace is restored from storage. Before
SDK 0.0.55, released on 2026-07-14, it fired once per mounted
`useSaaSWorkspaces()` rather than once per switch, so an app with the hook in
several components ran its purge several times. And `setCurrentWorkspace`
skips it entirely, since its type documentation calls it direct, with no
callback, while still firing `workspace:changed`.
So keep `onWorkspaceChange` for what its type says it is for: work that must
finish before the switch, such as minting a token or saving state, and that may
veto it by rejecting. React to a switch on `workspace:changed`, which fires
after `currentWorkspace` is set, carries `previousWorkspace`, and comes through
`handleEvent`, as in the provider above. Skip the event when `previousWorkspace`
is missing; that is a page load, not a switch. The SDK's own analytics make the
same cut, and only report `workspace_switched` when both ids are present and
differ.
The other source of old-workspace requests is the SDK restoring the remembered
workspace before your app has picked the one it wants. Our own console bills
through BuildBase and hit exactly this. After an org switch the remembered
`saas-workspace-current` still named the previous org's workspace, so the SDK
selected it, every workspace-keyed provider fetched subscription, credits and
usage for it, and then the console's own selection landed and all of it was
fetched again. The fix was to write the right id into that key before the SDK
reads it. The comment beside that code records the difference in a HAR as seven
subscription reads becoming one per workspace.
Note why that comment counts requests rather than wrong rows. Every one of those
providers was keyed by workspace id, so when the right selection landed they
fetched under a new key instead of serving the old one. That is the argument of
this page in one incident. With the workspace in the key, a switch at the wrong
moment costs you a round trip. Without it, it costs you the right rows.
If you are still designing the workspace model rather than debugging it,
[multi-tenant workspaces in an
afternoon](/guides/multi-tenant-workspaces-in-an-afternoon) makes the case for
the workspace as the unit that owns data. Keying every cache by it is the same
decision, made on the client.
### Install
```bash
npm i @buildbase/sdk
```
---
## How to add team invitations in Next.js, and decide when the seat starts billing
> Team invitations in Next.js: a pending invite holds a seat from the moment it is sent. Why that is the right default, and what it does to the invoice at renewal.
- Source: https://www.buildbase.app/guides/team-invitations-nextjs
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-12
### In short
In BuildBase, a team invitation takes a seat when the email is sent, not when it is accepted, and holds it until it is accepted, declined, revoked or lapses at 14 days. Past a plan's included seats, an invitation pending at renewal is billed for the new period, and its credit for unused time lands on a later invoice.
Sending a team invitation is one function call. The decision behind it is not
in the call: does the invited person start costing the workspace a seat when
the email goes out, or when they click accept?
BuildBase takes the seat at send. A pending invitation holds it until it is
accepted, declined, revoked or expires, and once a [seat-priced workspace](/blog/metered-vs-seat-based-billing) is
past its included seats, that seat is billed. Most of this guide falls out of
that one rule, including the part almost nobody thinks about until a customer
asks why their annual invoice has a seat for someone who never joined.
> **Before you start:** A Next.js app with the BuildBase session wired through, which is [BuildBase on
> Next.js](/guides/buildbase-on-nextjs), and workspaces from [multi-tenant
> workspaces in an afternoon](/guides/multi-tenant-workspaces-in-an-afternoon).
> For anything about money, a plan with seat pricing. Invitations need
> `@buildbase/sdk` 0.0.71 or later, a server from release 22, and an email
> sender configured for the organization: without one, the invite route refuses
> with 503 before it writes anything.
### When does an invitation take a seat?
When the email is sent. The server's seat count is active members plus live
pending invitations, where live means unanswered and inside its 14 days. Every
check and every bill reads that one count. The plan's member cap reads it, and
so do the trial cap and the workspace settings' `maxWorkspaceUsers` ceiling.
So does the Stripe seat quantity, on every path that sets it: checkout, a
plan change, a member added or removed, and every invitation sent, declined,
revoked or expired.
> **Key takeaway:** A pending invitation is a seat. It counts against the cap before the invitee
> has opened the email, and once a seat-priced plan is past its included seats,
> it is on the bill as well.
Here is how a pending seat ends:
| What happens to the invitation | What happens to the seat |
| ------------------------------ | ------------------------------------------------- |
| Accepted | The new member takes it over; the count stays put |
| Declined | Released |
| Revoked | Released at once |
| 14 days pass with no answer | Released by a sweep that runs every ten minutes |
Two details from the server are worth knowing before you build on it. If the
invitation email cannot be queued, the server deletes the row and answers 502
rather than leave a pending seat behind, because a seat for a mail nobody
received is a wrong bill. And resending is not free. A resend mints a new link
and sets the expiry to 14 days from now, so an invitation resent every
fortnight holds its seat for as long as someone keeps clicking Resend.
We made this call in September, while building workspace invitations, and the
console's own organization invitations make a useful contrast. Those rows cost
nothing, so nothing sweeps them: an expired one keeps the status `invited` in
the database until someone tries to use it. An invitation inside your app bills, so it got a
sweeper, an inline expiry when someone accepts too late, and a row that refuses
to exist without its email.
### Why send-time is the one you want
Because the cap has to count pending invitations, and once it does, billing on
accept would leave the cap and the invoice counting two different things.
Start with the cap, and suppose it ignored pending invitations. An admin on a
workspace capped at three seats, with two members, invites five people. All
five sends go through. The first to accept takes the last seat, and the other
four follow a link from a team they were told to join and land on "This
workspace has reached its member limit. Ask an admin to make room." The person
who hits that wall has the least context and no power to fix it.
Counting pending invitations moves the refusal to where it belongs. With
BuildBase the admin's second invitation answers 402, with the count and the
limit on it, while the admin is still at the keyboard.
So the cap counts them. Should the bill? If it does not, an admin sees a full
workspace on the team page and a smaller seat count on the invoice, and
somebody gets to explain why the workspace was full of seats it was not paying
for. One count, read by the cap and by Stripe, is the only version where the
seat count the admin sees and the seat count on the invoice move together.
The other answer is defensible, though. [Makerkit's per-seat billing
docs](https://makerkit.dev/docs/nextjs-prisma/billing/per-seat-billing)
recommend updating the seat quantity only when an invitation is accepted, "to
avoid billing for users who never join", while its [seat
enforcement](https://makerkit.dev/docs/nextjs-prisma/billing/seat-enforcement)
still counts pending invitations against the limit. If your admins routinely invite
people who never turn up, that split costs them less. BuildBase does not offer
it. There is one count and no setting to leave pending invitations out of the
bill, so if accept-time billing is a hard requirement, that is a real gap.
Two things soften it. `addUser` makes someone who already has an account a
member at once: no pending row, no pending seat, nothing to expire. It answers
404 for an address with no account, which is the job `inviteMember` exists
for. And billable seats are members plus pending invitations minus the plan's
included seats, never below zero, so a pending invitation inside the included
allowance costs nothing.
### Step 1: ship the members screen, if it is enough
The SDK's members screen already does the whole job: invite by email with a
role, the pending list under the form with Resend and Revoke, and a seat block
that counts pending invitations and says so.
```tsx
'use client';
import { useSaaSAuth } from '@buildbase/sdk/react';
export function TeamButton() {
const { openWorkspaceSettings } = useSaaSAuth();
return (
);
}
```
Click it and the members screen opens on the current workspace, with the
invite form and any pending invitations listed under it. If that screen is all your product needs, skip to the renewal
section. The [invitations reference](https://docs.buildbase.app/workspaces/invitations)
covers the invitee's side, including sign-up for someone with no account.
### Step 2: make your own seat count agree with the server
The trap in a custom team page is one missing argument. `useSeatStatus(workspace)`
counts the members on `workspace.users` and nothing else. Pending invitations
are an option you pass, and the SDK's own members screen passes them. Leave it
out and a workspace with three members and two pending invitations shows room
for two more on a five-seat cap, while the server counts five and refuses the
next invite.
```tsx
// app/team/invite-members.tsx
'use client';
import { useState } from 'react';
import type { IWorkspace } from '@buildbase/sdk/react';
import {
isInvitationError,
useSaaSWorkspaces,
useSeatStatus,
useWorkspaceInvitations,
} from '@buildbase/sdk/react';
export function InviteMembers({ workspace }: { workspace: IWorkspace }) {
const { inviteMember } = useSaaSWorkspaces();
// One instance for the count and the form. Each call to the hook keeps its
// own list, so a second instance would not see the row you just created.
const { pendingCount, refresh } = useWorkspaceInvitations(workspace._id);
const { memberCount, canInvite } = useSeatStatus(workspace, {
pendingInvitations: pendingCount,
});
const [email, setEmail] = useState('');
const [sending, setSending] = useState(false);
const [notice, setNotice] = useState(null);
async function send() {
setSending(true);
setNotice(null);
try {
await inviteMember(workspace._id, email, 'editor');
await refresh(); // the new row holds a seat now, not on accept
setNotice(`Invitation sent to ${email}`);
setEmail('');
} catch (err) {
if (isInvitationError(err) && err.code === 'SEAT_LIMIT_REACHED') {
setNotice(
`No seats left: ${err.currentUserCount} of ${err.limit} in use, counting pending invitations.`
);
} else {
setNotice(
err instanceof Error ? err.message : 'Could not send the invitation.'
);
}
} finally {
setSending(false);
}
}
return (
{memberCount} seats in use, {pendingCount} of them pending
}
);
}
```
What you should see: the count goes up by one the moment the invitation is
sent, before anyone has opened the email.
Why handle the 402 when `canInvite` already disables the button? Because the
hook is display state, and two admins can be looking at the same last seat.
The refusal carries `currentUserCount` and `limit`, both counting pending
invitations, so the message can say something specific. When the button is
disabled for a reason other than a full workspace, [charging per
seat](/guides/charge-per-seat-nextjs) covers what to offer for each one.
From a server action or a route handler, the same invitation is
`bb().invitations.create(workspaceId, email, role)` on the server client from
[the Next.js setup](/guides/buildbase-on-nextjs). It runs as the signed-in
user, so [the same permission check](/guides/roles-and-permissions-per-workspace-nextjs) and the same seat count apply.
### What happens to a pending invitation at renewal?
It is on the renewal invoice, if the workspace is past its included seats.
Nothing in BuildBase recomputes seats at the period boundary: Stripe renews the
seat line at whatever quantity it holds, and that quantity includes every
invitation still live at that moment.
If the invitee then accepts, the charge was right all along. If the invitation
is declined, revoked or expires instead, the quantity drops with a proration,
and [Stripe's own docs](https://docs.stripe.com/billing/subscriptions/prorations)
are blunt about what that means: "Negative prorations aren't automatically
refunded". The credit for the unused time waits for a later invoice.
How much that matters comes down to the billing interval:
- **Monthly.** The renewal charges a month of the seat, and the unused part
comes back as a credit on the next monthly invoice. Small, and I would leave
it alone.
- **Yearly.** The renewal charges a year of the seat. If the invitation lapses
two weeks later, the credit for the rest of the year rides on the next invoice
the subscription produces, which can be the next renewal. That is the invoice
that turns into a support ticket. Quarterly is the same shape, smaller.
Which invitations can this catch? Only ones sent, or resent, in the 14 days
before the renewal date, because nothing older is still live. That makes the
check cheap: an invitation whose `validTill` falls after the period end will
still be pending when the period rolls over, unless somebody answers it first.
### Step 3: show admins what renewal will bill
Do not auto-revoke. An invitation sent yesterday to a new hire is the one most
likely to be accepted, and revoking it to dodge a prorated seat swaps a credit
for a confused new hire. Show the admin instead, on plans billed less often
than monthly, and put Revoke next to each row.
```tsx
// app/team/renewal-notice.tsx
'use client';
import type { IWorkspace } from '@buildbase/sdk/react';
import {
useSeatStatus,
useSubscription,
useWorkspaceInvitations,
} from '@buildbase/sdk/react';
export function RenewalInviteNotice({ workspace }: { workspace: IWorkspace }) {
const { subscription } = useSubscription(workspace._id);
const { invitations, pendingCount, revoke, busy, error } =
useWorkspaceInvitations(workspace._id);
const { billableSeats } = useSeatStatus(workspace, {
pendingInvitations: pendingCount,
});
const sub = subscription?.subscription;
if (!sub?.stripeCurrentPeriodEnd || sub.billingInterval === 'monthly') {
return null;
}
// Inside the plan's included seats, a pending invitation costs nothing.
if (billableSeats === 0) return null;
const renewsAt = new Date(sub.stripeCurrentPeriodEnd);
const billedAtRenewal = invitations.filter(
(i) =>
i.status === 'invited' &&
i.validTill !== null &&
new Date(i.validTill) > renewsAt
);
if (billedAtRenewal.length === 0) return null;
return (
);
}
```
What you should see: nothing, for most of the year. The notice can only appear
in the last 14 days before a quarterly or yearly renewal, since no live
invitation's clock runs further out than that, and then it lists exactly the
invitations that will be on the invoice if nobody answers them.
I have not run these components against a live server while writing this. They
use hooks and types the SDK exports from 0.0.71 on, and the seat wiring in step
2 is the same one the SDK's own members screen uses.
### What breaks, and how to tell
**The badge says there is room and the invite answers 402.** `useSeatStatus`
was called without `pendingInvitations`. The server counted the pending rows;
your page did not.
**The invite answers 502 and nothing shows as pending.** The email could not
be queued, so the server deleted the row rather than bill a seat for it. With
no sender configured at all, the answer is 503 `NO_SENDER_CONFIGURED`, before
anything is written. Set a sender up under Emails in the console first.
**Bulk invites stop with a 429.** A workspace can send sixty invitations an
hour, and an organization two hundred invitation emails a day by default. Resending one
invitation has a five-minute cooldown, and that refusal carries
`retryAfterSeconds` so a button can count down instead of guessing.
**A trial workspace on a seat-priced plan cannot invite past its included seats.** During a trial
the cap is the plan's included seats, pending invitations counted, and the
refusal says so: "Trial includes 3 seats. Subscribe to add more members." for a
plan that includes three.
**An invitation that never stops billing.** Someone keeps clicking Resend.
Every resend restarts the 14 days, and the seat with them.
**A plan change moves the seat line too.** It recomputes billable seats against
the new plan's included allowance, pending invitations counted, which is part
of [what a plan change does to the invoice](/guides/proration-on-plan-change-nextjs).
**The person you invited says it is not there.** Check the address first. The
invitation belongs to the address it was sent to, and accepting from a
different account is refused with the invited address scrambled in the error.
The [errors section of the invitations
reference](https://docs.buildbase.app/workspaces/invitations#errors) lists
every refusal and what it means.
### Install
```bash
npm i @buildbase/sdk
```
---
## Transactional email landing in spam
> Transactional email in spam is a verdict the receiving server already wrote into the header. How to read it, and five causes to check in the order that settles fastest.
- Source: https://www.buildbase.app/guides/transactional-email-landing-in-spam
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-12
### In short
Read the Authentication-Results header on the copy in spam before touching DNS. SPF or DKIM failing points at your records. DMARC failing while both pass means the From domain is not the one that was checked. All three passing means links or reputation. On BuildBase, first check which sender is the system default.
The receiving server has already told you why your sign-in email went to spam.
It wrote the reason into the message, in a header almost nobody opens. And then
the debugging starts somewhere else: a DNS record changed on a hunch, or a
ticket to the email provider.
A marketing email in spam costs an open. A
[magic link](/guides/magic-link-login-nextjs) in spam costs the sign-in, and the
user decides your product is broken.
So read the header first. Then work down the five causes below and stop at the
first one that is wrong. They are ordered by how fast each one settles, not by
how often it is the answer, and the first two live in how BuildBase picks a
sender and reports a domain. No generic deliverability checklist can find those
for you.
> **Before you start:** One copy of the message that actually landed in spam, ideally in a Gmail
> mailbox you control, plus console access to **Messaging → Sender Accounts**
> and the sending domain. If nobody kept a copy, make one: request a magic link
> or a password reset to that mailbox.
### First, is it in spam at all?
"I never got the email" is two different bugs, and only one of them is about
spam. Find the recipient in email history before you open a DNS panel.
A `skipped` row means the message never left. No usable sender, a missing
template, a blocked or unsubscribed address, an address marked invalid after a
bounce: each one is written on the row as the reason. A `sent` row means your provider accepted the
message, and that is the last thing we can see. Where it went next, only the
receiving server knows. The
[invitation troubleshooting guide](/guides/invited-member-cannot-see-workspace)
walks through the skip reasons. This post starts where `sent` ends.
### Read the verdict before you change anything
The receiving server records its checks in an `Authentication-Results` header,
the format [RFC 8601](https://www.rfc-editor.org/rfc/rfc8601) defines. In
Gmail, open the message, click **More** next to Reply, and choose **Show
original**
([Google's steps](https://support.google.com/mail/answer/29436)). Trimmed, with
placeholder domains, the line you want looks like this:
```text
Authentication-Results: mx.google.com;
dkim=pass header.i=@mail.example.com;
spf=pass smtp.mailfrom=mail.example.com;
dmarc=fail header.from=example.org
```
Two passes and a fail. Both checks passed, for `mail.example.com`. The From
header said `example.org`. DMARC asks whether at least one passing check belongs
to a domain aligned with the From domain
([RFC 7489, section 4.2](https://www.rfc-editor.org/rfc/rfc7489#section-4.2)),
and here neither does. Gmail surfaces the same failure more bluntly: a question
mark next to the sender's name means the message
[is not authenticated](https://support.google.com/mail/answer/180707).
| The header says | It means | Go to |
| ----------------------------------------------------- | ----------------------------------------------- | ------- |
| the passing domain is `gmail.com` or your SMTP host's | a different sender sent it | cause 1 |
| `spf=fail`, `dkim=fail`, or no DKIM result at all | the records are missing, wrong, or not live yet | cause 2 |
| `spf=pass` and `dkim=pass`, but `dmarc=fail` | something passed, but not for your From domain | cause 3 |
| all three pass, for your own domain | the message, its links, or the sending history | 4 and 5 |
### 1. Find out which sender actually sent it
This is the cause a generic checklist cannot find, because it lives in how we
pick a sender.
System mail does not name one. The magic link, the verification code, the
password reset code and the workspace invitation all go through whichever single
sender in the org is flagged `systemDefault: true`. Which one is that? Usually
the first sender anyone created. Every way of creating a sender, Mailgun, SMTP
or Google, ends by calling `updateDefaultSender`, and that function only fills
an empty default. It never moves one.
Here is how that plays out. Someone connects their own Google account during
setup to check that email works. It does. Weeks later someone else adds
`mail.example.com`, verifies it, creates a Mailgun sender on it and moves on.
Every sign-in link since then has gone out through Gmail, from the address of
the person who clicked connect first. A Google sender's From is the account's
own address. Your verified domain never touched those messages, and every DNS
record you fix will change nothing.
Two places to check. The email history row stores the `from` it used and the
sender it went through. `GET /api/emails/senders` returns each sender with its
`systemDefault` flag, but only the senders you own or that were shared with
you. The default can easily be someone else's, and missing from your list. An
org owner or admin can add `filter[all]=true` to list every sender in the org.
The fix is to move the default to the sender on your verified domain. That
sender's owner can do it, and so can an org owner or admin:
```bash
curl -X PATCH https://api.console.buildbase.app/api/emails/senders/$SENDER_ID/default \
-H "Authorization: $BUILDBASE_TOKEN"
```
Do it before you clean up. The delete route refuses the system default, so the
old sender cannot be removed until another one holds the flag.
### 2. Check the domain is verified, not that verify returned 200
Adding a domain hands back the DNS records to publish, which come straight from
Mailgun. The table below is the sending set from a real stored response, with
the domain swapped for a placeholder:
| Type | Name | Value | What it is |
| ----- | ---------------------------------------- | --------------------------------- | ---------------------- |
| TXT | `mail.example.com` | `v=spf1 include:mailgun.org ~all` | SPF |
| TXT | `._domainkey.mail.example.com` | `k=rsa; p=...` | DKIM public key |
| CNAME | `email.mail.example.com` | `mailgun.org` | Mailgun tracking CNAME |
MX records come back as a separate set, and you need them only if the domain
should receive mail. The
[sending domains docs](https://docs.buildbase.app/email/sending-domains) cover
adding and verifying.
Now the part that matters. Verification is
`POST /api/emails/domains/:id/verify`, which asks Mailgun to re-check DNS. Our
docs say a record that has not propagated comes back as a 400. The code never reads
the DNS result: the route returns 400 when the call to Mailgun fails, and treats
any 200 from Mailgun as success. And Mailgun's
[own reference example](https://documentation.mailgun.com/docs/mailgun/api-reference/send/mailgun/domains/put-v4-domains--name--verify)
for that call is a 200 whose body reads, trimmed:
```json
{
"message": "Domain DNS records have been updated",
"domain": { "name": "example.com", "state": "unverified" }
}
```
So a 200 from us is not proof, and neither is the `email.domain_verified` event
that fires after it. Read `state` on the domain document the call returns. A
working domain reads `active`. Then read `valid` on each entry in
`sendingDnsRecords`: any entry where it does not say `valid` is the record
Mailgun could not find.
One gate does read `state`. A Mailgun sender cannot be created on a domain whose
state is `unverified`; the route refuses with `Domain is unverified`. It checks
once, at creation.
If a record reads invalid and propagation is not the explanation, rule out the
two SPF mistakes that look fine in a DNS panel. A second `v=spf1` record at the
same name is a permanent error
([RFC 7208, section 4.5](https://www.rfc-editor.org/rfc/rfc7208#section-4.5)),
so if one already exists, add `include:mailgun.org` to it rather than publishing
another. More than 10 DNS lookups while evaluating it, nested includes counted,
is a permanent error too
([section 4.6.4](https://www.rfc-editor.org/rfc/rfc7208#section-4.6.4)). Then
ask DNS directly what it serves:
```bash
dig +short TXT mail.example.com
dig +short TXT ._domainkey.mail.example.com
dig +short TXT _dmarc.example.com
```
### 3. DMARC is the record nobody hands you
Look at that table again. No DMARC record. Mailgun's reference describes its
verify call as checking A, CNAME, SPF, DKIM and MX records, so a domain can
verify cleanly with no DMARC record anywhere. You publish it yourself.
Does a transactional sender need it? Google
[requires DMARC](https://support.google.com/a/answer/81126) from anyone sending
more than 5,000 messages a day to personal Gmail accounts, accepts a policy of
`p=none`, and requires the From domain to be aligned with either the SPF domain
or the DKIM domain. Yahoo's
[sender requirements](https://senders.yahooinc.com/best-practices/) ask bulk
senders for a DMARC policy of at least `p=none` and say DMARC must pass. Neither
page sets a separate rule for transactional mail. Below that volume Google asks
every sender for SPF or DKIM, not DMARC.
I would publish it at any volume. It is one TXT record, and at `p=none` it asks
receivers to change nothing, while the aggregate reports from the receivers
that send them show you who is mailing as your domain:
```text
_dmarc.example.com. TXT "v=DMARC1; p=none; rua=mailto:dmarc-reports@example.com"
```
One record on the apex covers `mail.example.com` as well. A receiver that finds
nothing at the subdomain falls back to the organizational domain
([RFC 7489, section 6.6.3](https://www.rfc-editor.org/rfc/rfc7489#section-6.6.3)),
and with no `sp` tag the `p` policy applies to subdomains.
Alignment is where the three kinds of sender differ:
- **Mailgun.** The From is built from the verified domain when the sender is
created, so it starts aligned. It does not have to stay that way.
`PATCH /api/emails/senders/:id` accepts a new `from` and validates only that
it is an address. Nothing compares its domain with the one Mailgun verified.
- **Custom SMTP.** The From is whatever was typed. Saving the sender checks, by
default, that the credentials connect. It proves nothing about whether your SMTP provider signs
for that domain, which is set up at the provider, not with us.
- **Google.** Mail goes out through Gmail as the connected account, from that
account's address. Good for a test. Not your domain.
Relaxed alignment is the default
([section 6.3](https://www.rfc-editor.org/rfc/rfc7489#section-6.3)) and only
needs the organizational domains to match, so a DKIM signature for
`mail.example.com` aligns with a From of `hello@example.com`. That is why the
`mail.` subdomain the docs suggest costs you nothing at this step.
### 4. Every link points at our host, not yours
This is the cause you cannot fix from your side today, and I would rather you
heard it from us.
Every message BuildBase sends, the magic link included, goes through a tracking
rewrite on its way to the transport. The one exception is the sender test
described below. Each `href` in the HTML part and each bare URL in the text
part becomes `/api/mail-track/link/`, and a
hidden 1x1 image from `/api/mail-track/blank-image/` is
appended to the body. A unit test, `email-send-funnel.test.ts`, asserts that
exactly one file hands mail to a transport, so no send path skips the rewrite.
Your plan does not change it either. On a plan without open and click analytics
the pixel still loads and the redirect still runs. Only the analytics row goes
unwritten.
`SERVER_URL` is the tenant server's public address. On the managed service that
is a `buildbase.app` host, and our own engineering notes say it plainly:
customer link reputation lands directly on a `buildbase.app` host. Receivers do
look at the domains inside a message. Spamhaus publishes a
[domain blocklist](https://www.spamhaus.org/blocklists/domain-blocklist/) meant
to be checked against "domains appearing in the mail headers and body e.g.,
URLs". So part of the verdict on your sign-in email is about a domain that is
not yours and cannot be changed from the console.
Per-org tracking domains are not built, and there is no setting that turns the
rewrite off.
Two things you can do about it.
**Isolate it.** The console's **Send test email** is the one message that
deliberately carries no tracking: no pixel, no rewritten links, no unsubscribe
header. It always goes to your own account's address, so run the comparison
there. Send a test through the system-default sender, then request a real magic
link to the same address. If the test reaches the inbox and the sign-in email
does not, from the same sender, your DNS is fine. The difference is in the
message.
**Self-host.** On a self-hosted install `SERVER_URL` is your own host, so the
links can sit under your own domain.
### 5. When all three pass: history, then content
SPF, DKIM and DMARC all pass for your own domain, and the right sender sent
it. What is left has no header of its own: the domain's sending history, and
the message itself. The test split from cause 4 tells you which: if both copies
land in spam, look at history, and if only the real sign-in email does, look at
the message.
History first. A domain you added last week has none for a
receiver to go on. Gmail's
[Postmaster Tools](https://postmaster.google.com/) reports the spam rate it
measured for your domain, and Google
[asks every sender](https://support.google.com/a/answer/81126) to keep it below
0.3%. Keep sign-in mail on its own subdomain, so a campaign that draws
complaints cannot drag your magic links down with it.
That is how our own platform mail is set up. Organization invitations go out
from `noreply@mail.buildbase.app`, on the `mail.` subdomain on purpose: it is the
domain the relay signs for, so it is the domain DKIM aligns with, and keeping
transactional mail off the root domain means an invitation cannot damage the
reputation the marketing site sends from, or the other way round. Replies go to
whoever sent the invitation, through Reply-To, so the recipient always has a
person to answer.
Content goes last because nothing in the header points at it, so the only way
to test it is by changing it. Google's sender guidelines say links "should be
visible and easy to understand", and that recipients "should know what to
expect when they click a link". The default magic-link template is a few short
lines and one link labelled **Sign in**. If yours has grown into a newsletter, put the
default back for a day and see where it lands.
### Install
```bash
npm i @buildbase/sdk
```
---
## Usage counts that do not match the invoice
> Usage does not match the invoice? The invoice bills overage blocks for a period that already closed. How to reconcile the two, fastest check first.
- Source: https://www.buildbase.app/guides/usage-does-not-match-invoice
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-10-12
- Updated: 2026-10-22
### In short
A usage counter and an invoice are not meant to agree. The counter holds every unit since the last monthly reset. The invoice bills only units past the included amount, rounded up to whole blocks, for a Stripe period that has already closed. Check that arithmetic first, then which period each number covers.
On any plan with an included allowance, a usage screen that matched the
invoice would be the bug.
They count different things. The usage screen reads one field on the workspace,
`quotas.`, which holds every unit recorded since the counter last reset.
The invoice bills a Stripe metered line that only ever received the units past
the plan's included amount, rounded up to whole blocks, for a billing period
that has already closed. Different quantity, different unit, different window.
A dashboard reading 12,500 beside an invoice line reading 3 can be exactly
right.
So "why don't they match" is the wrong question. The useful one is whether the
gap is the gap the code produces. The checks below run in the order that settles
that fastest, so stop at the first one that explains your number.
> **Before you start:** The Stripe account you connected under Billing → Credentials, because that is
> where the invoices live. The workspace id and the quota slug. And two numbers
> from the quota on its plan version: the included amount and the unit size. The
> SDK's invoice object carries totals and links but no line items, so the line
> you are reconciling is read in Stripe, on the dashboard or the hosted invoice
> page.
### Read the symptom first
| What you see | Where to look first |
| ------------------------------------------- | -------------------------------------------- |
| Invoice quantity far below the usage screen | Blocks, not units |
| No overage line at all | Trial, hard limit, annual plan, or in flight |
| Last period's overage on this invoice | A late report, or a plan change |
| Usage screen low, invoice high | A reset after a missed payment |
| Your own logs higher than the counter | Records that were refused |
| The counter higher than your own logs | Retries that were not deduplicated |
### Compare blocks to blocks
The invoice line for a quota is a Stripe product named after the quota item
with "Overage" on the end, and its quantity is not units. It is billable
blocks. Each record reports the difference between the block count after it and
the block count before it, so over a period the line adds up to:
```text
overage = max(0, consumed - included)
billable blocks = ceil(overage / unitSize)
```
Put demo numbers through it. A plan includes 10,000 `api-calls` and prices
overage per 1,000. The workspace has consumed 12,500. Overage is 2,500, which is
3 blocks. The usage screen says 12,500, the invoice says 3, and nothing is
wrong.
The pre-built usage screen, `openWorkspaceSettings('usage')`, already does this
arithmetic. When the unit size is above 1 it prints a "Billable blocks" row, and
its estimated charge multiplies that same ceiling by the overage rate. Compare
the invoice to that row, not to the big number at the top. From your own code
it looks like this. I have not run the snippet as written, so treat it as a
shape rather than a tested script.
```ts
import BuildBase from '@buildbase/sdk';
const bb = BuildBase({ serverUrl, orgId, getSessionId });
// unitSize comes from the quota on the plan version: 1 when overage is
// priced per unit, 1000 when the rate reads "per 1,000".
export async function expectedBlocks(
workspaceId: string,
quotaSlug: string,
unitSize: number
) {
const q = await bb.usage.getQuota(workspaceId, quotaSlug);
return {
consumed: q.consumed, // what the usage screen shows
included: q.included,
blocks: Math.ceil(q.overage / unitSize), // what Stripe is told
};
}
```
Three situations never produce an invoice line, however high the counter goes.
A trialing subscription is capped at its included amount and its overage is
never reported. A quota with overage turned off is a hard limit, and the Stripe
subscription carries no metered item for it at all. And a free plan has no
Stripe subscription to bill. Our own plans lean on the second kind heavily: on
the paid plans only workflow runs, web analytics events and storage bill over
(storage at $0.10 per GB-month beyond the plan allowance), while emails and
webhook deliveries are hard allowances that never reach an invoice, and our
Free plan bills nothing at all.
Credits never reach one either. A credit pack is a one-time payment, and
spending credits debits a wallet rather than reporting usage to Stripe. If the
number you are reconciling is a credit balance, you are on the other system, and
[quotas are not credits](/blog/quotas-are-not-credits) is where the two part
ways.
Price can drift too, separately from quantity. The invoice charges the Stripe
price's unit amount. If the plan version's overage rate and that Stripe price
have come apart, the server logs an "Overage amount mismatch" warning and keeps
billing at Stripe's figure, while the usage screen's estimate reads the plan.
Same blocks, different total.
> **Key takeaway:** Reconcile the invoice quantity against ceil((consumed - included) / unitSize)
> for the same window. If that holds, nothing is broken. If it does not, the
> next three checks are about timing.
### Check which period the invoice is billing
Stripe bills metered usage [in arrears](/blog/metered-vs-seat-based-billing). Its own documentation puts it plainly:
at the end of the billing period, the total usage is multiplied by the unit
amount. So the overage on an invoice belongs to the period that just closed, and
by the time that invoice reaches anyone, the usage screen has reset or is about
to. You are holding last period's bill against this period's counter.
To see what the next invoice will bill, preview the upcoming invoice in Stripe.
Stripe's docs warn that the quantity there "might not be the most up-to-date",
because its own processing lags a little.
On an annual plan the gap is a year. Overage prices are created with the same
interval as the plan's base price, because the subscriptions BuildBase creates,
through Checkout on Stripe's classic billing mode, must keep every price on one
interval. So a yearly subscription carries a yearly metered item. The
counter, meanwhile, resets monthly whatever the interval. Twelve monthly
counters' worth of overage goes onto one invoice at renewal. A customer who
went over in the second month sees it on an invoice about ten months later, unless a
plan change bills it sooner.
That is the other way usage jumps invoices. Removing a metered item from a
Stripe subscription discards its usage, so before a plan change swaps the items,
the server reads what each metered item has accumulated and moves it onto the
next invoice as an invoice item described `Usage before plan change: N unit(s)`.
N there is blocks. So after a plan change, one quota's overage can arrive on
two lines: the carried one, on the next invoice the subscription produces, and
the new metered item's own line, counting up from zero. Why the carry exists at
all is in the
[proration guide](/guides/proration-on-plan-change-nextjs).
### Check whether it has reached Stripe yet
Recording happens in two phases, and only the first one is in your request. The
call increments the counter and returns. Reporting the overage to Stripe is a
queued job. The response tells you which happened: `billedAsync: true` means a
job was queued for this record, and `false` means either nothing was billable or
the enqueue failed.
The job gets 5 attempts with exponential backoff starting at 3 seconds. A
report that never lands leaves its usage log marked unbilled, and a sweep at
:03, :13, :23 and every 10 minutes after re-queues unbilled logs older than 2
minutes, up to 100 per org per pass. In the normal case Stripe is one queued job
behind the counter. After a failure, a sweep or two behind.
The Stripe idempotency key on that report is the usage log's id, not the job's.
It used to be the job's, and the comment in the code records what that cost:
the sweep re-queued a log whose "billed" flag had failed to save after Stripe
had already accepted the usage, the re-queue was a new job with a new id, and
the same overage was billed twice. [Key on the thing being billed](/blog/idempotency-in-billing), not on the
attempt to bill it. Everything else in this post keeps landing on that rule.
### Usage near a boundary lands one invoice later
Stripe refuses a usage record stamped before the subscription's current period.
Its docs describe a grace window of a few minutes for clock drift, and say not to
rely on it. The worker doesn't. When a report is stamped before the open
period's start, which is exactly what a sweep produces when it re-queues a log
created just before a renewal, the worker stamps it at the start of the open
period instead. The usage is billed. One invoice late.
So the closing invoice comes up short by those blocks and the next one runs long
by the same amount. Two consecutive invoices reconcile even when neither does on
its own, which is worth checking before anyone opens a ticket.
The counter also keeps its own clock. Its monthly period starts when the
checkout webhook is processed, not at Stripe's billing anchor, and a reset only
takes effect once that period has ended. The reset sweep runs every 5 minutes.
Net effect: the counter resets a little after Stripe renews. Units recorded in
that gap count against the old counter, and if it was already past its included
amount, they bill as overage into the new Stripe period.
With a trial, the gap is not a little. Stripe anchors the billing cycle at the
trial's end by default, while the counter anchored at checkout. Say the trial
is 14 days: every counter month starts two weeks before the invoice month, and
it stays that way, so each invoice's overage is drawn from two counter windows.
Units used during the trial also stay on the counter after it converts, until
the counter's own month runs out.
Your own logs are a third clock. Sum them by calendar month and you are
comparing against a window neither system uses. Use the invoice line's own
period, which Stripe gives in Unix seconds:
```ts
// periodStart and periodEnd: the invoice line's period, from Stripe
const page = await bb.usage.getLogs(workspaceId, {
quotaSlug: 'api-calls',
from: new Date(periodStart * 1000).toISOString(),
to: new Date(periodEnd * 1000).toISOString(),
limit: 100,
});
// page.docs, page.hasNextPage: page through and sum quantity
```
How far back that reaches is bounded by a log-retention limit on your BuildBase
plan, so reconcile while the period is recent rather than at year end.
### A missed payment changes what counts as overage
A `past_due` subscription can still record usage. [Entitlement treats it as the
grace window](/blog/what-are-entitlements) while Stripe retries the card, and overage keeps being reported.
What it does not get is a reset. Reset eligibility is `active` and `trialing`
only, on purpose, so a failing card does not buy a fresh allowance.
Follow that through a renewal. The counter carries last period's total into the
new one, so every new unit is already past the included amount, and every new
unit bills. Then the payment recovers, a reset is queued straight away, and
the usage screen drops to a small number while the upcoming invoice holds a
pile of overage. Neither number is wrong. It is the same rule, read at two
moments. On a quota with overage off, the identical gap shows up as a counter
stuck at the cap instead, which the
[429 guide](/guides/quota-429-not-exhausted) walks through.
One step further, a subscription suspended by dunning is not entitled to record
at all. The call fails with `No active subscription found`. Your app did the
work, nothing was counted, and nothing will be billed.
### Then compare your own logs with the counter
Everything so far is the counter against the invoice. If the counter disagrees
with what your app believes it did, the cause is on the recording side, and the
direction tells you which.
**Your logs are higher.** Records were refused. A quota rejection, a missing
subscription, or a batch item reported as `success: false` inside a response
that was otherwise a 200. Each is work your app did that was never counted.
**The counter is higher.** A retry was counted, which the
[per-call billing guide](/guides/charge-per-api-call-nextjs) names as the
invoice dispute you will actually get. An idempotency key is matched on
workspace, quota slug and key together, and a replay of a finished record is
absorbed: the response comes back with `used: 0`, which is the cheapest way to
watch deduplication working. It fails in two shapes.
The first is a fresh key per attempt. Our own docs sample keys on
`req.headers.get('x-request-id')`, which is only stable if your caller sets that
header and resends it. If a proxy in front of you mints one per inbound request,
every retry is a new key and a new unit.
The second is an overlapping retry. [The key is checked with a read before the
increment](/blog/idempotency-keys-metering-write-path) and stored with the usage log after it, so a retry that arrives while
the first attempt is between those two points passes the check. Both count.
Both bill. Retry after a backoff, never in parallel, and never from a client
timeout shorter than the call takes to answer.
The fix for the first shape is to mint the key where the operation is defined,
not where the attempt happens:
```ts
// The key is created with the export and stored on it, so every retry of
// this job sends the same one.
const usage = await bb.usage.record(workspaceId, {
quotaSlug: 'exports',
quantity: 1,
idempotencyKey: `export:${exportId}`,
});
if (usage.used === 0) {
// A replay. This export was already counted, and nothing new was billed.
}
```
Same caveat as before: I have not run it.
Our own metering is built this way. When an org on BuildBase sends email, the
send is counted into a Redis buffer, flushed every 30 seconds, and reported onto
a workspace counter in our own BuildBase, the same kind your app writes through
the SDK. The key is minted once, when the buffer is taken, and travels with the
queued job. The comment above that code says why: a retry that re-read the
buffer "would send new counts under an old key, or old counts twice".
### When the counter and the invoice move differently
Three paths move the counter and the invoice by different amounts.
A correction in the console. The admin path,
`PATCH /api/workspaces/:id/quota/usage`, sets values absolutely. An increase
goes through the billing path like any record. A decrease is written to the
counter only, so lowering a counter after a bug leaves whatever was already
reported to Stripe on the invoice; that needs a credit in Stripe. An increase the
billing path refuses (no entitled subscription, or a trial or hard-capped quota
at its limit) is written to the counter anyway, without billing. A correction
path that reaches the invoice is one of the pieces
[building metering yourself](/blog/cost-of-building-usage-metering-yourself)
has to price in.
A write-off. When the sweep finds an unbilled log whose workspace no longer has
a Stripe subscription, a cancellation for instance, it marks the log billed
without reporting it. Overage that failed to report before a cancellation is
dropped rather than chased.
Records that land at the same instant. Overage is computed from the counter as
it was read before the increment, so simultaneous records each see the same
starting value. The code comment says this can slightly under-bill, and across
the included line with a unit size of 1, it does. With a unit size above 1,
two simultaneous records that each open a new block each bill it, so the
invoice can also run a block over. Sequential records add up exactly. This is
the last place to look, and only when traffic for one workspace overlaps.
### Install
```bash
npm i @buildbase/sdk
```
---
## Multi-tenant workspaces in Express, Hono and Fastify: one middleware that checks membership
> Multi-tenant workspaces in Express, Hono and Fastify: take the workspace from the path, then refuse any user who is not a member, in one middleware.
- Source: https://www.buildbase.app/guides/multi-tenant-workspaces-express
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-09-28
### In short
A multi-tenant Express API takes the workspace ID from the route path, then checks in one middleware that the signed-in user is a member, answering 403 if not. Mounted on the router, every handler inherits the check. Hono does the same with createMiddleware, Fastify with a preHandler hook in a prefixed plugin.
The [multi-tenant](/blog/what-is-multi-tenancy) Express tutorials that rank today show you how to read a tenant ID. A
subdomain, an `X-Tenant-ID` header, a claim in the JWT. Then they hand that ID to
a database query and move on.
Reading the ID was never the hard part. It tells you which workspace the client
**wants**, and nothing about which one it is allowed to have. Skip that second
question and your API serves workspace B's invoices to anyone who types B's ID
into a request.
Our own setup guides have a version of this gap. The
[Express](/guides/buildbase-on-express) and
[Hono](/guides/buildbase-on-hono) pages do
`const [workspace] = await bb.workspace.list()` and use the first one, and the
[Fastify](/guides/buildbase-on-fastify) gateway's `account()` and `spend()`
stand for one workspace the same way. That is
fine for one workspace per user. Give someone two and "which workspace?" needs
a real answer, which is this page.
The answer fits in one middleware: take the ID from the path, ask BuildBase
what this user may do there, refuse if the answer is nothing, and mount it
where no handler can be written without it.
> **Before you start:** Sign-in already working through the setup guide for your framework, so every
> request carries a BuildBase session. An organization in **Platform** mode,
> which is sold on a plan: new organizations start in Personal mode, one
> workspace per user, and there is nothing to switch between. `@buildbase/sdk`
> 0.0.73 or later, which has `workspace.permissions()`.
### Express: one middleware that fails closed
Add it next to `forRequest` from the setup guide:
```js
// middleware/workspace.js
const buildbase = require('../config/buildbase');
/**
* Resolves req.params.workspaceId to what this user may do there, or refuses.
* Fails closed: any error ends the request before a handler runs.
*/
exports.requireWorkspace = async (req, res, next) => {
const { workspaceId } = req.params;
if (!workspaceId) return res.status(400).json({ message: 'No workspace.' });
try {
const access = await buildbase
.forRequest(req)
.workspace.permissions(workspaceId);
req.workspace = { id: workspaceId, ...access };
return next();
} catch (err) {
if (err.status === 400 || err.status === 403 || err.status === 404) {
return res.status(403).json({ message: 'No access to this workspace.' });
}
return next(err);
}
};
```
`permissions()` returns `{ role, isOwner, permissions }`, resolved by
BuildBase's server for the signed-in user. A member gets their role (`admin`,
`editor`, `viewer`, or one your organization defined) and the permission list that
role carries. Not a member? The SDK throws an error with `status: 403`, and it
throws the same for a workspace that does not exist. A string that is not a
valid workspace ID at all gets 400.
We turn all three into one 403. Why not 404 for the one that does not exist?
Because then the status leaks which IDs are real. GitHub makes the opposite
call and
[answers 404](https://docs.github.com/en/rest/using-the-rest-api/troubleshooting-the-rest-api)
for private repositories it will not show you. Either is defensible. Mixing
them is not.
Never 401, though. A 401 says "you are not signed in", and a well-behaved
client acts on it by signing the user out. Our own React SDK does exactly that:
a 401 from BuildBase clears the stored session and calls `onSessionExpired`.
BuildBase's API once answered membership failures with 401, and the guard's
comment now reads "A 401 here signed people out for opening a workspace they
had lost access to." Your API's clients will draw the same conclusion from
yours.
Anything else, a timeout or a 5xx, goes to `next(err)` and on to your error
handler. The
request still does not reach a handler. That is what fails closed means here:
there is no path through this function that calls `next()` without a
membership answer in hand.
### Mount it where a handler cannot miss it
```js
// routes/workspace.js
const express = require('express');
const { requireWorkspace } = require('../middleware/workspace');
const reports = require('../controllers/reports');
const router = express.Router({ mergeParams: true });
router.use(requireWorkspace);
router.get('/reports', reports.list);
router.post('/reports', reports.create);
module.exports = router;
```
```js
// app.js
app.use(
'/workspaces/:workspaceId',
isAuthenticated,
require('./routes/workspace')
);
```
`mergeParams: true` is the line people lose an hour to. Its default is
`false`, and Express documents what it does as "preserve the `req.params`
values from the parent router." Without it, `:workspaceId` belongs to the
`app.use` path, the router never sees it, `req.params.workspaceId` is
`undefined`, and every request gets "No workspace."
Why `router.use` and not `router.param('workspaceId', ...)`? Because param
callbacks "are not inherited by mounted apps or routers, nor are they
triggered for route parameters inherited from parent routers." On a
`mergeParams` router, `workspaceId` is exactly such an inherited parameter, so
the callback would never fire at all. `router.use` has no
such exception.
Now a handler reads the workspace it has already been cleared for:
```js
// controllers/reports.js
exports.create = async (req, res) => {
if (!req.workspace.permissions.includes('app:reports:create')) {
return res
.status(403)
.json({ message: 'Your role cannot create reports.' });
}
// ...create the report in req.workspace.id
res.status(201).json({ ok: true });
};
```
No second round trip. `bb.workspace.can(workspaceId, 'app:reports:create')`
exists and returns a boolean, but it is another request for an answer the
middleware already fetched.
To check it: call `GET /workspaces//reports` signed in, then
the same path with a workspace you are not in. The first reaches the handler.
The second answers 403 and the controller never logs a thing.
> **Key takeaway:** Put the membership check in `router.use` on a router created with
> `mergeParams: true`, and no handler under it can run for a workspace the user
> is not in. Refuse with 403, never 401, and hand every other error to
> `next(err)` so the request fails closed.
### Hono: one more method on the client, then `createMiddleware`
Hono's setup guide keeps `forSession` private inside `buildbaseFor`. Add one
method to the object it returns, so the middleware does not reach around it:
```ts
// src/buildbase.ts (add to the object buildbaseFor returns)
workspaceAccess: (sessionId: string, workspaceId: string) =>
forSession(sessionId).workspace.permissions(workspaceId),
```
```ts
// src/workspace.ts
import { getSignedCookie } from 'hono/cookie';
import { createMiddleware } from 'hono/factory';
import { buildbaseFor } from './buildbase';
import { config } from './config'; // the setup guide's env() helper, moved to its own file
type WorkspaceAccess = {
id: string;
role: string | null;
isOwner: boolean;
permissions: string[];
};
export const requireWorkspace = createMiddleware<{
Variables: { workspace: WorkspaceAccess };
}>(async (c, next) => {
const sessionId = await getSignedCookie(
c,
config(c).COOKIE_SECRET!,
'bb_session'
);
if (!sessionId) return c.json({ message: 'Sign in first.' }, 401);
const workspaceId = c.req.param('workspaceId');
if (!workspaceId) return c.json({ message: 'No workspace.' }, 400);
try {
const access = await buildbaseFor(config(c)).workspaceAccess(
sessionId,
workspaceId
);
c.set('workspace', { id: workspaceId, ...access });
} catch (err) {
const status = (err as { status?: number }).status;
if (status === 400 || status === 403 || status === 404) {
return c.json({ message: 'No access to this workspace.' }, 403);
}
throw err;
}
await next();
});
```
```ts
// src/index.ts
const workspace = new Hono()
.use(requireWorkspace)
.get('/reports', (c) => c.json({ workspace: c.var.workspace.id }));
app.route('/workspaces/:workspaceId', workspace);
```
Two differences from Express. The 401 for no session is fine here, because
there really is no session; it is only a membership failure that must never be 401. And the `Variables` type on `createMiddleware` is what makes
`c.var.workspace` typed in the handlers chained after `.use()`. Call `.use()`
as a separate statement and the sub-app's type never learns about it.
### Fastify: encapsulation does the mounting
A hook added inside a registered plugin covers that plugin's routes and nothing
else. Fastify says "all hooks are encapsulated" except `onClose`. So register
the workspace routes as one plugin with a prefix, and the hook can neither leak
out to other routes nor be skipped by these.
The gateway interface from the setup guide grows one method, and so does the
fake your tests pass in through `opts.buildbase`, or every workspace route
answers 500 in tests:
```ts
// src/plugins/app/buildbase.ts (add to BuildBaseGateway and createGateway)
workspaceAccess(
sessionId: string,
workspaceId: string
): Promise<{ role: string | null; isOwner: boolean; permissions: string[] }>;
```
```ts
// src/routes/workspaces.ts
import { FastifyInstance } from 'fastify';
declare module 'fastify' {
interface FastifyRequest {
workspace: {
id: string;
role: string | null;
isOwner: boolean;
permissions: string[];
} | null;
}
}
export default async function workspaceRoutes(fastify: FastifyInstance) {
fastify.decorateRequest('workspace', null);
fastify.addHook('preHandler', async (request, reply) => {
const { workspaceId } = request.params as { workspaceId: string };
try {
const access = await fastify.buildbase.workspaceAccess(
request.session.buildbaseSessionId ?? '',
workspaceId
);
request.workspace = { id: workspaceId, ...access };
} catch (err) {
const status = (err as { status?: number }).status;
if (status === 400 || status === 403 || status === 404) {
return reply
.code(403)
.send({ message: 'No access to this workspace.' });
}
throw err;
}
});
fastify.get('/reports', async (request) => ({
workspace: request.workspace!.id,
}));
}
```
```ts
// src/app.ts
fastify.register(workspaceRoutes, { prefix: '/workspaces/:workspaceId' });
```
Why `preHandler` and not `onRequest`? Routing runs before `onRequest`, so the
params exist in both. But `preHandler` runs after your session and auth hooks,
so the check sees a session that has already been validated.
Do not wrap `workspaceRoutes` in `fastify-plugin`. That is how you share a
decorator with the whole app, and it is the opposite of what you want here:
Fastify's docs say `prefix` "will not work" on a plugin wrapped with it, and
the hook would escape to every route.
### Why the path, and not a header or the token
All three frameworks read the ID from `/workspaces/:workspaceId`, and that is
a choice. The path lands in every access log you already have, so "who touched
workspace X last Tuesday" is a grep. It can be linked, bookmarked and pasted
into a support ticket. A header shows up in none of those. It works, and
reading `req.get('X-Workspace-Id')` instead is a one-line change to the
middleware, but you give up the logs for nothing.
Subdomains (`acme.yourapp.com`) are a browser-app decision, usually about
custom domains, and a different problem from membership.
Avoid the JWT claim. It is decided when the token is issued: remove someone
from a workspace at 10:00 and a token issued at 09:55 still names it until it
expires. Wherever the ID comes from, the check stays the same. None of these
sources is proof.
### What it costs
One HTTP round trip per request, to BuildBase's API. The server SDK does not
cache, so two requests to the same workspace ask twice.
You can put a short in-memory cache in front of `permissions()`, keyed on
session and workspace. [We left it out, on purpose](/blog/why-permissions-refresh-hourly). The price is exact: a member
you remove keeps access for the length of the TTL. Thirty seconds is fine for a
reporting app and wrong for anything that moves money. Choose it knowing that,
or not at all.
### When it goes wrong
| What you see | Why, and the fix |
| -------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Every request answers "No workspace." | The router was created without `mergeParams: true`, so `req.params.workspaceId` is `undefined` inside it. |
| Users get signed out when they open a workspace they left. | Something answers membership failures with 401, and the client treats it as a sign-out. Membership is 403. 401 means the session itself is gone. |
| One nested router skips the check. | It hangs off a `router.param` callback, which mounted routers do not inherit. Move the check to `router.use`. |
| A Fastify route outside the prefix is guarded, or one inside is not. | The plugin is wrapped in `fastify-plugin`, which breaks encapsulation and the prefix with it. |
| The right user, the right workspace, still 403. | The server does not count them as a member. An accepted invitation that never became a membership looks exactly like this: see [an invited member who cannot see the workspace](/guides/invited-member-cannot-see-workspace). |
The worst failure raises no error at all: every query returns everyone's rows.
The middleware decides who may enter a workspace. It does not filter your
database, so [every query still needs `where workspace_id = req.workspace.id`](/guides/per-org-data-isolation-nextjs),
or a [database per tenant](/blog/database-per-tenant-vs-shared-schema).
Building on React Router instead? The same problem has a different trap there,
where a parent loader's check does not guard its children:
[multi-tenant workspaces in Remix](/guides/multi-tenant-workspaces-remix).
Metering usage per workspace builds on this: the
[usage metering middleware](/guides/usage-metering-middleware-express) reads
the workspace, and who may record against it, from `req.workspace`.
### Install
```bash
npm i @buildbase/sdk
```
---
## Multi-tenant Remix: put the workspace in the URL, and check membership before any loader runs
> Multi-tenant workspaces in Remix and React Router v7 or v8: the workspace lives in the URL, and one membership check runs before any loader can fetch.
- Source: https://www.buildbase.app/guides/multi-tenant-workspaces-remix
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-09-28
### In short
A multi-tenant Remix or React Router app should keep the active workspace in the URL as /w/:workspaceId, not a cookie, so each tab stays in its own workspace. Check membership before any loader runs: one middleware on v8 or flagged v7, or one helper in every loader, because loaders run in parallel.
Here is the check almost every multi-tenant Remix app starts with. A layout
route at `/w/:workspaceId` loads the workspace, throws if the user is not a
member, and every page for that workspace nests under it. It reads like a
guard. For years it was not one.
Remix, and React Router before middleware, ran the loaders of every matched
route in parallel. The Remix team put it bluntly when they shipped middleware:
people assumed "a redirect from a parent loader would prevent the child loader
from running - but this was also not the case." Your `projects` loader has
already queried the database and returned rows for a workspace the user was
never in, while the layout is still on its way to throwing.
Two decisions follow, and the second matters more. The workspace lives **in
the URL**. And the membership check runs **before any loader**: in middleware
if your React Router has it, in one helper that every loader and action calls
if it does not.
> **Before you start:** A React Router v7 or v8 app in framework mode (or Remix v2) with sign-in
> working through the [React Router setup
> guide](/guides/buildbase-on-react-router). A `requireBuildBase(request)`
> helper that returns a session-bound client, as in [usage-based billing in
> React Router](/guides/usage-based-billing-react-router). Your organization in
> **Platform** mode: new organizations start in Personal mode, one workspace per
> user with the switcher hidden, and there is nothing to switch between.
### The workspace goes in the URL, not the cookie
A cookie holds one "current" workspace for the whole browser. A URL holds one
per tab, and a link pasted into Slack opens the right workspace for whoever
clicks it.
Keeping `currentWorkspaceId` in the cookie session is tempting anyway: every
loader can read it, and URLs stay short. Then someone opens a second tab and
switches workspace there, which rewrites the cookie. Back in the first tab
nothing moves. At the next revalidation, the page they were reading [quietly
shows the other tenant's data](/guides/stale-data-after-workspace-switch) under the same URL. Worse, a form posted from
that first tab lands in whichever workspace the cookie names now.
(A subdomain per customer, routed by host header, is a different problem:
custom domains, not one user in several teams. This guide does not cover it.)
The cookie keeps one job: remembering which workspace to open **by default**.
The `/w` redirect further down uses it that way and nowhere else.
### One function asks the server whether this user is a member
Put the membership check in one function, and make it the only way a route
gets a workspace:
```ts
// app/utils/workspace.server.ts
import { buildbaseFor } from '#app/utils/buildbase.server.ts';
import { data } from 'react-router';
type BuildBaseClient = ReturnType;
export type Workspace = {
id: string;
role: string | null;
permissions: string[];
};
export async function resolveWorkspace(
bb: BuildBaseClient,
workspaceId: string
): Promise {
try {
const me = await bb.workspace.permissions(workspaceId);
return { id: workspaceId, role: me.role, permissions: me.permissions };
} catch (err) {
const status = (err as { status?: number }).status;
if (status === 400 || status === 403 || status === 404) {
throw data('Workspace not found', { status: 404 });
}
throw err;
}
}
```
`bb.workspace.permissions()` asks the server what the session's user may do
in that workspace, and gets back `{ role, isOwner, permissions }`. The server
resolves it from the workspace's own members, so a workspace ID typed into the
address bar proves nothing on its own.
Two answers come back as errors. A string that is not a valid ID gets a 400
(`Invalid workspace ID.`). A workspace the user does not belong to gets a 403
(`You are not a member of this workspace.`), and so does one that does not
exist at all. That second part is deliberate. The same answer for both means
nobody can probe for which workspace IDs are real.
The `status` sits on the thrown error but not in the SDK's type definitions,
hence the cast.
Note what the function **does not** do: redirect to `/login`, or answer 401.
We learned that one on our own server. Its membership guard used to answer
401, and our React SDK treats every 401 from it as a dead session. As the comment in that
guard now says, "A 401 here signed people out for opening a workspace they had
lost access to." A user removed from one workspace is still signed in, and
still a member of the others. Send them a 404 page with a link home.
### With middleware (v8, or v7.9+ with the flag): one check on the layout
Middleware is the framework's own answer to the parallel-loader problem. It
"runs sequentially on the server before and after document and data requests,"
and on the leaf route `next` is what runs the loaders and actions. Throw
before `next` and no loader below runs.
It is always on in React Router v8. On v7.9 or later, turn it on first:
```ts
// react-router.config.ts (v7.9+ only; remove the flag on v8, whose build
// fails while it is still set)
import type { Config } from '@react-router/dev/config';
export default {
future: { v8_middleware: true },
} satisfies Config;
```
Then the layout route checks once and hands the result down:
```tsx
// app/routes/w.$workspaceId.tsx
import { requireBuildBase } from '#app/utils/buildbase.server.ts';
import {
resolveWorkspace,
type Workspace,
} from '#app/utils/workspace.server.ts';
import { createContext, Outlet } from 'react-router';
import type { Route } from './+types/w.$workspaceId';
export const workspaceContext = createContext();
export const middleware: Route.MiddlewareFunction[] = [
async ({ request, params, context }) => {
const bb = await requireBuildBase(request);
context.set(
workspaceContext,
await resolveWorkspace(bb, params.workspaceId)
);
},
];
export default function WorkspaceLayout() {
return ;
}
```
A child route reads the workspace from context instead of from `params`:
```ts
// app/routes/w.$workspaceId.projects.tsx
import { prisma } from '#app/utils/db.server.ts';
import type { Route } from './+types/w.$workspaceId.projects';
import { workspaceContext } from './w.$workspaceId';
export async function loader({ context }: Route.LoaderArgs) {
const workspace = context.get(workspaceContext);
const projects = await prisma.project.findMany({
where: { workspaceId: workspace.id },
});
return {
projects,
canEdit: workspace.permissions.includes('app:projects:create'),
};
}
```
That `context.get` is the whole point. A child that reads the workspace this
way cannot run without the middleware having set it, and the middleware cannot
set it without the server having said yes. A child that reads
`params.workspaceId` directly works too, right up until someone mounts it
somewhere else.
Open `/w//projects` and you should get the 404 page,
with no query in your database log.
### Without middleware: the same check, in every loader and action
On Remix v2, or React Router v7 before 7.9 or without the flag, there is no
stable place that runs first. So the check goes where the data is:
```ts
// app/utils/workspace.server.ts (continued)
import { requireBuildBase } from '#app/utils/buildbase.server.ts';
export async function requireWorkspace(
request: Request,
params: { workspaceId?: string }
) {
if (!params.workspaceId) {
throw data('Workspace not found', { status: 404 });
}
const bb = await requireBuildBase(request);
return resolveWorkspace(bb, params.workspaceId);
}
```
```ts
// app/routes/w.$workspaceId.projects.tsx
export async function loader({ request, params }: Route.LoaderArgs) {
const workspace = await requireWorkspace(request, params);
const projects = await prisma.project.findMany({
where: { workspaceId: workspace.id },
});
return { projects };
}
```
Every loader. Every action, including the ones that only delete something,
because an action is a POST to the same URL and nothing stops anyone sending
it. The layout loader can call it too, for the name in the header, but it
guards nothing below it.
That is more repetition than the middleware version, and it is the honest
case for upgrading. A helper you have to remember is a helper someone forgets
in the fortieth route. In review, grep for `loader` and `action` exports under
`routes/w.$workspaceId.*` and check every one calls it.
Either way, every request now asks the server once, and data requests after
navigation count. That round trip is the price of the server deciding. Do not
cache the answer across requests: a membership revoked a minute ago has to
stop working now.
> **Key takeaway:** The URL says which workspace a tab wants. Only the server can say whether this
> user may have it, and that answer has to arrive before any loader runs, which
> a parent loader cannot promise.
### Where `/w` sends people
Someone who types your domain has no workspace in their URL. An index route
picks one:
```ts
// app/routes/w._index.tsx
import { requireBuildBase } from '#app/utils/buildbase.server.ts';
import { redirect } from 'react-router';
import type { Route } from './+types/w._index';
export async function loader({ request }: Route.LoaderArgs) {
const bb = await requireBuildBase(request);
const workspaces = await bb.workspace.list();
const lastUsed = await getLastWorkspaceId(request); // your cookie, if any
const target = workspaces.find((w) => w._id === lastUsed) ?? workspaces[0];
if (!target) throw redirect('/welcome');
throw redirect(`/w/${target._id}`);
}
```
`workspace.list()` returns every workspace the user belongs to, in one call.
Use `_id` in the URL. The workspace object also has a field called
`workspaceId`, which is a different value, and the membership check will
answer 400 for it.
Here the cookie earns its keep. It remembers the last workspace so `/w` can
reopen it, and it is only ever a suggestion: the redirect still lands on a URL
that goes through the membership check, and a stale cookie pointing at a
workspace the user left just falls through to the first one.
With **Auto-Create First Workspace** on (it is by default, under the
workspace settings' Advanced Overrides), `list()` creates a workspace for a
user who has none, so `/welcome` fires only when you have [turned that off](/guides/auto-created-first-workspace-nextjs), or when a workspace
cap or your plan's limit refuses the auto-create: `list()` then answers with an
empty list rather than an error.
The switcher is a list of links. Each one goes to `/w/${w._id}`, and each tab
can sit in a different workspace without either one noticing.
### Let members see, and only some of them act
Check the permission in the action, not the button. You already have it: the
membership check returns more than yes or no. `role` is `admin`, `editor` or
`viewer` by default (stored lowercase, so compare against those), or a custom role, and `permissions` is the resolved list,
platform keys and your organization's own.
```ts
// app/routes/w.$workspaceId.projects.tsx (v8 version)
import { data } from 'react-router';
export async function action({ context, request }: Route.ActionArgs) {
const workspace = context.get(workspaceContext);
if (!workspace.permissions.includes('app:projects:create')) {
throw data('Your role cannot create projects.', { status: 403 });
}
// ...create the project in workspace.id
}
```
A viewer can open every page in the workspace and still gets a 403 from this
action. That is working as intended. Hiding the button is a courtesy; the
action is the rule.
None of this costs a request, since the permissions arrived with the
membership check. If you need the answer somewhere the middleware did not run,
`bb.workspace.can(workspaceId, 'app:projects:create')` returns it as a
boolean, at the price of another round trip.
### Five symptoms, and the cause behind each
**Opening a workspace you were removed from signs you out.** Something maps
the membership failure to 401, or redirects to `/login`. Answer 404 (or 403).
The session is fine.
**A child route returns data the user should not see, then the error page
appears.** The check lives only in the parent loader. Move it into
`middleware`, or on older versions call `requireWorkspace` in the child loader
itself.
**Two tabs keep switching each other's workspace.** The active workspace lives
in a cookie. Put it in the URL and demote the cookie to the default for `/w`.
**Every workspace page is a 404, even your own.** The URL carries the
workspace's `workspaceId` field rather than its `_id`. The server answers 400
`Invalid workspace ID.`, and `resolveWorkspace` turns that into the 404.
**A new teammate cannot see the workspace at all.** Membership, not routing.
Start with [an invited member who cannot see the
workspace](/guides/invited-member-cannot-see-workspace).
Serving the same workspaces from an Express, Hono or Fastify API as well?
There the check is one middleware, mounted where no handler can miss it:
[multi-tenant workspaces in Express](/guides/multi-tenant-workspaces-express).
Why workspaces belong in your data model in the first place, rather than a
`teamId` bolted onto users, is in [multi-tenant workspaces in an
afternoon](/guides/multi-tenant-workspaces-in-an-afternoon).
### Install
```bash
npm i @buildbase/sdk
```
---
## Usage-based billing in React Router (Remix): meter in the action, never the loader
> Usage-based billing in React Router (Remix): record usage in the action, not the loader, and key each form render so a retried submit bills once.
- Source: https://www.buildbase.app/guides/usage-based-billing-react-router
- Section: Guides
- Author: Dharmendra Jagodana
- Published: 2026-09-28
- Updated: 2026-10-22
### In short
In a React Router (Remix) app, record usage in the action that does the work, never in a loader: loaders re-run after every successful submission and on link prefetch. Generate the idempotency key in the loader and send it as a hidden field, so a retry bills once and the next report gets a fresh key.
A React Router loader runs far more often than the page it belongs to is
opened. It runs again after every successful action on the page. It runs when someone
hovers a `` that points at it. Put a usage meter in
there and you are billing customers for looking.
The meter belongs in the action that does the work. The half that is easy to
miss is the idempotency key, and it belongs in the loader. That sounds
backwards until you see what it buys: a loader key survives a failed
submission and rotates on a successful one.
The example is a workspace that pays per generated report: a `reports` quota,
one unit per report, a button that spends it and a counter that shows what is
left.
> **Before you start:** A React Router v7 or v8 app in framework mode (or Remix v2 with
> `future.v3_singleFetch` on) with sign-in already working through the [React
> Router setup guide](/guides/buildbase-on-react-router), which gives you
> `buildbaseFor()` and a `buildbaseSessionId` in your cookie session. In the
> console, a plan with a `reports` quota on it and a workspace subscribed to
> that plan. Workspace IDs in the URL, as in [multi-tenant workspaces in
> Remix](/guides/multi-tenant-workspaces-remix).
### 1. Get a session-bound client from the request
The setup guide binds a client to one session with `withSession()`. Add a
helper that pulls the session out of the cookie, so every loader and action
starts from one line:
```ts
// app/utils/buildbase.server.ts (next to buildbaseFor from the setup guide)
import { authSessionStorage } from '#app/utils/session.server.ts';
import { redirect } from 'react-router';
export async function requireBuildBase(request: Request) {
const authSession = await authSessionStorage.getSession(
request.headers.get('cookie')
);
const sessionId = authSession.get('buildbaseSessionId');
if (!sessionId) throw redirect('/login');
return buildbaseFor(sessionId);
}
```
Nothing to see yet. Signed out, any route that calls it sends you to `/login`.
### 2. The loader reads the quota, and hands out a key
```ts
// app/routes/w.$workspaceId.reports.tsx
import { randomUUID } from 'node:crypto';
import { requireBuildBase } from '#app/utils/buildbase.server.ts';
import type { Route } from './+types/w.$workspaceId.reports';
export async function loader({ request, params }: Route.LoaderArgs) {
const bb = await requireBuildBase(request);
const quota = await bb.usage.getQuota(params.workspaceId, 'reports');
return { quota, idempotencyKey: randomUUID() };
}
```
`getQuota` returns `consumed`, `included`, `available`, `overage` and
`hasOverage` for that one quota. It reads. It never writes, which is the whole
reason it is allowed to live here: this loader will run on hover, on every
revalidation, and on every navigation back to the page, and none of those
should cost anyone anything.
The key is the part that looks odd. Why would a read hand out a write's
idempotency key? Hold that thought until step 5.
Load `/w//reports` and you should see the loader data with a fresh
UUID in it on every reload.
### 3. The action records the usage, then does the work
```ts
// app/routes/w.$workspaceId.reports.tsx (continued)
import { data } from 'react-router';
export async function action({ request, params }: Route.ActionArgs) {
const bb = await requireBuildBase(request);
const form = await request.formData();
const key = form.get('idempotencyKey');
if (typeof key !== 'string' || !key || key.length > 64) {
return data({ error: 'Reload the page and try again.' }, { status: 400 });
}
try {
const usage = await bb.usage.record(params.workspaceId, {
quotaSlug: 'reports',
quantity: 1,
idempotencyKey: `report:${key}`,
});
const report = await generateReport(params.workspaceId);
return { report, usage };
} catch (err) {
const { status } = err as { status?: number };
// On the usage routes only the quota refusal answers 402.
if (status === 402) {
return data(
{ error: 'This workspace has used every report on its plan.' },
{ status: 402 }
);
}
if (status === 403) {
return data(
{ error: 'Your role cannot generate reports.' },
{ status: 403 }
);
}
throw err;
}
}
```
Three things in there are not obvious.
**The record comes first.** Our [per-API-call guide](/guides/charge-per-api-call-nextjs)
records after the work succeeds, and on a plan that allows overage that is the
right order, because `record` never refuses for being over quota: past the
included amount it counts the units as overage. On a plan with a hard cap, or during a trial, `record` is
[the gate](/guides/quota-enforcement-server-side-nextjs). Call it after the work and the refusal arrives once the report is
already built and handed over.
Recording first has its own cost. A report that then fails has still been
counted, and `bb.usage` has no reversal. That trade-off, and how to pick per route, is the subject of [usage metering
middleware in Express](/guides/usage-metering-middleware-express).
**Over quota is a 402, not a 429.** The server answers an over-quota record with
HTTP 402, `code: 'QUOTA_EXHAUSTED'`, the `quotaSlug` and `resetsAt`, and a
message that starts `Quota limit reached for 'reports'`. A 400 means the
request itself was wrong. What the SDK throws is a plain `Error` with the
status attached as `status`, a field its type definitions leave out - hence the
cast. On the usage routes only the quota refusal answers 402, so the status is
enough to branch on. The error does not carry the server's `code` in
`@buildbase/sdk` 0.0.90; it will from the next SDK release, and until then
`code` is undefined. Passing 402 on is our choice, for our
own response. A 429 from the usage API only ever comes from its rate
limiter, which is a different problem with a [different fix](/guides/quota-429-not-exhausted).
**Some members get a 403.** Recording usage needs the
`workspace:usage:record` permission, and the built-in `viewer` role does not
have it. It lacks usage view as well, so `getQuota` in the loader throws
for a viewer too. Decide whether viewers should see this page at all before you
ship it.
### 4. The form sends the key, and locks while it is in flight
```tsx
// app/routes/w.$workspaceId.reports.tsx (continued)
import { useFetcher } from 'react-router';
export default function Reports({ loaderData }: Route.ComponentProps) {
const { quota, idempotencyKey } = loaderData;
const fetcher = useFetcher();
const busy = fetcher.state !== 'idle';
return (