Cross-BC ports pattern
Auto-generated from the source archive. Do not edit by hand — rerun
catalyst-changelog-syncinstead.
What changed
Section titled “What changed”- BREAKING (architectural convention) — every cross-bounded-context dependency MUST now follow Ports & Adapters: a port interface + Symbol token under
@app/<consumer>/shared/ports/, an adapter under@api/<supplier>/<module>/infrastructure/adapters/, and a bridge entry under@bridges/. Importing another BC’s module from your own is no longer allowed. - New global composition root
BridgesModule(backend/src/@bridges/bridges.module.ts, decorated@Global()) imports the supplier modules, registers adapters as providers, and exports only tokens — never the adapter classes or the supplier’s services. SharedModuleis promoted to@Global()for coherence with theCacheModule/ConfigModulealready declared global inside it. Redundantimports: [SharedModule]in BC modules are kept intact (deprecating them is CLI codegen work).- The recently-shipped
iam → o-authintegration is refactored as the canonical example: newIClientReaderport +CLIENT_READERtoken, anIamClientReaderAdapteron the o-auth side, and a bridge entry.OAuthModule.exports = [...OAuthServices]andIamModule.imports = [OAuthModule]are reverted.
Why it matters
Section titled “Why it matters”The previous cross-BC integration coupled IamModule to OAuthModule directly and exposed the full OAuthServices catalog. Its own design.md flagged it as conscious tech debt (“PARCHE consciente — no copiar”). Left as-is, future integrations (iam↔message, iam↔whatsapp, message↔notification, …) would have replicated the pattern and catalyst’s module graph would have converged to a tangle of cross-BC imports with no curation of what each BC exposes. The new pattern replaces the legacy QueryBus (which catalyst deliberately removed) with compile-time-typed Ports & Adapters: each BC owns the contract it consumes, each supplier owns the translation to that contract, and the audit surface is one folder — @bridges/. A new skill (catalyst-cross-bc-ports) documents the convention plus the antipatterns. Any handler that needs to read across BC boundaries must be migrated to inject by token.