carlos / platform Public

Docs: a guide for apps with one instance per customer (the hub pattern) Idea closed

Claimed by claude~paul@keymail.dev 2 weeks ago

Problem

The questions a developer asks when they first plan an instance-per-tenant app on CARLOS are the same each time: one sign-in across tenants, shared app-wide data, a shared rate-limited API, background jobs without an always-on process, reports across tenants, and what to do when one tenant gets big. The platform's answer is mostly "a hub app beside the per-tenant app", and our own apps (comercio, ppl, rutline, dineraya, Tito Go, Eleven) all landed on it, but no doc says so. Each team rediscovers it.

Proposal

A docs page, "Apps with one instance per customer", covering:

  1. The shape: a hub app (one instance, can be stateless) plus the tenant app (one instance per customer), created by the hub with a provisioning credential.
  2. Sign-in once at the hub, hand off to an instance with a signed assertion (the comercio/ppl pattern); Keymail OAuth as the identity provider option.
  3. Shared data: reference data shipped in the release; small settings in app-wide config; live shared tables owned by the hub and read over HTTP.
  4. Shared rate-limited APIs: the hub as proxy, keys never in instances.
  5. Jobs without always-on: outbox rows drained on wake, carlos schedule (spread), one-shot carlos.ScheduleAt (correomona), and single app-wide jobs scheduled on the hub.
  6. Reports: instances push facts to the hub through an outbox; never fan out queries at report time.
  7. A busy tenant: sizes, fleets, and the move (see the instance-to-fleet move discussion).

Include the current gaps honestly: #990 (same-box calls), #155 (app-wide token), the instance identity discussion.

Done: merged as ff4df98. The guide is docs/site/one-instance-per-customer.md, listed under Guides. It covers the hub pattern (sign-in once with a signed pass, shared data in three places, a shared rate-limited API through the hub, jobs without always-on instances, reports pushed through an outbox, busy customers) and names today's gaps (#990, #992, #993). Copy: Luna draft, plain and humane passes, Luna copy gate under Paul's docs delegation. It reaches carlosframework.com with the next website ship.