ADR 0004: Ports and adapters¶
- Status: Accepted
- Date: 2026-08-22
Context¶
Magento orchestration must not be copied into every internal/cloud/<p> package. The CLI must not type factories on a single provider's Spec.
Decision¶
MageLift uses ports and adapters:
- Ports live in
internal/platform(andsdk). They own stack module registration, stable output keys, Magento workloads, and env binding names. They do not import cloud SDKs beyond the PulumiRunFunchanded to Automation API. - Adapters live in
internal/cloud/<provider>/. Each owns topology, catalogs, andtarget.<provider>YAML. - The CLI selects a
StackModulebytarget.provider+target.runtimethroughcmd/magelift/platform.ModuleRegistry.infra.RegisterTargetalone does not shipmagelift deploy. - Day-2 hangs off the same module via small
Has*interfaces:HasOps,HasBootstrap,HasState,HasSecrets,HasRuntimeObserve. An omitted port orErrNotSupportedkeeps that surface experimental. - Stack DIY names include provider and runtime so two clouds do not collide on one backend.
Consequences¶
A third cloud is a new adapter plus module wiring. AWS packages stay under internal/cloud/aws/. Output keys used by portable CLI commands stay Magento-shaped where possible.
Alternatives considered¶
- Shared Pulumi graph with provider switches: rejected (ADR 0003).
- CLI typed on
awsstack.Specforever: rejected (blocks a second provider).
Provenance¶
Original. Matches the current internal/platform and internal/cloud/* layout.