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.

  1. Create a new project directory, for example brx-graphql-service.
  2. Navigate to the new directory.
  3. Create a .env file in the project root.
  4. Copy the following content into the .env file:
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 .env file, you do not need to rebuild the project. Restart the server to apply configuration changes.

Install and Start the brX GraphQL Service

  1. Ensure you are in the project directory (for example, brx-graphql-service).
  2. Initialize the project:
npm init -y

This command creates a package.json file with default settings.

  1. Install the brX GraphQL Service dependency:
npm install @bloomreach/graphql-commerce-connector-service
  1. Create a minimal index.js file to load the service:
echo "const graphqlService = require(\"@bloomreach/graphql-commerce-connector-service\");" > index.js
  1. Start the service using the following command from the project root (where both index.js and .env are 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-C or interrupt the process.

Next Steps

Share Feedback
Page: /frontend/commerce-accelerator/brx-graphql-service/install-graphql-service
Section: Frontend
Category *