Today Platform Web — Dev Docs
Architecture

Backend domains

Dev and production backend domain resolution in packages/auth-client.

The frontend supports two backend targets:

Backend targetWeb originAuth originAPI origin
Devtodayai.devauth.todayai.devapi.todayai.dev
Productiontoday.aiauth.today.aiapi.today.ai

Local next dev and Vercel preview builds use the dev backend. Production builds use the production backend.

The mapping lives in packages/auth-client/src/urls.ts:

export const DOMAINS: Record<AppEnvironment, string> = {
  development: 'todayai.dev',
  preview: 'todayai.dev',
  production: 'today.ai',
}

Resolvers

resolveDomain(env?)       // 'todayai.dev' / 'today.ai'
resolveAuthBaseUrl(env?)  // 'https://auth.<domain>'
resolveApiBaseUrl(env?)   // 'https://api.<domain>'
resolveAppBaseUrl(env?)   // 'https://<domain>'

Each resolver checks for an explicit env override before falling back to the computed default:

export function resolveAuthBaseUrl(env?: Env): string {
  if (env) {
    return (
      env.OIDC_INTERNAL_AUTHORITY ||
      env.NEXT_PUBLIC_OIDC_AUTHORITY ||
      `https://auth.${resolveDomain(env)}`
    )
  }
  return (
    process.env.OIDC_INTERNAL_AUTHORITY ||
    process.env.NEXT_PUBLIC_OIDC_AUTHORITY ||
    `https://auth.${resolveDomain()}`
  )
}

OIDC_INTERNAL_AUTHORITY remains available for server-to-server auth routing, but local web development should point it at the deployed dev auth backend.

Environment Detection

if (NODE_ENV === 'development') return 'development'
if ((VERCEL_ENV ?? NEXT_PUBLIC_VERCEL_ENV) === 'production') return 'production'
return 'preview'

development and preview both resolve to the dev backend. production resolves to the production backend.

On this page