GraphQL Apollo Federation
When building out an enterprise headless eCommerce architecture there are several pieces to the puzzle from product information and marketing content to specific B2B pricing and warehouse stock. All is needed to build a great shopping experience. With GraphQL the idéa is to have one single API endpoint where you can access all data easily. With Apollo Federation you can have a single data graph across multiple services. For example custom pricing, real time stock combined with rich product information and marketing content.
Crystallize supports Apollo Federation in the GraphQL catalogue API. This allows you to combine the rich product information from Crystallize with multiple other services in a single GraphQL API or gateway.
This approach enables you to separate the concerns from the different internal services and still have them exposed in a fast external facing GraphQL API. It can also be used to future proof your eCommerce architecture as you are able to swap out services in the future and still keep the same global graph API. For example with partial migration of services to a more modern architecture.
When is Apollo Federation useful?
Apollo federation is useful in cases where you want real time integration from several services. The different services have deficient concerns and are joined in a gateway combining them all.
Older services typically will not support GraphQL so you most likely have to build a middle layer to translate the old type of API and perhaps also handle some performance optimizations to make sure the API is fast. This middle layer is ideal for use cases when you want to swap out legacy services in the future, but want to make it a gradual approach.
Examples of uses of Apollo Federation in combination with rich product information and marketing content from Crystallize:
- Real time inventory from one or multiple warehouses
- Custom pricing for the customer, typically used in B2B eCommerce
- Wrapping legacy services for simpler migration
- Defining an enterprise service layer for data