addresses many quality attributes, but the ones most applicable to the view presented in this article are usability, maintainability and reusability.
As Mercury is built on top of Sitecore, the architecture adheres closely to the Sitecore Helix principles. This makes it easy for Sitecore developers to get started with Mercury. Each layer consists of several modules which are, per the Helix architecture, business-centric.
This means that grouping is done based on the business objective, e.g. account functionality. Organizing modules this way promotes usability: it makes it intuitive for developers to find functionality.
A Mercury based project consists of several layers:
- Feature (provided by Mercury)
- Foundation (provided by Mercury)
Each project defines its own project specific layer, uses the Mercury provided layers (Feature and Foundation), and will be built on top of the Platform layer. The image below illustrates the architecture layers. A selection of the available Mercury modules is shown here as well.
This layer stitches all features together, and as such is project specific. It is not part of Mercury, but created per project. As the project layer mainly defines the glue and ideally contains (almost) no business logic, it will be thin compared to the other layers.
This layer holds independent modules that define unique features to be used in the project layer. In Mercury, a feature typically consists of React components, MVC components and a rest API.
Feature modules group business related functionality together. For example, the Feature.Checkout module groups all checkout related functionality and uses the underlying Foundation modules (e.g. Foundation.Checkout and Foundation.Account) to achieve this.
The foundation layer holds modules that define building blocks, in the form of services, on top of the platform layer. Modules in this layer do not contain presentation logic. Mercury typically expects this layer to contain data and view models (i.e. the model part of MVC), and .NET based services on top of Sitecore and Commerce Server (e.g. custom Sitecore pipelines and processors).
Some examples of Mercury modules are presented in the image above. For example, the Foundation.Catalog module contains functionality to retrieve and transform product information from the Commerce Server catalog and is used by other Foundation and Feature modules to get product information.
This is the base layer on which Mercury services are defined. Modules in this layer are:
- Commerce Server
- Sitecore Commerce Connect
Helix defines this layer as part of the Foundation layer. From Mercury’s perspective, this layer contains external (i.e. not to be changed) modules on top of which the Mercury foundation is build. Therefore, Mercury makes these external dependencies explicit in the Platform layer.