Compose stacks
Mount the auth, security, GDPR and SaaS features through the compose*Stack
helpers from @cosmicdrift/kumiko-dev-server/compose-stacks instead of
listing each feature and its require order by hand. A stack that depends on a
runProdApp option marks that on its features (bootRequires), and
runProdApp refuses to boot when the option is missing, naming the stack and
the option.
What it shows
Section titled “What it shows”composeAuthStack({ mfa, sessions }):auth-foundation,sessions, and withmfaalsoauth-mfaplusaccount-security. The password login itself still comes from theauthoption orcomposeFeatures.composeSecurityStack({ includeSessions }):sessions,crypto-shredding,rate-limitingandaudit. Needs a KMS decision (kmsMode) and fails withrateLimit: false. ReplacessecurityBaselineFeatures().composeGdprStack({ tenantLifecycle, selfService }):data-retentionandcompliance-profiles, optionallytenant-lifecycle.selfServiceaddssessions,user-data-rightsanduser-profile(needsmail).composeSaasStack({ billing, tiers, caps, waitlist }):billing-foundationandtier-engine, pluscap-counter/cap-overviewandwaitlistwhen configured.billing: "stripe"leavessubscription-stripeto thebillingboot option, which also mounts the tier-sync webhook route;billing: "mollie"mountssubscription-mollieitself.
Boot requirements
Section titled “Boot requirements”| Stack | Boot option | Also satisfied by |
|---|---|---|
composeMailStack | mail | a mounted channel-email |
composeFileStack without providers | fileStorage | a mounted file provider |
composeGdprStack | kmsMode | kms or allowPlaintextPii |
composeGdprStack({ selfService }), composeUserDataRightsStack | mail | a mounted channel-email |
composeSecurityStack | kmsMode, rateLimit not false | kms or allowPlaintextPii |
composeSaasStack({ billing: "stripe" }) | billing (warning only) | a mounted subscription provider |
A missing option fails the boot with:
[runProdApp] stacks in `features` need boot options that are not set: - composeGdprStack needs the boot option `kmsMode`: set kmsMode: "required" (or { plaintextReason } for a demo)A stripe composeSaasStack without billing boots and logs the same line as a warning, so an
app can go live before its prices exist.
src/app.tslists the stacks and the boot options they need.- The test boots with
KUMIKO_DRY_RUN_ENV=boot, which runs the whole validation and stops before any DB or Redis connection: with the options the boot passes, withoutkmsModeit fails and names the stacks, and withoutbillingit warns.
bun test samples/recipes/compose-stacksSource
Section titled “Source”📄 On GitHub: samples/recipes/compose-stacks