Configure brX GraphQL Service

Info: The brX GraphQL Service feature in Bloomreach Content requires a standard or premium license. Contact Bloomreach for licensing details.

Overview

The brX GraphQL Service uses an environment configuration file (.env) to connect to your Commerce Backend Platform. This file defines connection details and other configuration options required for integration.

Environment Configuration File

The brX GraphQL Service expects a .env file in the project root directory. A sample file named .env.dist is provided in the project root. Copy .env.dist to .env and update the values to match your environment.

The .env file contains three groups of configuration options:

  1. General Options: Settings that apply to the brX GraphQL Service regardless of the Commerce Backend Platform.
  2. Bloomreach Discovery Connection Settings: Parameters required to connect to Bloomreach Discovery.
  3. Commerce Backend Platform Connection Settings: Parameters for connecting to your selected Commerce Backend Platform(s).

Example .env file (lines starting with # are comments):

# 1. General Options

NODE_ENV=production
LOG_LEVEL=info 
DEBUG_TRACE_PAYLOAD=false
APOLLO_INTROSPECTION=true
APOLLO_PLAYGROUND=true
JWK_KEYSTORE={ ...SNIP... }
DEFAULT_CONNECTOR_ID=...SNIP...

# 2. brSM Connection Settings

BRSM_API=...SNIP...
BRSM_SUGGEST_API=...SNIP...
BRSM_ACCOUNT_ID=...SNIP...
BRSM_DOMAIN_KEY=...SNIP...

# 3. Commerce Backend Platform Connection Settings (commercetools in this example)

COMMERCETOOLS_API_BASE_URL=...SNIP...
COMMERCETOOLS_AUTH_BASE_URL=...SNIP...
COMMERCETOOLS_PROJECT_KEY=...SNIP...
COMMERCETOOLS_CLIENT_ID=...SNIP...
COMMERCETOOLS_CLIENT_SECRET=...SNIP...
COMMERCETOOLS_SCOPE=...SNIP...

# ... More Commerce Backend Platform Connection Options may follow ...
#

General Options

The following environment variables are supported:

Property NameDescriptionDefault Value
NODE_ENVSets the environment for Express and Apollo Server. For example, setting this to development enables detailed logging for HTTP requests. Setting it to production disables development features such as the Apollo Server GraphQL Playground.
PORTSpecifies the port on which the brX GraphQL Service runs.4000
LOG_LEVELSets the minimum log level for output. The service uses the Winston logging library. Refer to the Winston documentation for available log levels.'info'
DEBUG_TRACE_PAYLOADIf set to true, the service logs responses from the Commerce Backend Platform for debugging. Do not enable this in production environments.'false'
APOLLO_INTROSPECTIONEnables Apollo Server Introspection to expose detailed schema information if set to true.'false'
APOLLO_PLAYGROUNDEnables the Apollo Server GraphQL Playground in-browser IDE for development if set to true.'false'
JWK_KEYSTOREDefines the keystore configuration used to generate secure, encrypted access tokens for visitors. See Access Management in brX GraphQL Service for details.
CORS_ORIGINSpecifies the allowed origin for Cross-Origin Resource Sharing (CORS). If unset or empty, the service allows requests with a valid 'Origin' header. Use * to allow all origins, or specify a URL to restrict access.
TOKEN_REFRESH_ENABLEDEnables the Refreshing Access Token request for Access Management if set to true. Disabled by default since v14.3.0.
DEFAULT_CONNECTOR_IDIf the HTTP request does not provide a valid Commerce Connector ID in the connector header, the service uses this value.'brsm'
DEFAULT_LANGUAGESets the default language code for clients.'en'
DEFAULT_COUNTRYSets the default country code for clients.'US'
DEFAULT_CURRENCYSets the default currency code for clients.'USD'
RESPONSE_TIME_HEADER_ENABLEDIf set to true, the service includes the internal response time (in milliseconds) in the X-Response-Time response header.

Supported Connectors and Connector IDs

The brX GraphQL Service supports Bloomreach Discovery and several Commerce Backend Platforms. Each platform is identified by a unique connector value in the request header.

Supported connectors:

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