assembled

One command. 14,584 lines of verified backend.

One ctrlai add saas stood up auth, billing, email, jobs, webhooks, audit, storage and multi-tenancy — vendored into your repo, wired, migrated, and inspected. You wrote none of it; the agent reinvented nothing.

$ ctrlai add saas

Configure your backend

Pick what you're building. Every capability is a verified part — readable, locked, on infra you own. One command assembles exactly this.

10 parts5,601 verified lines74 invariants4 swappable vendors
1 · What are you building?
Capabilities 10 on
Verified partsreadable · locked · attested
Your infrastructure
Postgresyour data — one database, $0 per call6
In-memoryno extra infrastructure1
Stripe · meteredpayments — metered by the vendor1
Email vendor · meteredResend / Postmark / SES1
Object storage · meteredS3 / R2 / GCS1

your data & logic  ·  metered vendors, swappable

2 · Assemble it — copy & go
Install command
$ ctrlai add saas

Vendors the verified parts into ./parts, wires the routes, runs the migrations.

Agent build-promptpaste into your coding agent
Build a Team SaaS backend (multi-tenant subscriptions) with Ctrl AI, so we never hand-write or reinvent infrastructure.

1. Install the verified parts — this vendors their source into ./parts, wires the routes, and runs the migrations:
   ctrlai add saas

2. These 10 parts are verified and content-locked. Import and call them — never edit them, never re-implement what they do:
   - auth.session — Email/password sign-in + server-validated sessions
   - auth.tenancy — Orgs, members, roles + the row-level access gate
   - billing.subscription — Subscriptions — checkout, plan changes, entitlement
   - email.transactional — Transactional email — welcome, receipts, invites
   - storage.upload — Presigned direct-to-bucket uploads (S3 wire)
   - webhooks.ingest — Verify inbound webhooks — HMAC, replay defense
   - jobs.queue — Durable background jobs + cron, no extra infra
   - audit.log — Append-only, un-rewritable event trail
   - ratelimit.api — Per-key / per-IP fixed-window limits
   - admin.crud — Schema-driven internal admin over your tables

3. Vendors are pre-selected (email → Resend, webhooks → Stripe, billing → Stripe). Swap any later with `ctrlai upgrade <part> --adapter=<vendor>` — the call sites don't change.

4. Write ONLY the seams — the thin glue and the product on top:
   - pricing page + PlanCatalog
   - org switcher + invite flow UI
   - email templates (welcome / receipt / invite)
   - the product itself

5. Run `ctrlai doctor` to verify the wiring. It fails if any part was modified or mis-wired, so keep it green.

Do not implement authentication, billing, email, jobs, webhooks, storage, audit, search, rate-limiting, or flags yourself — the parts above own those. Build the product.
ctrlai doctor: ready10 verified · 0 failures · 74 invariants · on your Postgres · no lock-in

And it runs

fire a real request at the assembled backend

the engine on the dyno — fire a real request

POST /api/auth · sign upreal session
auditLog(db).append(…)append-only ledger
jobs(db).enqueue("send-welcome")background job
send({ to, subject })real Resend call
tenancy(db).createOrganization(…)multi-tenant
verifyWebhook(signed)signature + tamper
ctrlai doctor: ready21 checks clean · 0 failures · on your Postgres · no lock-in
✓ infra: assembled + inspectedyou build the body: UI, business logic, the fun part