Architecture: How should frontend components reference backend types (role...

Documentation for Sessions

🏗️ Architecture: How should frontend components reference backend types (role...

Date: 2026-02-21
Time: 17:06:38 UTC
Session: gspace1-131.7
Agent: backend
Confidence: 95%
Status: ✅ Documented


📋 Decision Context

Question:

How should frontend components reference backend types (roles, channel types, permissions) that live in backend-only libraries?

Task: Not specified


🎯 Decision Made

Chosen:

Export backend types from shared library and import where possible; mirror where not

Options Considered:

  1. Duplicate types in each component
  2. Create a shared frontend types library
  3. Import backend types via deep paths
  4. Export backend types from shared library and import where possible; mirror where not

💭 Reasoning

Session 132 audit found 3 type misalignment issues: (1) ChannelPermissionMatrix invented roles (member|guest) not in SpaceRole, (2) ChannelManager duplicated ChannelType missing sms+telegram, (3) GroupMemberRoles used alias chain instead of source type. Fix: SpaceRole/SpaceMember/SpacePermissions now exported from @libs-foundational/core-models (pure types, no Angular deps). ChannelType stays mirrored with a doc-comment linking to the backend source since @libs-api/messaging-core is NestJS-only. Rule: if the type is in a framework-agnostic shared lib, import it. If it is in a backend-only module, mirror it with a comment pointing to the source.


📁 Files Involved


🔗 Related


Auto-generated by MCP Smart Consolidation