Provisioning and internals
How tenants come to exist and what holds them up, from docs/runbooks/tenant-lifecycle.md and customer-onboarding.md. The executable companion is the New-tenant checklist.
Access model
Section titled “Access model”| Requirement | Detail |
|---|---|
| Membership | PRESH org-1 membership |
| Role | platform_ops in org 1 (membership alone is insufficient) |
| UI surface | /admin/tenants |
| API surface | /api/v1/admin/*, guarded by requirePlatformOps |
| API org scope | Calls require org_id=1; owner email derived server-side |
Org 1: the control plane
Section titled “Org 1: the control plane”Org 1 is the PreshAI control plane. It provisions and governs; it is not a customer tenant:
- Org 1 cannot be suspended or deprovisioned. Any suspend/deprovision tooling must exclude it. A missing exclusion is a bug, not an edge case.
- Object defaults are published from the org-1 Object Manager to tenants via
/api/v1/admin/object-defaults/*. Preview first, then apply.
The provisioning map
Section titled “The provisioning map”Provisioning runs: PRESH org 1 (platform_ops) creates the tenant in /admin/tenants, which yields the tenant and hostname. The provision-tenant Inngest workflow runs, gated by evaluateTenantReadiness for core-ready. Readiness covers environments with seed_default_agents, mint_workos_org, and the required vercel_alias. Partner admins reach the tenant via Members enrollment. Environments lead to the first governed session on the tenant hostname.
Workflow steps (names from source)
Section titled “Workflow steps (names from source)”Steps run in this order: registry, branding, hostname, config, RBAC, then mint_workos_org, link_registry, attach_domains, vault_placeholders, ai_gateway_key (token-gated/overridable, skippable without blocking core-ready), verify_defaults, seed_default_agents, seed_owner and send_invite (may precede vercel_alias; the invited owner waits on /preparing until core-ready), converge_post_owner, then vercel_alias (required for core-ready).
- Poll
GET /api/v1/admin/tenants/[id]/provisioning; gate onevaluateTenantReadiness. vercel_aliasneedsVERCEL_ARCHER_TOKENandVERCEL_TENANT_PROJECT_ID(names only; values in secret management). Re-verify the alias after every redeploy that moves traffic.
Hostnames
Section titled “Hostnames”- Tenant host:
<slug>.preshos.com(or custom hostname entered at Create; blank defaults to the slug form).preshslug reserved. - Wildcard
*.preshos.com; WorkOS redirecthttps://*.preshos.com/callback;NEXT_PUBLIC_APP_URL=https://preshos.com. - Tenant contract (OAuth/webhooks canonical host, HMAC state, allowlist): SDK auth.
Partner admins
Section titled “Partner admins”Enroll PRESHai internal emails via /admin/tenants/[id] Members. They reach customer tenants through My tenants (/my-tenants). Review the posture at handoff. Keep only what implementation vs. managed-ops needs.
Object defaults
Section titled “Object defaults”Publish from org-1 Object Manager: /api/v1/admin/object-defaults/*, preview then apply. Applying unpreviewed defaults to tenants is the kind of mistake this rule exists to prevent.
Customer-side code map
Section titled “Customer-side code map”- Preparing:
/preparing(until core-ready) - Wizard:
app/(onboarding)/onboardingto/onboarding/* - Customer APIs:
/api/v1/orgs/[id]/* - Dashboard after onboarding
What never goes in this wiki
Section titled “What never goes in this wiki”Passwords, API keys, tokens (including VERCEL_ARCHER_TOKEN values), connection strings, private keys. Names of env vars where source names them, values never. Customer-identifiable data beyond operational need. Anything flagged not in pasted sources stays flagged until confirmed.

