tech/cloudflare/workers-for-platforms

WORKERS FOR PLATFORMS

Cloudflare Workers for Platforms — multi-tenant Worker execution.

production Cloudflare Workers (Paid, Enterprise)
improves: tech/cloudflare

Cloudflare Workers for Platforms

Status: stub — documented for future reference. Do not build with this until 2nth has 50+ clients with custom code deployment requirements.

Workers for Platforms lets you build a multi-tenant execution platform where your customers deploy and run their own Workers code inside your Cloudflare account, with full isolation between tenants.

When this becomes relevant for 2nth

This is the right primitive if clients.2nth.ai evolves so that enterprise clients need to deploy their own skill customisations or agent hooks without direct access to 2nth's Cloudflare account. Example: a client writes a custom onBriefComplete hook that runs inside 2nth's AI pipeline.

Until that pattern exists, use standard Workers deployed per client environment.

How it works (concept)

Inbound request
    ↓
Dispatch Worker (you control) — routes by tenant ID
    ↓
Customer Worker (tenant code, isolated namespace)

Key primitives

// wrangler.toml — dispatch namespace binding
[[dispatch_namespaces]]
binding = "DISPATCH"
namespace = "2nth-client-plugins"

// Dispatch Worker
export default {
  async fetch(request: Request, env: Env) {
    const tenantId = request.headers.get('x-tenant-id');
    const userWorker = env.DISPATCH.get(tenantId);
    return userWorker.fetch(request);
  }
}

See Also