Shared Libraries - Overview¶
Purpose¶
Define what may be shared across islands without creating package sprawl or shared mutable domain coupling.
This document follows:
docs/migration/02-island-boundaries-and-performance.mddocs/migration/03-architecture-review-checklist-template.md
Internal Shared Package Cap¶
Maximum internal shared packages: 3.
| Package | Responsibility | Explicitly Not Allowed |
|---|---|---|
atraxion/contracts |
Cross-island API/event DTOs, schemas, contract validation helpers | Domain entities, ORM mappings, business workflows |
atraxion/integration-sdk |
Reusable connector primitives (HTTP/FTP wrappers, retry/backoff, idempotency, signatures) | Platform/supplier business rules |
atraxion/foundation |
Stable primitives (Money, IDs, clocks, typed value objects) | Island-specific services or repositories |
Any additional package requires a formal ADR and must pass the extraction gate checklist.
What Stays Island-Local¶
The following stay inside the owning island:
- Domain entities (
Article,Order,Vehicle,Customer, etc.) - Business workflows (pricing, fitment scoring, checkout, ERP orchestration)
- Repositories and database migrations
- Platform/supplier specific connector behavior
Rule: no shared mutable domain bundle.
Connector Reuse Model¶
Do not create one package per supplier or platform by default.
Preferred model:
- Implement adapters inside the owning island.
- Reuse only connector primitives through
atraxion/integration-sdk. - Extract to shared package only after reuse and stability criteria are proven.
Extraction Criteria (Must All Be True)¶
- Reused by at least 2 islands.
- API expected to stay stable for 6+ months.
- Contains no app-specific entities/workflows.
- Change passed the ADR architecture checklist.
Versioning and Release¶
- Shared packages use semantic versioning.
- Island apps pin package versions and upgrade independently.
- Contract changes in
atraxion/contractsrequire compatibility notes and migration guidance.
Testing Expectations¶
| Package | Required Tests |
|---|---|
atraxion/contracts |
Contract/schema validation tests and backward-compatibility checks |
atraxion/integration-sdk |
Unit tests for retry/idempotency/signature behavior + integration smoke tests |
atraxion/foundation |
Unit tests for all value objects and deterministic behavior |
Migration Notes¶
Legacy bundle-first guidance (core-bundle, article-bundle, vehicle-bundle) is superseded.
During migration:
- Move shared domain entities back to owning islands.
- Keep only stable primitives and contracts in shared packages.
- Update cross-island communication to sync REST + async events using contract DTOs.