Skip to content

feat: show project usage and keep core cloud identity free - #2558

Draft
fforootd wants to merge 47 commits into
mainfrom
claude/pricing-catalog-mock
Draft

fforootd wants to merge 47 commits into
mainfrom
claude/pricing-catalog-mock

Conversation

@fforootd

@fforootd fforootd commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

Draft. This PR adds project usage counting and a proposed hosted-cloud pricing model. The pricing website is stacked above it in #2562; prices remain a proposal and billing is not live.

Summary

The server counts each project's monthly active users and the console shows usage by day or cumulatively. MAU remains an analytics metric: it never creates a bill or forces a plan upgrade.

  • Usage is recorded in usage_first_seen, usage_hours and usage_cursors across Postgres, Spanner and SQLite. The projector reads settled events and advances counts and its cursor in one transaction; the purge retains events the projector has not counted yet. ADR 086 describes the design.
  • The usage API returns daily or hourly counts, sealed_through and team_id, including before a project is claimed. Self-hosted installations show counts; the hosted add-on can also show estimated costs.
  • Core users and service identities, teams/organizations, projects/apps, roles/credentials and console seats are free. Password/social sign-in, passkeys, TOTP MFA and requiring MFA for everyone are included. Requiring MFA is never charged: CISA's Secure by Design principles count charging for MFA as a hidden tax, and a charge would push apps to enforce MFA in their own code. Versioned releases, previews and rollbacks are included on all plans.
  • The hosted plans are Free, Pro at a $100 monthly base fee plus usage, and quoted Enterprise. Pro's base fee is not a usage credit. Branding removal and managed delivery require a paid plan. SSO, directory, token, threat-intelligence and authorization allowances and metered rates remain in the catalog.
  • Free runs Zitadel's secure defaults; Pro changes them. A Custom security settings package, included in Pro and Enterprise, covers lockout and password rules, captcha thresholds, difficulty and a project's own provider, session and token lifetimes per project, and stricter rate limits of a project's own. Turning protection on, incident response (signing out everywhere, revoking sessions, rotating keys) and setup stay free on every plan; raising capacity means extra requests; self-hosted servers keep every setting.
  • Governance is included in Pro and Enterprise, with no per-user or per-policy charge; its session policies moved to Custom security settings. Compliance is quoted per account for extended retention, SIEM export/streaming and evidence/reporting. These package capabilities are marked planned; retained-user and policy-user meters are removed.
  • Capacity is priced by requests, never by users. Free keeps 50 RPS per project and 25M requests a month per account. Pro has 500 RPS per project and 50M requests a month per account, about 385k MAU at the cost model's 130 requests each. Extra requests, which the owner adds in blocks of 50M for $700 a month, cost about $14 per million. Without them, Pro gets 30 days' notice, then 50 RPS per project. Enterprise capacity is contracted. This keeps the cost model whole: the pricing proposal puts 1M MAU at $0.84–1.6k a month to serve and 10M at $4.1–7.2k. At 130 requests per user, a 1M-MAU consumer app pays $1,500 a month.
  • No bot check is charged per check. The built-in Altcha challenge and an edge's BotID or Cloudflare verdict work on every plan, self-hosted too; a project's own Turnstile, hCaptcha or reCAPTCHA keys need Pro's custom security settings, and that provider bills the customer. ADR 078 §5 keeps the hosted login on Altcha, so no customer project reaches a check Zitadel pays for per call; the bot_checks meter and the future per-check item are removed.
  • Risk-based challenges and MFA prompts are free. They run on signals Zitadel computes itself (device, failed attempts, location, network, bot checks) or the customer brings, such as device posture from their MDM. Rules a customer writes on those signals are Governance's conditional access, included in Pro.
  • Threat intelligence is the only paid risk line: a planned, opt-in meter for feeds Zitadel licenses (IP reputation, residential proxies included, and leaked credentials), $0.003 per checked user past 10,000 a month as a placeholder until a feed vendor is chosen. New feeds join this line rather than becoming new prices.
  • Every plan chooses any available region per project, at no charge (the owner's decision). A region's database (about $0.7–1.4k a month) is a fixed cost for Zitadel, not one per customer, so the $100 region line and the bill's region add-on are gone. The legacy cloud billed $167k of regions in the last 12 months; that revenue is given up on purpose.
  • Plain names: a deployment makes a release live on production or preview URLs, so one row covers versioned releases, previews and rollbacks; capacity steps are now extra requests; dedicated deployment is now dedicated infrastructure (dedicated database servers and compute), so it no longer reads like the product's deployments. Every priced meter names its unit (user, check, email, message, token), and labels drop jargon: enterprise SSO users, directory-synced users (SCIM), authorization API checks, service access tokens, managed email and SMS delivery, extra API requests, uptime SLAs, technical account manager hours, and support response times in hours and minutes.
  • Enterprise includes a 99.95% SLA, with 99.99% as an upgrade. Custom contractual addenda are Enterprise-only; Enterprise priority support is quoted.
  • Billing estimates separate base fee, included credit, metered usage and add-ons. bill() prices the blocks of extra requests a month needs and estimates Pro for a month past Free's request ceiling. The example with 20 connections of 1,000 SSO users is $1,500: $100 base plus $1,400 after caps and the allowance. Billing hides the credit bar for Free and Pro. Usage reporting filters out MAU, API-request gauges and removed/unpriced meters.

apps/cloud-functions/src/pricing/catalog.json is the pricing source for both the estimator and #2562's website, and its decided list names the keys the owner has settled. ADR 084 documents the commercial model.

Validation

For the pricing changes:

  • moon run cloud-functions:test cloud-functions:lint cloud-functions:typecheck cloud-console:test website:test website:lint website:typecheck website:build: 116 functions, 21 cloud-console and 46 website tests passed; lint, builds and type checks passed.
  • Catalog validated against catalog.schema.json with Ajv 2020.
  • node scripts/check-changesets-status.mjs --pending and node scripts/check-pr-title.mjs --title "feat: show project usage and keep core cloud identity free" passed.

The unchanged usage implementation previously passed Go unit, SQLite and Postgres checks and console tests. Those integration lanes were not rerun for this pricing update. The Spanner lane and deployed end-to-end checks remain outstanding.

Release notes / changeset

.changeset/usage-counted-and-served.md (@zitadel/server: minor) describes project usage counting and the Usage screen. The cloud's prices are not part of @zitadel/server, so they stay out of its release notes.

Notes

  • Usage-day compaction, retention, the operator feed for report-usage, a lag metric and a CLI usage command remain deferred in ADR 086. Stripe reporting still reads the mock feed.
  • The usage ADR is 086: docs: record which release serves a request (ADR 085) #2468 took 085 on main first. Migration numbers (Postgres 000039, Spanner 000043, SQLite 000026) may still collide with other open branches; reconcile when needed.
  • No MAU threshold or console-seat fee is introduced. Extra requests are the only line that grows with scale; residency is free.
  • The capacity numbers (50M included, $700 per 50M extra requests) and the threat-intelligence price are proposals.

🤖 Generated with Claude Code

fforootd and others added 7 commits October 30, 2026 19:54
…atalog

The mock now bills by the pricing proposal. A price catalog holds the
plans, the per-user meters with their allowances and the lines billed on
top; bill() prices a month as the larger of Pro's minimum and the metered
usage, plus what is billed on top, and Free while nothing needs Pro.

The mock team's usage is one month of the proposal's example B2B SaaS,
spread over the month's hours for report-usage, so Settings → Billing in
previews shows each meter's amount and the month's estimate. The contract
renames Plan.base_amount to minimum_amount and adds UsageLine.amount and
TeamBilling.estimate. Directory.applyPlan becomes applyEntitlements, with
the catalog's allowances.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…that commit late

The event shipper and forward pages of GET /events?order=asc read
(created_at, id) > cursor. An event whose transaction commits after the
reader has passed it sorted behind the cursor and was never read. On
Postgres created_at was now(), the transaction's start, so any Path B
mutation that started first and committed last lost its events from
webhook and stdout sinks.

Forward readers now list only settled events: those no open transaction
can still commit an event before.

- Postgres stamps clock_timestamp() after taking a shared advisory lock
  keyed by the project and the second; the transaction holds it until it
  ends. EventsSettledBefore reads the oldest such second from pg_locks, so
  an open writer holds back only its own project.
- Spanner stamps the commit timestamp (migration 000042), so every
  committed event is settled.
- SQLite raises the stamp past the project's newest stored event, under
  its single write lock.

ListEventsAfterCursor and the API's ascending list apply the bound. ADR 049
gets an amendment stating the guarantee and the rejected options (a safety
lag, an xmin guard, pg_stat_activity).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… screen

The cloud functions price each team's mock usage per project and UTC day
from the catalog, and the add-on draws it as Vercel's usage page does: the
plan's credit, a stacked chart of what each day added, and a table per meter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…h GET /usage

The server counts usage from its own events into rollup tables (ADR 086):
a projector reads each project's settled events of the meters' types,
counts a user once a month in the hour of their first sign-in, and moves
its cursor in the transaction that counts the batch, so a crash or a second
run counts nothing twice. GET /usage serves a project's days or hours,
how far they are final, and the team that claimed it, counts only.

- Postgres, Spanner and SQLite: usage_first_seen, usage_hours and
  usage_cursors, with stmttest suites. Spanner bounds a read by its strong
  read's timestamp; SQLite never stamps an event before its project's
  cursor.
- The projector runs on its own loop, or per call to /cron/usage with
  usage.trigger_secret, as the purge does; the hosted cloud's launcher and
  Vercel Cron Job set it up.
- While usage is counted (usage.enabled, on by default), the purge keeps
  every event the projector has not counted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the cloud's add-on

Usage moves from the hosted cloud's Settings into the console's own project
sidebar, since a self-hosted deployment counts its usage too: the screen
reads GET /usage for the selected project and draws each UTC day with
shadcn's chart (Recharts, through the pnpm catalog), daily or cumulative,
with each meter's month in a table.

Prices are the add-on's: a new optional slot, usagePrices (Console ADR
0006), lets the cloud's build add what each day costs. The cloud functions
now read the person's projects' usage live and price it per team, and the
add-on hands the console the project's share. Billing keeps the team's
credit bar; the add-on's own Usage screen is gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cloud Ready Ready Preview Nov 25, 2026 11:30pm UTC

