Infrastructure
The edge service is deployed across two platforms: Cloudflare Workers (compute and routing) and Auth0 (identity provider actions and tenant policy). Cloudflare Workers deployments and route bindings are managed via wrangler.toml and wrangler publish. Supporting infrastructure — DNS records, Auth0 actions, and the GrowthBook proxy — is managed by Terraform from the deploy/ directory. Worker binaries are built with webpack and published via wrangler.
The Terraform state backend is S3 at key terraform/edge/terraform.tfstate.
Provider versions in use:
-
cloudflare/cloudflare4.52.5 -
auth0/auth01.33.0 -
hashicorp/aws6.19.0
Environments
Edge supports multiple named environments controlled by the FLOATME_ENVIRONMENT variable (default: test). Every resource is namespaced by environment so prod and test are fully isolated.
Worker environment split
Each wrangler.toml defines a [env.prod] and [env.test] stanza. The top-level name/route keys are local-dev defaults only. Wrangler is always invoked with --env $FLOATME_ENVIRONMENT so the correct name and route pattern are selected at publish time.
| Worker | prod route | test route |
|---|---|---|
auth |
|
|
backoffice-auth |
|
|
sms |
|
|
links |
|
|
Auth0 tenant split
The auth and backoffice-auth workers point to different Auth0 tenants per environment. This is a hard split — prod and test use entirely separate tenants with separate client IDs, management credentials, and MFA audiences.
| Worker | prod tenant | test tenant |
|---|---|---|
auth |
|
|
backoffice-auth |
|
|
Castle blocking (ENABLE_CASTLE_BLOCKING) is set to "true" in prod and "false" in test, so fraud signals are enforced only in production.
Environment → Worker Deployed Name → Cloudflare Route ──────────────────────────────────────────────────────────────── prod auth prod-auth auth.floatme.io/* prod backoffice-auth prod-backoffice-auth auth.backoffice.floatme.io/* prod sms prod-sms sms.floatme.io/* prod links prod-links links.floatme.io/* test auth test-auth auth.test.floatme.io/* test backoffice-auth test-backoffice-auth auth.backoffice.test.floatme.io/* test sms test-sms sms.test.floatme.io/* test links test-links links.test.floatme.io/*
Cloudflare Workers
Workers are TypeScript source files. Three workers (auth, sms, waitlist) are compiled by webpack into ES module bundles under dist/cloudflare/workers/<name>/index.mjs. The backoffice-auth and links workers are published directly from source via wrangler without a webpack build step. Each worker has its own wrangler.toml in cloudflare/workers/<name>/.
| Worker | Source | Wrangler config | Purpose |
|---|---|---|---|
auth |
|
|
Auth0 proxy for the FloatMe mobile app. Handles login, signup, MFA, social auth, password reset, session tokens, and Castle fraud checks. |
backoffice-auth |
|
|
Auth0 proxy for the internal backoffice admin console. Uses a dedicated Auth0 tenant. |
sms |
|
|
"Text me the app" (TMTA) worker — sends an SMS with the app download link via Twilio. |
links |
|
|
Deeplink rewriter ( |
Worker environment variables
Non-secret configuration is declared inline in wrangler.toml under [env.<name>.vars]. Secrets are uploaded separately via wrangler secret put (see Secrets Management).
| Variable | prod value | test value |
|---|---|---|
|
|
|
|
||
|
|
|
|
||
|
||
|
|
|
|
|
|
|
|
|
| Variable | prod value | test value |
|---|---|---|
|
||
|
|
|
|
||
|
|
|
| Variable | Value |
|---|---|
|
|
|
|
|
|
The links worker has no non-secret vars; it uses only WORKER_ENV.
DNS
DNS records are managed in Terraform, all within the floatme.io Cloudflare zone (zone ID supplied via var.cloudflare_zone_id). All records are proxied through Cloudflare.
| Resource (Terraform) | Type | Name (prod) | Name (test) | Purpose |
|---|---|---|---|---|
|
AAAA |
|
|
Discard record ( |
|
CNAME |
|
|
CNAME to |
Worker routes for auth, sms, and links are defined in each worker’s wrangler.toml (not Terraform) and are registered with Cloudflare when wrangler publishes the worker.
GrowthBook Proxy
deploy/growthbook_proxy.tf provisions a Cloudflare DNS CNAME record that points growthbook.floatme.io (prod) or test-growthbook.floatme.io (test) at cdn.growthbook.io. The record is proxied, meaning all GrowthBook SDK requests from FloatMe clients flow through Cloudflare rather than directly to GrowthBook’s CDN.
This provides two benefits:
-
Cloudflare caches the GrowthBook feature flag payload at the edge, reducing latency for SDK initialization.
-
FloatMe controls the DNS name, so the GrowthBook CDN URL can be changed without updating client builds.
Auth0 Actions
Auth0 Actions are deployed via Terraform (deploy/auth0_actions.tf). All actions run Node.js 18. They are automatically deployed (deploy = true) when Terraform applies.
| Terraform resource | Action name (env-prefixed) | Trigger | Source file |
|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
The post-login trigger pipeline (auth0_trigger_actions.login_flow) runs ip-metadata first, then mfa-custom-claim, on every post-login event.
The auth0/rules/ directory contains legacy Auth0 rules that have been superseded by Actions and are not deployed or documented.
|
Secrets Management
Secrets are never stored in wrangler.toml. They are uploaded directly to the Cloudflare Workers secret store using wrangler secret put --env $FLOATME_ENVIRONMENT. Each worker has a secrets.sh script in its source directory.
Run all secrets in one pass:
FLOATME_ENVIRONMENT=prod make secrets.host
Or per-worker:
FLOATME_ENVIRONMENT=prod make secrets.auth.host
FLOATME_ENVIRONMENT=prod make secrets.backoffice-auth.host
FLOATME_ENVIRONMENT=prod make secrets.sms.host
FLOATME_ENVIRONMENT=prod make secrets.links.host
make secrets.host also invokes make secrets.waitlist.host for the deprecated waitlist worker. The waitlist worker is not documented (it is excluded from this documentation per the deprecation policy), but its secret upload target remains in the Makefile and runs as part of the full secrets.host pass.
|
| Worker | Secret name (in Cloudflare) | Source env var |
|---|---|---|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
auth |
|
|
backoffice-auth |
|
|
backoffice-auth |
|
|
sms |
|
|
sms |
|
|
links |
|
|
The AWS credentials uploaded to the auth worker (FLOATME_AWS_ACCESS_KEY_ID / FLOATME_AWS_SECRET_ACCESS_KEY) are scoped to the IAM user named by var.cloudflare_workers_iam_user_name and are used to sign SigV4 requests to the user-service API Gateway.
Build and Publish Flow
Building workers
make build # runs webpack inside the Docker devkit container
make build.host # runs webpack directly on the host (requires Node + webpack)
Both targets invoke webpack and output compiled bundles to dist/cloudflare/workers/<name>/index.js. A final edge.tar.gz is created in dist/ containing all built artifacts.
The webpack config compiles all four workers in a single pass. The build is a prerequisite of the tarball target.
Publishing workers
After building, publish each worker with wrangler:
FLOATME_ENVIRONMENT=prod \
wrangler publish dist/cloudflare/workers/auth/index.js \
--env prod \
-c cloudflare/workers/auth/wrangler.toml
Repeat for each worker. The --env flag selects which wrangler.toml stanza ([env.prod] or [env.test]) to use for the worker name and route pattern.
For local development, wrangler dev can be started per-worker without building:
make auth.local # wrangler dev --env test (auth worker)
make backoffice-auth.local # wrangler dev --env test (backoffice-auth worker)
make sms.local # wrangler dev (no env flag — uses top-level defaults)
make links.local # wrangler dev (no env flag — uses top-level defaults)
Terraform apply flow
All Terraform is in deploy/. The deploy/Makefile exposes three targets driven by the FLOATME_ENVIRONMENT variable:
cd deploy
FLOATME_ENVIRONMENT=prod make init # terraform init
FLOATME_ENVIRONMENT=prod make plan # terraform plan
FLOATME_ENVIRONMENT=prod make apply # terraform apply
FLOATME_ENVIRONMENT is mapped to TF_VAR_environment automatically by the Makefile. All other TF_VAR_* inputs (Cloudflare zone, Auth0 credentials, Twilio secrets, etc.) are injected from environment variables — see the variable table in deploy/variables.tf for the full list.
The root Makefile also exposes make tf WHAT=<subcommand> which delegates to deploy/Makefile.
Terraform Structure
| File | Contents |
|---|---|
|
Provider configuration for Cloudflare, Auth0, and AWS. S3 backend definition. A secondary |
|
All input variables: environment name, Cloudflare zone/account IDs, Auth0 tenant URLs and credentials, Segment keys, Twilio credentials, user-service API Gateway info, and IAM user name for Cloudflare workers. |
|
Three |
|
|
|
|
Related Pages
-
Architecture — System context diagram, external service integrations, and secrets loading pattern
-
Auth Worker — Handler reference and Castle integration details
-
Backoffice Auth Worker — Admin console auth flow
-
Auth0 Actions — Action logic and post-login pipeline ordering