Deploy
For: an operator who deploys an API with authtempo for the first time.
What it does: this guide lists each setting of a production deploy, and the fault that each one prevents.
Before you start
Section titled “Before you start”- An API that passes its tests. Do a getting started tutorial first.
- A Cloudflare account, on Workers. With
password, a Workers Paid plan.
- Set
baseURLto the origin of the API, withhttps:. - Put each origin of the app in
trustedOrigins, and each app scheme of a native app. - Store
secretas a secret of 32 characters or more, never in the code. It needs an estimate of 100 bits or more: make one withopenssl rand -base64 32. - Use the owned limiter of your adapter:
createD1LimiterorcreatePostgresLimiter. - Replace the mail port with a call to your mail provider.
- Apply every migration before the first request. Upgrades tells how.
- Run
auth.api.sweepExpired()on a schedule, such as once an hour. - Off Workers, pass
clientIp, and read only the header that your server or proxy sets. Without it, every request with no client IP is one client for each per-IP limit. In the body budget, it is one client of 4 MiB. - Deploy.
- Sign in once by each method that the API serves.
- Run
authtempo checkwith the base URL of the API. Each check must pass, or skip for a feature that is off. - Point a probe at
GET /auth/health. Withobserve.readiness: true, point the readiness probe atGET /auth/ready.
The probes
Section titled “The probes”GET /auth/health answers 200 { "status": "ok" } in every deployment. It reads no storage, so it shows that the process answers. GET /auth/ready exists only with observe.readiness: true. It checks the store, and answers 200 { "status": "ready" } or 503 not_ready with the reason storage or schema. It holds one result for 10 seconds, so a probe that calls it often makes one storage call in each window. Neither route counts on a limiter.
On Workers, no host runs a probe. Point an external monitor at the route, once a minute:
curl -fsS https://api.example.com/auth/healthOn Node, a container probe calls the route from inside the container:
HEALTHCHECK --interval=30s CMD node -e "fetch('http://localhost:3000/auth/health').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))"On Bun, the same probe runs with bun:
HEALTHCHECK --interval=30s CMD bun -e "fetch('http://localhost:3000/auth/health').then((r) => process.exit(r.ok ? 0 : 1), () => process.exit(1))"With observe.readiness: true, a probe can call /auth/ready in place of /auth/health. Then the container is healthy only while the store answers. With readiness off, /auth/ready answers 404, and the container stays unhealthy.
Use GET: a HEAD request to these routes answers 404.
The Workers settings
Section titled “The Workers settings”| Setting | Value | Without it |
|---|---|---|
compatibility_date |
2026-09-30, the date of the examples |
Another date can change the default flags. |
compatibility_flags on D1 |
no_nodejs_compat, no_nodejs_compat_v2 |
Node.js compatibility is on by default from 2026-08-04. |
compatibility_flags on Postgres |
nodejs_compat |
postgres.js cannot open a socket. |
triggers.crons |
["17 * * * *"] |
Expired rows stay in the database forever. |
AUTH_SECRET |
pnpm --filter my-app exec wrangler secret put AUTH_SECRET |
The secret lies in the config, readable by each person with the repo. |
| The plan | Workers Paid with password |
One PBKDF2 hash needs more CPU than Workers Free gives one request. |
How it behaves
Section titled “How it behaves”- The memory limiter counts per isolate. On Workers the real limit is the limit times the isolate count, so it is for tests only.
- The default
clientIpreadscf-connecting-ip. Only Cloudflare sets it, so off Workers a caller can set it. - A request with no client IP counts against one shared IP budget.
- A host with no
clientIpmakes every caller with no client IP one client of 4 MiB in the budget of the large body reads. On Node or Bun, one caller that stalls large posts can hold that share. Then the SAML ACS, the Apple callback, and SCIM answer 503 to every caller with no client IP. The 503 continues while that caller sends 4 MiB each 10 s. The callers with an IP key still read. - Keep the API on its own registrable domain. A sibling subdomain cannot set the
__Host-session cookie, but it can set the trust cookie for the parent domain.
If it fails
Section titled “If it fails”- Every route answers 500 with a storage error: a migration is missing. The adapter throws
schema_mismatchuntil the migrations run. origin_not_trusted: the app’s origin is not intrustedOrigins.rate_limitedfor every caller: the host gives no client IP, so all callers share one budget.body_busyat the SAML ACS for every caller with no client IP: the host gives none, so one caller holds their one share.- A sign-in request answers 500: the mail port throws.
GET /auth/readyanswers 503not_readywithschema: a migration is missing. Withstorage, the store does not answer in 3 seconds, or it throws.authtempo checknames a code. authtempo check gives the fix of each code.