Background
All ObjectStack-owned environment variables should be prefixed OS_* for namespace hygiene. Audit (see chat) surfaced inconsistencies in three buckets:
- Internal vars without OS_ prefix — should be renamed (no upstream convention to honour).
- Existing OS_ canonical with legacy alias — alias should be deprecated.
- Third-party / SDK conventions — keep as-is (e.g.
OPENAI_API_KEY, TURSO_DATABASE_URL, BETTER_AUTH_URL, OAuth *_CLIENT_ID/SECRET, RESEND_API_KEY). Out of scope for this issue.
PORT and DATABASE_URL are Heroku/12-factor industry conventions; they keep working as silent fallbacks for OS_RUNTIME_PORT / OS_DATABASE_URL without deprecation noise.
Scope (Categories ① + ②)
① Rename (internal, no upstream)
| Current |
New |
AUTH_BASE_URL |
OS_AUTH_BASE_URL |
CORS_ENABLED |
OS_CORS_ENABLED |
CORS_ORIGIN |
OS_CORS_ORIGIN |
CORS_CREDENTIALS |
OS_CORS_CREDENTIALS |
CORS_MAX_AGE |
OS_CORS_MAX_AGE |
AI_MODEL |
OS_AI_MODEL |
MCP_SERVER_ENABLED |
OS_MCP_SERVER_ENABLED |
MCP_SERVER_NAME |
OS_MCP_SERVER_NAME |
MCP_SERVER_TRANSPORT |
OS_MCP_SERVER_TRANSPORT |
OBJECTSTACK_DEV_CRYPTO_KEY |
OS_DEV_CRYPTO_KEY |
OBJECTSTACK_METADATA_WRITABLE |
OS_METADATA_WRITABLE |
OBJECTSTACK_NODE_ID |
OS_NODE_ID |
Affected files: packages/cli/src/commands/serve.ts, packages/plugins/plugin-hono-server/src/hono-plugin.ts, packages/adapters/hono/src/index.ts, packages/plugins/plugin-auth/src/auth-manager.ts, packages/services/service-ai/src/plugin.ts, packages/plugins/plugin-mcp-server/src/plugin.ts, examples/app-crm/test-backend.mjs, packages/objectql/src/protocol-meta-types-rich.test.ts, packages/plugins/plugin-webhooks/src/webhook-outbox-plugin.ts.
② Deprecate legacy alias (canonical OS_ already exists)
| Legacy |
Canonical |
Action |
AUTH_SECRET |
OS_AUTH_SECRET |
Keep fallback, log deprecation warning once |
ROOT_DOMAIN |
OS_ROOT_DOMAIN |
Keep fallback, log deprecation warning once |
OS_MULTI_TENANT |
OS_MULTI_ORG_ENABLED |
Keep fallback, log deprecation warning once |
Behaviour
- For ①: keep reading legacy name as silent fallback for at least one minor release so user
.env files don't break, but emit a one-shot console.warn('[OS] Env var X is deprecated; use OS_X') on first read.
- For ②: same — fallback + one-shot deprecation warning.
- No legacy reads for brand-new vars (would never have been published).
Out of scope
- Category ③ third-party conventions.
PORT / DATABASE_URL industry fallbacks remain silent.
Acceptance
- All call sites read OS_-prefixed name first, fall back to legacy.
- Deprecation warning helper is centralised (not duplicated).
- Docs /
.env.example / changesets updated.
- AGENTS.md guard: "All new env vars MUST start with
OS_".
pnpm test green.
Background
All ObjectStack-owned environment variables should be prefixed
OS_*for namespace hygiene. Audit (see chat) surfaced inconsistencies in three buckets:OPENAI_API_KEY,TURSO_DATABASE_URL,BETTER_AUTH_URL, OAuth*_CLIENT_ID/SECRET,RESEND_API_KEY). Out of scope for this issue.PORTandDATABASE_URLare Heroku/12-factor industry conventions; they keep working as silent fallbacks forOS_RUNTIME_PORT/OS_DATABASE_URLwithout deprecation noise.Scope (Categories ① + ②)
① Rename (internal, no upstream)
AUTH_BASE_URLOS_AUTH_BASE_URLCORS_ENABLEDOS_CORS_ENABLEDCORS_ORIGINOS_CORS_ORIGINCORS_CREDENTIALSOS_CORS_CREDENTIALSCORS_MAX_AGEOS_CORS_MAX_AGEAI_MODELOS_AI_MODELMCP_SERVER_ENABLEDOS_MCP_SERVER_ENABLEDMCP_SERVER_NAMEOS_MCP_SERVER_NAMEMCP_SERVER_TRANSPORTOS_MCP_SERVER_TRANSPORTOBJECTSTACK_DEV_CRYPTO_KEYOS_DEV_CRYPTO_KEYOBJECTSTACK_METADATA_WRITABLEOS_METADATA_WRITABLEOBJECTSTACK_NODE_IDOS_NODE_IDAffected files:
packages/cli/src/commands/serve.ts,packages/plugins/plugin-hono-server/src/hono-plugin.ts,packages/adapters/hono/src/index.ts,packages/plugins/plugin-auth/src/auth-manager.ts,packages/services/service-ai/src/plugin.ts,packages/plugins/plugin-mcp-server/src/plugin.ts,examples/app-crm/test-backend.mjs,packages/objectql/src/protocol-meta-types-rich.test.ts,packages/plugins/plugin-webhooks/src/webhook-outbox-plugin.ts.② Deprecate legacy alias (canonical OS_ already exists)
AUTH_SECRETOS_AUTH_SECRETROOT_DOMAINOS_ROOT_DOMAINOS_MULTI_TENANTOS_MULTI_ORG_ENABLEDBehaviour
.envfiles don't break, but emit a one-shotconsole.warn('[OS] Env var X is deprecated; use OS_X')on first read.Out of scope
PORT/DATABASE_URLindustry fallbacks remain silent.Acceptance
.env.example/ changesets updated.OS_".pnpm testgreen.