Architecture: Should preview use mock data stubs or real backend HTTP for ...

Documentation for Sessions

🏗️ Architecture: Should preview use mock data stubs or real backend HTTP for ...

Date: 2026-03-16
Time: 15:18:55 UTC
Session: gspace1-225.3
Agent: backend
Confidence: 85%
Status: ✅ Documented


📋 Decision Context

Question:

Should preview use mock data stubs or real backend HTTP for CRUD operations?

Task: Not specified


🎯 Decision Made

Chosen:

Real HTTP proxy to backend-api (port 3000). UniverseDataService stub makes actual POST/PUT/DELETE calls to the same REST endpoints the deployed platform will use. Graceful catchError fallback returns empty data if backend unavailable.

Options Considered:

  1. Noop stubs returning of([]) — rejected: hides real capability
  2. Mock API with seed data (gmodules1 pattern) — rejected: unnecessary when real backend exists
  3. Real HTTP proxy with catchError fallback (chosen) — leverages existing infrastructure

💭 Reasoning

gspace1 already has 4 real NestJS backends with MongoDB, UniverseDataService, and Cloudflare R2. The generated code is already wired to call UniverseDataService.query(). Using noop stubs that return of([]) defeats the purpose — gmodules1 (which has NO real backend) shows more data than gspace1 (which has full infra). The blob URL iframe origin http://localhost:6200 passes CORS (cors.factory.ts allows all localhost). spaceId/universeId available in SdkPreviewConfig. Auth guard may block requests — catchError handles this gracefully.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation