SHOPin Logo
Skip to main documentation content

Integrations

Packages under integrations/ in the SHOPin storefront accelerator are data source adapters: NestJS modules that talk to external APIs (or mocks), map results to @core/contracts, and expose a service provider token that the BFF injects into DataSourceFactory (data-source.module.ts, data-source.factory.ts).

Reference trees in the repo include integrations/commercetools-api, integrations/mock-api, and integrations/contentful-api when present—the exact list can change; use integrations/ as source of truth.

Package layout

Illustrative tree (integrations/your-package/):

integrations/your-package/
├── src/
│   ├── *-api.module.ts           # Main module
│   ├── *-service-provider.ts     # Service provider
│   ├── interfaces.ts
│   ├── index.ts
│   ├── client/
│   │   └── client.module.ts      # API client config
│   ├── services/
│   │   ├── index.ts
│   │   ├── product.service.ts
│   │   ├── navigation.service.ts
│   │   └── *.service.ts
│   └── [supporting-dirs]/        # mappers, helpers, queries, schemas, generators
├── package.json
├── tsconfig.json
└── turbo.json

File names such as product.service.ts are examples—match domains your integration actually implements.

Anatomy

  1. Main module (*-api.module.ts) — Often @Global(); exports the provider token (e.g. COMMERCETOOLS_SERVICE_PROVIDER, MOCK_SERVICE_PROVIDER); registers service implementations; imports the client module.
  2. Service provider (*-service-provider.ts) — Implements the *ServiceProvider interface; aggregates services behind one getServices() shape; injects concrete services.
  3. Client module (client/client.module.ts) — SDK or HTTP client, environment, authentication; request-scoped where needed; may use language/locale for localised APIs.
  4. Services (services/) — Implement interfaces and types from @core/contracts; index.ts re-exports classes the module registers.
  5. Supporting codeLive APIs: mappers/, helpers/, queries/, schemas/. Mock: generators/, helpers/.

Provider token names and folder layout are illustrative—copy from an existing integration in the monorepo.

Guides

Summary

ConcernWhere to look
BFF wiringData sources, BFF
API shapesMaintain contracts
Data source keysConfig & constants
New package shapeOther workspaces

Related

Back to BFF & data · Back to How to work with SHOPin