Add multi-tenant cloud mode: self-serve purchase, credit metering, core-decoupling

Introduces RECAP_MODE=multi alongside single-mode self-host:
- Tenant auth + accounts (magic-link via System SMTP), per-tenant credit pool,
  anonymous trial minting with per-IP/-64 caps
- Self-serve Pro/Max purchase: inline Lightning (BTCPay) + card (Zaprite),
  prepaid 30-day periods, expiry-reminder emails
- Core-decoupling: relay owns cloud tier/expiry keyed by Recaps user-id
- SQLite (better-sqlite3) schema for multi-mode; filesystem unchanged for single
- StartOS actions/versions through 0.2.155
This commit is contained in:
Keysat
2026-06-13 14:25:05 -05:00
parent db580abad7
commit 0ae59f3550
176 changed files with 23823 additions and 803 deletions
+12
View File
@@ -0,0 +1,12 @@
import { VersionInfo } from '@start9labs/start-sdk'
export const v_0_2_92 = VersionInfo.of({
version: '0.2.92:0',
releaseNotes: {
en_US: 'Two-bucket tenant credit ledger + anniversary-aligned replenishment. tenant_credits.balance is split into purchased_balance (permanent — a la carte purchases + admin grants + anon-trial carry-over on signup) and replenish_balance (refillable — initial signup grant + periodic refresh to tenant_default_credits). Spend debits replenish first, then purchased, so the refillable bucket is use-it-or-lose-it each period. Anniversary-aligned refill anchored to each tenant\'s last_replenish_at: daily = 24h, weekly = 7d, monthly = calendar-month with day-of-month clamping. New StartOS action "Set Tenant Credit Replenishment" (off / daily / weekly / monthly). Default: off (Grant\'s use case — tenants are paying customers, signup grant is one-time). Existing tenant_credits.balance is renamed to purchased_balance on upgrade — treats all existing credits as permanent so nothing gets wiped. Also fixed a bug where signed-in free users could summarize indefinitely without their tenant_credits getting gated/debited (was display-only); now /api/process gates on total > 0 and debits one credit after successful saveToHistory. Smoke-tested end-to-end with daily replenish + spend + refill + mixed bucket behavior.',
},
migrations: {
up: async ({ effects }) => {},
down: async ({ effects }) => {},
},
})