Public boundary
The web server accepts all external traffic:- browser sessions
- Better Auth callbacks
- agent and CLI API calls
- Cloudflare OAuth callbacks
- Cloudflare Worker ingest notifications at
POST /rpc/agent-mail/ingest/v1/{connectionPublicId}
Internal services
Compose keeps internal services on the Compose network. Helm keeps them behind cluster-internal services. Operator-owned ingress, tunnels, and reverse proxies must route only to the web server.
Credential boundaries
Admin credentials configure the platform. User credentials authorize domain provisioning.
User-domain setup is not an environment-variable workflow. A signed-in user connects Cloudflare through OAuth, selects a zone, and the web server uses that grant to provision domain-specific DNS, Email Routing, Worker state, and archive bindings.
Token scope requirements
The Cloudflare OAuth app must request the required scopes listed in Environment Variables. The admin Cloudflare Worker API token must be scoped to the Cloudflare account that owns the service-level Worker and must have account-level Workers Scripts read/write access. AgentTeam Email provisions this Worker at startup and calls it only for authenticatedPOST /oauth2/token forwarding to Cloudflare’s OAuth
token endpoint when server egress is challenged.
The admin R2 API token must be scoped to the Cloudflare account that owns the archive bucket and must be able to call the R2 temporary credentials API for that bucket. AgentTeam Email requests object-read-write temporary credentials scoped to the connected domain archive prefix.
The admin Cloudflare Worker API token, service-level Worker password, and admin
R2 API token must not be reused as user-domain Cloudflare credentials.
User-domain DNS, Email Routing, Worker deployment, Worker R2 bindings, and
outbound Cloudflare Email Sending belong to the connected user’s OAuth grant.
Secret handling
- Generate every secret independently per environment.
- Store secrets in
.env, a deployment secret manager, or Kubernetes Secrets. - Do not commit secrets, tokens, passwords, OAuth credentials, or R2 keys.
- Do not log or render OAuth access tokens, raw API keys, passwords, Worker webhook signing secrets, or decrypted stored secrets.
- Do not copy Cloudflare OAuth access tokens into browser-visible config.
Worker bindings
Operators do not set generated domain Worker bindings directly in Compose or Helm. Domain provisioning generates bindings for each connected domain. The service-level Worker password binding is provisioned by the web server from admin configuration and is separate from these generated domain bindings. Generated Worker bindings include:AGENTTEAM_INGEST_URL is derived from the public hostname, /rpc/agent-mail/ingest/v1, and the Worker connection public ID. AGENTTEAM_WORKER_HMAC_SECRET stores the deployment-owned Standard Webhooks signing secret encrypted by the web app.