Architecture: Which Railway variables should each backend service have?

Documentation for Sessions

🏗️ Architecture: Which Railway variables should each backend service have?

Date: 2026-02-10
Time: 17:02:28 UTC
Session: gspace1-102.10
Agent: backend
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

Which Railway variables should each backend service have?

Task: Railway variable standardization - Session 102.3


🎯 Decision Made

Chosen:

Shared across ALL 4: MONGODB_CONNECTION_STRING, MONGODB_DATABASE, OPENAI_API_KEY, ANTHROPIC_API_KEY (production key), GOOGLE_API_KEY, JWT_SECRET, JWT_EXPIRATION, NODE_ENV, SYSTEM_TOKEN, ALLOWED_ORIGINS. Service-specific: backend-api gets PORT=3000 + GITLAB_API_TOKEN + CLOUDFLARE_*. backend-ai-api gets PORT=3001 + BACKEND_API_URL + BACKEND_API_INTERNAL_TOKEN + PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH. backend-docs-api gets PORT=3002 + MONGODB_CONNECTION_STRING_DOCS. backend-vitto-api gets PORT=3003 + VITTO_MONGODB_URI + BACKEND_*_URL + BACKEND_API_INTERNAL_TOKEN.

Options Considered:


💭 Reasoning

Standardized ALLOWED_ORIGINS across all services prevents CORS mismatches. ANTHROPIC_API_KEY differs between dev and production (dev key in .env.local, production key in Railway). MONGODB_CONNECTION_STRING_DOCS must point to gograb-docs cluster (NOT the old test-modules cluster migrated in Session 100). GITLAB_API_TOKEN and CLOUDFLARE credentials are needed by backend-api for tenant management and space deployment.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation