Architecture: How should we manage API URLs across the codebase to support...
Documentation for Sessions
🏗️ Architecture: How should we manage API URLs across the codebase to support...
Date: 2026-02-03
Time: 03:21:33 UTC
Session: editor2-76.86
Agent: architecture
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
How should we manage API URLs across the codebase to support both development and production environments?
Task: Session 82.5 - Environment-Aware URLs: Centralized API token pattern
🎯 Decision Made
Chosen:
Use centralized injection tokens from @libs-foundational/api-config
Options Considered:
- Keep hardcoded URLs and add environment checks in each file
- Use environment variables passed from build config
- Use centralized injection tokens from @libs-foundational/api-config
💭 Reasoning
Provides single source of truth for all API URLs with automatic environment detection via smart factories. Type-safe with Angular's DI system, easy to test and override in tests, prevents scattered hardcoded URLs. Found 13+ files with hardcoded localhost URLs that would break in production - this pattern eliminates that risk.
📁 Files Involved
libs/libs-foundational/api-config/src/lib/api-tokens.tsapps/gograb-space/src/environments/environment.shared.ts
🔗 Related
- Decision ID:
dev_1770088892226_qttnj4j - Session: 76
- Workspace: editor2
Auto-generated by MCP Smart Consolidation