Headless Commerce with the Bloomreach Starter Store for commercetools
Giacomo Lamonaco
2019-06-26
The Starter Store Boot project is designed as an out-of-the-box accelerator to integrate your commerce backend with Bloomreach Experience Manager and Bloomreach Search & Merchandising. The Boot project can be configured with a commerce backend platform such as commercetools and Bloomreach Search & Merchandising. You can use any of the available commerce backend configurations.
This page explains how to set up the Starter Store Boot project in your local development environment and connect your commercetools commerce backend platform.
Set Up Local Development Environment
The Starter Store Boot project is available in the Bloomreach Experience Manager Enterprise Maven repository.
Log in at https://maven.onehippo.com/.
Point your browser to /maven2-enterprise/com/bloomreach/commercedxp/starterstore-boot/.
Pick the appropriate release (version number of the format X.Y.Z) and open the corresponding folder.
Download the starterstore-boot-X.Y.Z-project.tar.gz (or .tar.bz2 or .zip) source distribution and extract it to a folder in your local environment.
Connect a commercetools instance
commercetools is a cloud-based commerce API solution. The Starter Store boot application already provides a CRISP resource able to connect to your instance. Refer to the documentation of each commerce backend configuration for details. Once the Starter Store Boot is up and running, the related CRISP configuration can be found at the following repository path:
/hippo:configuration/hippo:modules/crispregistry/hippo:moduleconfig/crisp:resourceresolvercontainer/commercetools
You need to provide your specific connection properties explained in the table below:
Property name |
Description |
commercetools.baseUrl |
The base url of your commercetools instance (e.g https://api.sphere.io/<name_of_your_project> |
commercetools.accessTokenUri |
The uri need to obtain your access token throught the credentials flow (e.g. https://auth.sphere.io/oauth/token?grant_type=client_credentials&scope=manage_project:<name_of_your_project>) |
commercetools.clientId |
OAuth 2 client id generated for your project |
commercetools.clientSecret |
OAuth 2 client secret generated for your project |
commercetools.username |
Your commercetools username |
commercetools.password |
Your commercetools password |
Those API client data can be configured directly in your commercetools instance, more specifically on the following page: https://mc.commercetools.com/<project_name>/settings/developer/api-clients.
Those properties can be defined directly in the hst.properties. The Starter Store Boot Application contains a root folder called conf: among others, this folder contains a properties file called hst.properties. You can define the properties as in the example below (replace project name):
..
commercetools.baseUrl = https://api.sphere.io/<project_name>/
commercetools.accessTokenUri = https://auth.sphere.io/oauth/token?grant_type=client_credentials&scope=manage_project:<project_name>
commercetools.clientId = <client_id>
commercetools.clientSecret = <client_secret>
commercetools.username = <commercetools_username>
commercetools.password = <commercetools_password>
..
Build the application using Maven:
mvn clean verify
Run the application:
mvn -P cargo.run
Verify that the Bloomreach Experience Manager CMS application is accessible at http://localhost:8080/cms/ (login with credentials admin/admin).
To verify that your commerce backend connection is working properly, navigate to the Content perspective and browse to Starter Store Boot Project > products. Open one of the example product documents or create a new one, make sure your commerce backend is selected under Commerce Connector, then click Browse under Related External Product. You should be able to browse through the products in your commerce backend.
Connector configurations
The Starter Store boot application already provides a commerce connector definition for commercetools: you can find it in the Default Commerce Connector Set document, under the commerce-connectors folder, with the Connector ID with value commercetools.
The commercetools connector is based on the SDK API. The Resource space property matches with commercetools CRISP resource name.