Local development
How Oxagen detects a developer machine through OXAGEN_LOCAL_DEV and relaxes deployed-only controls the same way every time, and which signals must stay out of deployment configuration.
Overview
A few controls are on in deployed environments and off on a developer machine: mandatory email verification, the mandatory OAuth-token-encryption key, and hardened cookies. Rate limits stay on locally. Only the Playwright test harness turns them off. Oxagen decides which mode it is in through one predicate that gives the same answer every time.
The OXAGEN_LOCAL_DEV flag
pnpm dev sets OXAGEN_LOCAL_DEV=1 for the whole local stack, so you do not
normally set it by hand. It marks the process tree as a developer machine, and the auth layer
relaxes its deployed-only controls.
Why an explicit flag (and not just NODE_ENV)?
Oxagen builds the auth configuration once, at module load. At that moment,
NODE_ENV alone cannot say whether the process is local:
next devsetsNODE_ENV=developmentslightly late, so the auth module could readproductionduring early boot and bake inrequireEmailVerification: true. That intermittently returned403 EMAIL_NOT_VERIFIEDon local sign-in until an unrelated recompile re-evaluated the module.tsx-run services (apps/api,apps/mcp) never setNODE_ENVat all.
The explicit OXAGEN_LOCAL_DEV flag removes that race. Every process in the stack
detects local mode the same way.
What "local" relaxes
When Oxagen resolves to a local or development environment, it:
- skips mandatory email verification (you sign up and sign in immediately)
- does not require the OAuth-token-encryption master key
- relaxes cookie hardening
Deployment boundary
resolveIsLocalEnv in packages/auth/src/local-env.ts evaluates these signals:
| Signal | Effect |
|---|---|
OXAGEN_LOCAL_DEV=1 or true | Local mode when VERCEL is unset |
NODE_ENV=development or test | Local mode |
VERCEL_ENV=development | Local mode |
E2E_TEST=true | Local mode when VERCEL is unset |
The VERCEL check only protects the first and last branches. It does not identify AWS deployments, and it does not guard the NODE_ENV branches. Keep these development signals out of deployed environments. An incorrect value can disable email verification and relax other authentication controls.
When you set it by hand
Only when you run a service outside pnpm dev (for example, apps/api on its
own with tsx) and want the local relaxations. Export OXAGEN_LOCAL_DEV=1
before you start the process. Never set it in a deployed environment.
Email & SMTP
Configure the SMTP transport that delivers verification and password-reset email. In deployed environments the verification email gates sign-in, so a misconfigured transport blocks every new sign-up. Oxagen logs that failure where you can find it.
Storage driver
STORAGE_DRIVER and the filesystem driver: Oxagen's blob storage without a Vercel Blob token.