Request Review

@github-actions

github-actions Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦋 Changeset detected

Latest commit: ec84c12

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 25 packages
Name Type
@zitadel/server Minor
@zitadel/cli Minor
@zitadel/testing Minor
@zitadel/server-darwin-arm64 Minor
@zitadel/server-darwin-x64 Minor
@zitadel/server-linux-arm64 Minor
@zitadel/server-linux-x64 Minor
@zitadel/server-win32-x64 Minor
@zitadel/api Minor
@zitadel/components Minor
@zitadel/config Minor
@zitadel/sdk-angular Minor
@zitadel/sdk-core Minor
@zitadel/sdk-next Minor
@zitadel/sdk-nuxt Minor
@zitadel/sdk-qwik Minor
@zitadel/sdk-qwik-router Minor
@zitadel/sdk-react Minor
@zitadel/sdk-solid Minor
@zitadel/sdk-solid-start Minor
@zitadel/sdk-svelte Minor
@zitadel/sdk-sveltekit Minor
@zitadel/sdk-tanstack-start Minor
@zitadel/sdk-vue Minor
@zitadel/cloud Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

…e a plain first sentence

- gofmt internal/audit/usage_test.go and internal/storage/stmttest/main_test.go
  (server:format).
- ADR 086 becomes 085: the index check wants contiguous numbers, and 085 is
  free on this branch's base. #2468 also proposes an 085, so whichever lands
  second renumbers.
