Install brX GraphQL Service
Info: The brX GraphQL Service requires a standard or premium Bloomreach Content license. Contact Bloomreach for details.
Overview
This guide describes how to install the brX GraphQL Service and connect it to your Commerce Backend Platform.
Prerequisites
- A standard or premium Bloomreach Content license
- An active LTS version of Node.js installed on the target machine
Create the Environment Configuration File
The brX GraphQL Service uses a .env file in the project root directory for configuration. This file defines connection details for the Commerce Backend Platform and other service options.
- Create a new project directory, for example
brx-graphql-service. - Navigate to the new directory.
- Create a
.envfile in the project root. - Copy the following content into the
.envfile:
npm_package_name=brx-graphql-service-app
npm_package_version=0.0.1
NODE_ENV=production
DEBUG_TRACE_PAYLOAD=false
PORT=4000
APOLLO_INTROSPECTION=true
APOLLO_PLAYGROUND=true
LOG_LEVEL=info
TOKEN_TIMEOUT=3600
TOKEN_REFRESH_ENABLED=false
DEFAULT_CONNECTOR_ID=brsm
BRSM_API=http://core.dxpapi.com/api
BRSM_SUGGESTION_API=https://suggest.dxpapi.com/api
BRSM_ACCOUNT_ID=
BRSM_DOMAIN_KEY=
BRSM_AUTH_KEY=
JWK_KEYSTORE={"keys":[{"kty":"oct","kid":"sample_key_id","k":"changeme"}]}
Update the placeholder values with your actual configuration as needed. For details on each property, see Configure brX GraphQL Service.
Info: After updating the
.envfile, you do not need to rebuild the project. Restart the server to apply configuration changes.
Install and Start the brX GraphQL Service
- Ensure you are in the project directory (for example,
brx-graphql-service). - Initialize the project:
npm init -y
This command creates a package.json file with default settings.
- Install the brX GraphQL Service dependency:
npm install @bloomreach/graphql-commerce-connector-service
- Create a minimal
index.jsfile to load the service:
echo "const graphqlService = require(\"@bloomreach/graphql-commerce-connector-service\");" > index.js
- Start the service using the following command from the project root (where both
index.jsand.envare located):
node --require dotenv/config index.js
When the server starts successfully, you will see a log message similar to:
🚀 Server (brx-graphql-service-app:0.0.1 ... ready at port ...
No errors should appear in the output.
Hint: To stop the service, press
Ctrl-Cor interrupt the process.