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:

  1. Keep hardcoded URLs and add environment checks in each file
  2. Use environment variables passed from build config
  3. 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


🔗 Related


Auto-generated by MCP Smart Consolidation