- getUsage's description opened with `[from, to)`, which the docs reject in
  a page description; its first sentence now reads as plain text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-catalog-mock

# Conflicts:
#	internal/service/statement.go
#	internal/storage/dialect/sqlite/event.go
…d-on

Enterprise now keeps audit events 90 days by default, Free 7 and Pro
30 as before. Each retention meter names the days it keeps
(retention_days, in the schema), and entitlementsFor no longer sells a
plan the retention it keeps anyway: Enterprise is offered the 400-day
retention only. The meters count from the plan's own days rather than
from 30. The price list is now 2026-10-31.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Customers run the login component in their own app, on their own
domain, so a domain for a login Zitadel hosts prices something they do
not use. The catalog loses the custom_domain_extra line and the plans'
custom_domains_included, and bill() no longer charges for domains or
counts one as a reason to need Pro. The price list is now 2026-10-31.2.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Usage stays cheap, and the features companies buy for their own reasons
move toward WorkOS's and Clerk's prices:

- SSO users $0.10, counting at most 750 per connection, so a connection
  costs at most $75 a month; 1,000 stay free.
- Directory users get their own meter, at the same price and cap.
- Advanced bot checks $2 per 1,000 (BotID costs $1).
- Retained users $0.005 to 90 days and $0.015 to 400 days.
- SIEM streaming, $100 a month per event sink, billed on top.
- Authorization users: 100,000 free; lockout leaves the policy meter.

