Architecture: How to handle API mocking when migrating features from gogra...

Documentation for Sessions

🏗️ Architecture: How to handle API mocking when migrating features from gogra...

Date: 2026-02-05
Time: 03:49:33 UTC
Session: editor2-89.2
Agent: backend
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

How to handle API mocking when migrating features from gograb-modules (no backend) to editor2 (has backend-api)?

Task: Fixing gograb-admin auth - removing mock API interference


🎯 Decision Made

Chosen:

Use environment-based selection (mock vs real backend)

Options Considered:

  1. Keep mock API from gograb-modules as-is
  2. Remove mock API entirely and use real backend-api
  3. Use environment-based selection (mock vs real backend)

💭 Reasoning

When migrating features from gograb-modules monorepo to editor2 monorepo, the mock API interceptors cause conflicts because editor2 has a real backend-api. The solution is NOT to simply remove mocks, but to implement proper environment-based API selection: (1) Development with proxy -> real backend-api via proxy, (2) Development without backend -> mock API, (3) Production -> real backend. All apps should use centralized @libs-foundational/api-config with ENVIRONMENT_PRESETS to auto-select the appropriate API mode. If backend-api is missing features needed by the frontend, implement them in backend-api rather than relying on mocks.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation