Environment And Services
Last refreshed: 2026-07-22
Source Of Truth
Start from .env.example for host-run configuration. For Compose, copy
.env.compose.example to the ignored .env.compose and replace every
placeholder. Do not copy secret values into docs, logs, or commits.
After the accepted ANU-7 cutover, .env.compose POSTGRES_DB selects the
restored local database used by the containerized CMS. The original Supabase
DATABASE_URI remains unchanged in ignored .env as the tested rollback path;
do not copy that URI into .env.compose, Markdown, command output, or Git.
Active Environment Keys Observed
Active .env currently includes:
BETTER_AUTH_SECRETCRON_SECRETDATABASE_URIELEVENLABS_API_KEYGOOGLE_GENERATIVE_AI_API_KEYNEXT_PUBLIC_BETTER_AUTH_URLNEXT_PUBLIC_SERVER_URLOPENAI_API_KEYPAYLOAD_DB_PUSHPAYLOAD_SECRETPG_POOL_MAXPREVIEW_SECRETRESEND_API_KEYS3_ACCESS_KEY_IDS3_BUCKETS3_ENDPOINTS3_PRIVATE_BUCKETS3_REGIONS3_SECRET_ACCESS_KEYSEED_USER_EMAILVISUAL_MATCHING_DEBUG_MODEZOHO_BILLING_ACCESS_TOKENZOHO_BILLING_ACCOUNTS_BASE_URLZOHO_BILLING_API_BASE_URLZOHO_BILLING_CLIENT_IDZOHO_BILLING_CLIENT_SECRETZOHO_BILLING_ORGANIZATION_IDZOHO_BILLING_REFRESH_TOKENZOHO_BILLING_WEBHOOK_SECRET
Compose Environment
.env.compose owns only machine-local stack configuration:
POSTGRES_DB,POSTGRES_USER,POSTGRES_PASSWORD, andPOSTGRES_PORTPGADMIN_DEFAULT_EMAIL,PGADMIN_DEFAULT_PASSWORD, andPGADMIN_PORTWEB_PORT,PAYLOAD_DB_PUSH,PG_POOL_MAX, andMASTRA_PG_POOL_MAX- local Payload, Better Auth, and worker API secrets
- container-specific overrides such as
S3_ENDPOINT=host.docker.internal
Compose reads the optional ignored .env first and .env.compose second. The
web, RAG worker, and presentation worker services then override DATABASE_URI
with the internal postgres:5432 endpoint. Worker services explicitly disable
Payload schema push and wait for the health-gated web initializer. Tracked
examples contain placeholders only.
The external render worker API now expects ANUVA_WORKER_API_TOKEN to be defined in environments
that serve /api/worker/v1.
Services
- Local Postgres 17.10 with pgvector 0.8.2: Payload, app data, Mastra storage, and RAG vectors.
- Local pgAdmin 9.16: browser administration of the local Postgres service.
- Local web container: Node 22.5.1 development runtime with source hot reload.
- Local RAG worker container: polls and processes
rag_ingestion_jobs. - Local presentation worker container: polls and processes
presentation_generation_jobs. - S3-compatible storage: public/private media and uploads.
- Worker API auth: bearer token from
ANUVA_WORKER_API_TOKEN. - Resend: email delivery.
- OpenAI: text, web search, embeddings, image generation.
- Google Generative AI: provider key present; verify specific use before depending on it.
- ElevenLabs: TTS/audio generation.
- Zoho Billing: plans, customers, credit pack purchases, webhooks, reconciliation.
flowchart TD
env[".env"] --> next["Next.js runtime"]
env --> workers["Worker scripts"]
env --> payload["Payload config"]
next --> postgres["🗄️ Postgres"]
next --> storage["🪣 S3 storage"]
next --> providers["✨ AI providers"]
next --> email["✉️ Resend"]
next --> billing["💳 Zoho Billing"]
workers --> postgres
workers --> providers
payload --> postgres
Payload DB Push
PAYLOAD_DB_PUSH=1 enables Payload schema push. The Payload config raises PG_POOL_MAX behavior for push-mode startup to avoid low-pool issues. Use carefully against hosted databases.
The application contains no Supabase-hostname exception. Schema push is
controlled only by PAYLOAD_DB_PUSH. Compose defaults it to 1; its web
launcher retains that value for an empty machine-local database and changes it
to 0 when Payload tables already exist, preventing repeat push on restart.
Keep it disabled for databases where reviewed migrations are required, then run
pnpm payload migrate against a connection that is authorized to execute DDL.
Local Environment Note
The supported local stack and migration/recovery runbook are documented in
LocalDevelopmentStack.md. ANU-7
completed the accepted local cutover with source/target parity, application
smoke, persistence, and rollback-connectivity evidence. Future refreshes must
repeat the guarded workflow; the presence of a local database alone is not
parity evidence.