Skip to content
Packages

Commercial System of Record

商业系统记录源

Access gates, billing providers, subscriptions, usage, credits, metering, licenses, contracts, legal content, marketing, and waitlists form the commercial domain.

9 packages, 94 source files and 33 test files in packages/commerce. · Source ↗ · Docs ↗

Commercial ledger lanes

Each lane owns a different fact: access, invoice, usage, license, legal, or acquisition.

  • @nebutra/access-gateinvite lifecycle for controlled SaaS access
  • @nebutra/billingCreem, ChinaPay, credits, manual
  • @nebutra/meteringusage records and billing handoff
  • @nebutra/licenseissuance, validation, lifecycle events
  • @nebutra/legalpolicy content and compliance surfaces

What it owns

  • Billing provider adapters, subscription lifecycle, and metering contracts
  • Access-gate invites, licensing, legal content, marketing primitives, and waitlist
  • Commercial boundaries that apps expose but do not redefine

Where it stops

  • Landing copy can link to commerce contracts; it does not own pricing behavior.
  • Auth and billing connect through tenant identifiers, not shared UI state.

How we know it works

  • access-gate lifecycle tests and package status docs
  • billing model docs and release-surface verification

In code

checkout.ts
1import { createCheckoutSession } from "@nebutra/billing";
2
3const session = await createCheckoutSession({
4  customerId: org.stripeCustomerId,
5  priceId: "price_pro_monthly",
6  successUrl: `${origin}/billing/success`,
7  cancelUrl: `${origin}/billing`,
8});
9
10return Response.redirect(session.url);

Packages

9 packages in packages/commerce.

Advanced analytics
Pro · $29/mo
requireEntitlement('analytics:advanced')
access-gate

Pre-launch access gate — invite-code redemption, position queue, drip-release windows. Layers on top of @nebutra/waitlist.

billing

Billing on Creem (cards worldwide, merchant of record), plus WeChat Pay / Alipay for mainland China (or manual, for offline invoicing). Same Subscription / Invoice / Customer surface for every backend.

contracts.events.ts4
  • eventinvoice.paid{ id, amount, currency }
  • eventuser.created{ id, email }
  • eventsubscription.canceled{ tenantId, reason }
  • eventfeature.gated{ flag, actorId }

TypeScript-validated · zero-runtime contracts

contracts

Cross-package event, identity, billing, and notification type contracts. The shared TypeScript boundary that lets commerce talk to iam, queue, webhooks.

legal

Legal entity primitives — corp filings, registered agents, jurisdiction-aware ToS/Privacy generation. Feeds the legal section of @nebutra/preset.

license

License key generation, validation, and revocation. Ed25519-signed, offline-verifiable, with seat-count and expiry enforcement.

marketing

Shared marketing-site primitives — hero blocks, pricing tables, FAQ accordions — reused by landing and product marketing surfaces with the brand tokens already wired.

metering

Usage metering on ClickHouse — sub-second ingestion, per-tenant quota lookup, ready to feed metered billing or in-product limits.

waitlist

Pre-launch waitlist for the foundation tier — invite codes, position queues, referral counts, and operator dashboards.