Convention: How should frontend apps configure their API connections?
Documentation for Sessions
📏 Convention: How should frontend apps configure their API connections?
Date: 2026-02-05
Time: 03:49:43 UTC
Session: editor2-89.4
Agent: architecture
Confidence: 95%
Status: ✅ Documented
📋 Decision Context
Question:
How should frontend apps configure their API connections?
Task: Standardizing API configuration across all frontend apps
🎯 Decision Made
Chosen:
Centralized api-config library with presets
Options Considered:
- Each app has its own environment config
- Centralized api-config library with presets
- Hardcoded URLs per environment
💭 Reasoning
All frontend apps (gograb-space, gograb-admin, gograb-dev, gograb-ai) MUST use @libs-foundational/api-config for DRY API configuration. Pattern: (1) Import provideApiConfig and ENVIRONMENT_PRESETS, (2) Use ...provideApiConfig(ENVIRONMENT_PRESETS.localWithProxy) in app.config.ts providers, (3) Reference shared proxy.conf.json at libs/libs-foundational/api-config/proxy.conf.json in project.json serve target, (4) AuthService from @auth-ui automatically uses API_BASE_URL token. This ensures consistent API handling across all apps and makes it easy to switch between mock/proxy/direct modes.
📁 Files Involved
libs/libs-foundational/api-config/src/lib/environment-presets.tslibs/libs-foundational/api-config/proxy.conf.jsonapps/gograb-space/src/app/app.config.ts
🔗 Related
- Decision ID:
dev_1770263383826_5dquua1 - Session: 89
- Workspace: editor2
Auto-generated by MCP Smart Consolidation