Skip to content

Configuration

@nx/search reads env from the host process (commerce). It defines its own keys (src/common/environments.ts) on top of @nx/core Kafka keys, plus DB-backed embedding + pipeline config in the Configuration table.

1. Environment Variables

Search-specific (EnvironmentKeys extends core)

NameTypeDefaultRequiredDescription
APP_ENV_TYPESENSE_NODESstring (CSV)http:localhost:8108Nodes as protocol:host:port, comma-separated. Not a URL
APP_ENV_TYPESENSE_API_KEYstringxyzTypesense API key
APP_ENV_CDC_DLQ_TOPICstringnx.seller.cdc.dlqDead-letter topic for failed CDC messages
APP_ENV_CDC_CIRCUIT_BREAKER_ENABLEDboolean (string)falseEnable Typesense health probe + consumer pause

Kafka / CDC consumer (inherited from @nx/core)

NameTypeDefaultDescription
APP_ENV_KAFKA_BROKERSstring (CSV)localhost:19092Bootstrap brokers
APP_ENV_KAFKA_CLIENT_IDstringcommerce-cdc-consumerCDC consumer client id
APP_ENV_KAFKA_GROUP_IDstringcommerce-cdc-groupCDC consumer group
APP_ENV_KAFKA_SASL_ENABLEboolean (string)falseEnable SASL
APP_ENV_KAFKA_SASL_MECHANISMstringSCRAM-SHA-512SASL mechanism (when enabled)
APP_ENV_KAFKA_SASL_USERNAMEstringSASL user (when enabled)
APP_ENV_KAFKA_SASL_PASSWORDstringSASL password (when enabled)

The commerce-cdc-* defaults reflect the current host; they are not hard-coded to a "search" service.

2. Feature Flags

FlagDefaultDescription
APP_ENV_CDC_CIRCUIT_BREAKER_ENABLEDfalseGate the CDC circuit breaker (health probe + pause)
ISearchParams.disableSemanticSearchfalse (per-query)Drop the embedding field from query_by → strict keyword
Auto-embedding (embed.from)off unless DB config presentEnabled only when embedding model config exists + collection has embeddingField/embeddingFields

3. Seeded Data

No PostgreSQL migrations of its own. "Seeding" is via developer scripts that feed/backfill data:

ScriptCommandActionIdempotent
scripts/data-feeder/index.tsbun run feed-data[:small|medium|large]Generate fake data, POST via Commerce API (needs JWT)no (creates rows)
scripts/migrate-add-references.tsbun run migrate:references[:dry]Backfill relation/reference fields in Typesenseyes
scripts/migrate-add-denorm-fields.tsbun run migrate:denorm[:dry]Backfill denormalized fields in Typesenseyes

4. Configuration Storage (Configuration table)

Read by SearchConfigurationService at bootstrap; falls back to DEFAULT_SEARCH_PIPELINE_CONFIG.

Configuration kindRead byBindsNotes
TYPESENSE_EMBEDDING_CONFIG (SystemConfigurations)ApplicationEmbeddingConfigurationComponentEMBEDDING_MODEL_CONFIGOptional; absent → keyword-only search
Search pipeline configApplicationEmbeddingConfigurationComponentSEARCH_PIPELINE_CONFIGPartial override merged onto defaults

Pipeline config defaults (DEFAULT_SEARCH_PIPELINE_CONFIG)

GroupFieldDefault
cdc.kafkaConsumermaxWaitTimeMs / maxBytes500 / 5 MB
cdc.batchingmaxBatchSize / flushIntervalMs200 / 2000
cdc.processingtypesenseBatchSize100
circuitBreakerprobeIntervalMs30 000
circuitBreakerquietWindowMsTypesense / quietWindowMsGoogle30 000 / 90 000
circuitBreakermaxOpenMs1 800 000 (30 min)
lsnLookuppageSize250
searchcacheTtlSeconds5
searchpaginationDefaultLimit / paginationMaxLimit10 / 250

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.