The mock team's month is now 20 connections of 1,000 users: $1,420.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fforootd added a commit that referenced this pull request Nov 1, 2026
…M streaming

The pricing page follows the repriced list from #2558:

- SSO and directory users each say what one connection or directory costs
  at most a month, and a question explains the cap.
- B2B lists directory users beside SSO users.
- Audit retention becomes Audit trail, with SIEM streaming per sink.
- Amounts with cents keep two digits: $0.10, not $0.1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-catalog-mock

Main serves the API under /api/v1 and routes only the server's own paths
to it in the cloud (#2356 to #2359, #2566):

- buildHTTPMux takes main's api.Servers and keeps this branch's cron
  triggers; a job no trigger runs leaves its path to the root alias.
- vercel.json and the cloud runbook route /cron/usage to the server, as
  /cron/events-retention, or the usage cron would reach the website.
- The functions' and the console's usage specs answer under /api/v1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fforootd added a commit that referenced this pull request Nov 1, 2026
#2558 now holds main, whose cloud routes every path no other service
claims to the website (#2566). The page's own rewrite for /pricing goes
with the explicit list, the website's AGENTS.md takes main's routing
rule, and the deployment check opens /pricing beside main's 404 probe.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Resolve the cloud launcher's renderConfig: main renders the config as a YAML map, and the branch adds usage.trigger_secret beside the purge's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's console layout (Console ADR 0007) deletes DESIGN_ONLY_NAV and
moves resource code into feature folders, so the usage helpers move
from lib/usage.ts to features/usage/ (model.ts, and api.ts for the read).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main took ADR 086 for invitations, so the usage-rollups ADR moves to
087. The index keeps main's 086 row and lists this branch's as 087, and
every mention of the usage ADR, generated code included, now says 087.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
fforootd added a commit that referenced this pull request Nov 6, 2026
Picks up main through #2558's branch, and with it the usage-rollups ADR's
new number, 087 (main took 086 for invitations). The two conflicts were
comments and the bundled OpenAPI file, which the regeneration confirms.

The catalog's bot-check meter pointed at "ADR 086" for #2835's abuse
protection ADR, which that PR now numbers 087, the same as the usage ADR
here. The source note names that ADR by its title and PR instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
routes.spec.ts keeps both new imports: main's Team type and this
branch's entitlementsFor. Main made Team.joined_at required (#2870), so
the usageByDay test's team fixture gets one; the usage read ignores it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Billing keeps the branch's load of billing and usage and takes main's rename of the add-on nav view to "account" (#2906).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Billing keeps the branch's load of billing and usage and takes main's nav view, "settings" again (#2909).

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Main's Logs screen took nav order 9, which Usage had: Logs keeps 9, Usage moves to 10 and project Settings to 11. Main's fold_user_unique_attributes migrations took the usage migrations' numbers, so usage moves to Postgres 000042, Spanner 000046 and SQLite 000029. The service mock is regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's event_test.go declares eventIDs, the same helper usage_test.go declared, so stmttest stopped compiling under the integration tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's Search ADR took 087, so the usage ADR becomes 088 with every reference the branch wrote; the Search ADR's keep 087. Main's user_attributes_search_text migrations took the usage migrations' numbers, so usage moves to Postgres 000043, Spanner 000047 and SQLite 000030. The ogen code is regenerated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main's request flush wait and idle timeout for the cloud's launcher (#2952) meet the branch's usage count: the export adapter counts usage and the request buffer takes the flush wait, buildHTTPMux keeps the cron triggers beside main's idleTimeout, the launcher's comment names both, and the two config tests stay apart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
main took 088 for abuse protection per operation (#2835). Renames the file, its README row and every citation on this branch; the generated OpenAPI and Go client comments change with their source descriptions.

This branch was successfully deployed

1 active deployment
Preview — ec84c12f Deployed Nov 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

1 participant