Commercial Layer · SaaS & White-label
What turns KRAT ONE from software into a resellable, white-label, usage-metered SaaS for agencies. It sits on the Core and reuses tenancy (#1), the usage_event ledger (#4), events (#7) and jobs (#6). System language: English (initial).
Prototype screens
Agency-side (SaaS Mode) product mockups — fictional data, for design.
Already in Core vs. to build
| Commercial capability (GHL) | Core foundation | Status | To materialize |
|---|---|---|---|
| Isolated sub-accounts | Tenancy #1 | have it | — |
| White-label / branding | branding jsonb #1 | have it | Per-agency custom domain + app theme |
| End-client portal | membership external #2 | have it | Portal UI |
| Rebilling metered usage | usage_event / cost_micros #4 | partial | Wallet + configurable markup |
| SaaS Mode (self-serve resale) | Billing #4 | partial | Stripe Connect, reseller plans, self-serve onboarding |
| Snapshots (clone account) | — | to build | Config-graph template engine with ID remapping |
Reseller Model & Billing Hierarchy
Two billing levels — the platform bills the agency; the agency bills its clients.
connect_account (id, account_id, stripe_connect_id, type, status, payouts_enabled)
reseller_plan (id, account_id, name, stripe_product_id, price, interval, trial_days, includes jsonb)
reseller_subscription (id, workspace_id, reseller_plan_id, stripe_subscription_id, status, current_period_end)
Wallet & Rebilling
Usage markup — the "AgentOps as P&L" made real.
wallet (id, workspace_id, balance_micros, currency, auto_topup jsonb, low_balance_threshold) wallet_ledger (id, wallet_id, type, amount_micros, usage_event_id, balance_after, created_at) -- partitioned rebilling_rate (id, account_id, metric, mode, value, min_charge) -- markup_pct | fixed_unit | passthrough
Snapshots
Versioned, cloneable configuration templates — not customer data.
included
Pipelines/stages, workflows/automations, forms, calendars, agent templates + config (prompt/tools, no runs), custom_field_defs, message templates, tags, segment defs.
excluded
Contacts, deals, activities, messages, wallet balance, connections/secrets. Snapshots carry setup, never a client's data.
snapshot (id, account_id, name, version, manifest jsonb, is_public, created_at) snapshot_link (id, snapshot_id, workspace_id, applied_version, applied_at)
Capture
Serialize the config graph of a source workspace into a versioned manifest.
Apply
Deep-clone into a target workspace with ID remapping (id_map old→new), preserving all references.
Push update
Propagate v+1 to already-instantiated sub-accounts via snapshot_link (diff/merge).
White-label & Custom Domains
domain (id, account_id, hostname, target, ssl_status, verified_at) -- target: app | portal
Branding
Full theme per agency/client (extends Core #1 branding jsonb): logo, colors, fonts, favicon, from-email.
Custom domain
app.agencybrand.com → CNAME → KRAT edge; on-demand TLS (Let's Encrypt). Gateway resolves hostname → tenant.
Branded surfaces
Emails (Core #11), client portal (Core #1 external). White-label mobile app = later.
Platform Revenue & Agency Rollup
Revenue streams
(a) Agency subscription (Core #4 tiers) · (b) wholesale margin on metered usage (KRAT cost → agency price) · (c) mandatory 3.5% + $0.30. No % fee on the agency's resale revenue.
Agency dashboard
Rollup across sub-accounts: MRR, active clients, usage, margin (retail − wholesale), churn — from usage_event + wallet_ledger + reseller_subscription.
Locked decisions
Confirmed — the Commercial Layer is fully specced.
| Decision | Choice | Detail |
|---|---|---|
| Stripe Connect | Express | Stripe-hosted KYC/onboarding; agency = merchant of record. Custom path for enterprise. |
| Rebilling model | Prepaid Wallet | Clients top up; usage debits live; auto-topup. Zero collection risk (GHL-style). |
| Platform monetization | Wholesale margin | Margin on metered usage (KRAT cost → agency price) + agency subscription. No cut of resale. |
| White-label domains | Subdomain + tier | Free agency-slug.kratone.app for all; custom domain (CNAME+ACME) on higher tiers. |
| Snapshots | Config-only | Setup only, never client data. Non-destructive push-update (preserves local edits); ID remapping. |