Platform Agnostic
Learn how to integrate a different eCommerce engine
Enterprise Commerce is designed with a platform-agnostic architecture, allowing for seamless integration with various e-commerce engines. While the starter is integrated with Shopify by default, it is not tightly coupled to the platform.
The key to this flexibility lies in the platform module, which utilizes the Factory pattern with different strategies. Shopify is set as the default strategy, but the architecture enables developers to integrate the starter with other e-commerce platforms, such as BigCommerce, by simply adding their own strategy to the platform layer.
Platform Module Structure
At the core of this architecture is the platform
module, which implements the Factory pattern to support different e-commerce platform strategies.
The directory structure of the platform
module is as follows:
Extending the Platform Module
To integrate Enterprise Commerce with a different e-commerce engine, such as BigCommerce, developers simply need to extend the platform layer by adding their own strategy. This addition requires no changes to the frontend layer, maintaining a consistent API across different e-commerce backends.
Here’s a high-level overview of the steps to extend the platform module:
- Create a new directory within the
platform
module to house the new strategy, e.g.,bigcommerce
. - Implement the necessary normalization logic, GraphQL fragments, queries, mutations, and TypeScript types similar to the existing
shopify
strategy. - Update the
platform
module’sindex.ts
to include and expose the new strategy through the Factory pattern.