4.6 KiB
4.6 KiB
Migration Status Update (October 2025)
The checklist in this document previously claimed a full migration. That was premature. Treat the legacy
@customer-portal/contracts,@customer-portal/schemas, and@customer-portal/integrations-*packages as active until the tasks below are completed.
Current Snapshot
- Provider exports are live: Each domain barrel re-exports a
Providersnamespace (packages/domain/orders/index.ts,packages/domain/billing/index.ts). The subpath mappings inpackages/domain/package.jsonenable imports such asimport { Providers } from "@customer-portal/domain/orders"andimport { transformWhmcsInvoice } from "@customer-portal/domain/billing/providers/whmcs". - Apps still lean on legacy packages: BFF services and controllers continue to import contracts, schemas, and mappers from
@customer-portal/contracts,@customer-portal/schemas, and@customer-portal/integrations-*. Examples includeapps/bff/src/modules/orders/services/order-whmcs-mapper.service.tsandapps/bff/src/integrations/freebit/services/freebit-operations.service.ts. - Legacy domain tree still mounted: Types and schemas under
packages/domain/src/**are still referenced by the apps. That package cannot be removed yet. - Request schemas are misplaced: Freebit and WHMCS request schemas remain under
packages/schemas/src/integrations/**instead of living alongside their providers. - Tooling and docs lag behind: Lint rules, Dockerfiles, CI scripts, and
tsconfigpath aliases still reference the old packages. Documentation (including this file) had not been updated to reflect the real status. - Missing domain coverage: Auth flows, Salesforce entities, and common primitives (address, user profile, etc.) have not been migrated into dedicated
packages/domain/*modules.
What’s Done
- Domain package exposes the new provider-aware barrels and subpath exports.
- Provider mapper logic has been lifted into
packages/domain/<domain>/providers/**for the supported vendors. - New import surface has been verified locally (e.g.
Providers.Whmcs,Providers.Freebit).
Gaps to Close Before Calling the Migration “Complete”
-
Audit & update imports
- Replace
@customer-portal/contracts/*,@customer-portal/schemas/*, and@customer-portal/integrations-*usages across BFF, portal, and integration code with the new domain paths (@customer-portal/domain/<domain>andProviders.<Vendor>). - Remove fallbacks to
@customer-portal/domainroot barrels in favour of explicit subpaths.
- Replace
-
Relocate provider request schemas
- Move Freebit and WHMCS request validators into the relevant provider directories under
packages/domain/<domain>/providers/<provider>. - Update service call sites (e.g.
freebit-operations.service.ts) to import from the new locations.
- Move Freebit and WHMCS request validators into the relevant provider directories under
-
Split out remaining domains
- Introduce an
auth/domain for authentication types and schemas currently stored inpackages/domain/src/**. - Add a
salesforce/(orcommon/salesforce.ts) module for Salesforce entities used by integrations and configuration files. - Consolidate shared primitives in
packages/domain/common/(address, identifiers, etc.).
- Introduce an
-
Retire the legacy domain package
- Once the apps reference only
packages/domain/<domain>, deletepackages/domain/src/**and purge relatedtsconfigand ESLint paths. - Update lint rules (e.g.
eslint.config.mjs) to forbid importing from the legacy packages.
- Once the apps reference only
-
Deprecate old packages
- After consumers migrate, archive or replace
@customer-portal/contracts,@customer-portal/schemas, and@customer-portal/integrations-*with thin re-exports (or remove them entirely if unused). - Ensure Docker builds, CI pipelines, and documentation stop referencing these packages.
- After consumers migrate, archive or replace
-
Portal alignment & verification
- Apply the same import sweep to the portal (
apps/portal/**). - Run full type-checks (
pnpm --filter @customer-portal/bff type-check, etc.) and document remaining issues.
- Apply the same import sweep to the portal (
Suggested Sequence
- Codemod imports across BFF and portal to point at the new domain subpaths and provider namespaces.
- Move request schemas for Freebit and WHMCS into their provider folders; update services accordingly.
- Add new domain modules for auth, Salesforce, and shared primitives; backfill exports.
- Remove legacy references from configs, ESLint, and tooling.
- Retire packages & update docs once all code points at
@customer-portal/domain/*.
Track progress by running targeted type-checks and lint rules after each phase, and update this document as milestones are hit.