Skip to content

Configuration

1. Environment Variables

Source: EnvironmentKeys in @nx/core/src/common/environments.ts. Service reads via applicationEnvironment.get<T>(key).

Core runtime

NameTypeDefaultRequiredDescription
APP_ENV_PORTnumber3000HTTP listen port (container)
APP_ENV_HOSTstring0.0.0.0Bind address
APP_ENV_BASE_PATHstring/v1/api/saleRoute prefix
APP_ENV_NODE_IDnumberSnowflake worker ID — must be 3 for sale
APP_ENV_LOG_LEVELinfo|debug|warn|errorinfoLogger level
APP_ENV_NODE_ENVstringdevelopmentLoaded via dotenv-flow
RUN_MODEmigrate|servermigrate switches to migration entry

Database

NameTypeDefaultRequiredDescription
APP_ENV_DB_URLstringPostgreSQL connection URL
APP_ENV_DB_POOL_MAXnumber10Max pool size

Redis (auth cache only)

NameTypeDefaultRequiredDescription
APP_ENV_REDIS_HOSTstringOptional — auth cache disabled when unset
APP_ENV_REDIS_PORTnumber6379
APP_ENV_REDIS_PASSWORDstring
APP_ENV_REDIS_DBnumber0

Kafka (producer-only)

NameTypeDefaultRequiredDescription
APP_ENV_KAFKA_BROKERScsvComma-separated broker list
APP_ENV_KAFKA_CLIENT_IDstringSVC-00030-SALE_PRODUCERProducer client id
APP_ENV_KAFKA_SASL_ENABLE'true'|'false'falseToggle SASL auth
APP_ENV_KAFKA_SASL_MECHANISMenumNAWhen SASL enabled
APP_ENV_KAFKA_SASL_USERNAMEstringNAWhen SASL enabled
APP_ENV_KAFKA_SASL_PASSWORDstringNAWhen SASL enabled

Sale registers a Producer only — there is no Kafka consumer in this package.

Authentication

NameTypeDefaultRequiredDescription
APP_ENV_JWKS_URLurlIdentity service JWKS endpoint
APP_ENV_BASIC_AUTH_*stringService-to-service basic creds

Sister-service network

NameTypeDefaultRequiredDescription
APP_ENV_PRICING_BASE_URLurl@nx/pricing HTTP base for PricingNetworkService
APP_ENV_COMMERCE_BASE_URLurl@nx/commerce HTTP base (cross-package reads)

2. Feature Flags

No global feature flags today. Cancellation policy / pricing v2 toggle live in per-merchant Configuration rows (see §4).

3. Seeded Data

Migration processes in src/migrations/processes/. Run on bootstrap (prestartbun run rebuildmigrate.ts).

FileScopeIdempotency KeyNotes
sale-0001-seed-permissions.tsPermission (RBAC catalogue)codeAggregates all sale permission groups (controllers/permissions.ts)
sale-0002-create-pos-session-report.tsDB schema bootstrap for PosSessionReportn/a (DDL)Creates the report table if missing — separate from main migration runner

4. Configuration Storage (Configuration table)

Configuration kindEncryptionRead by
Per-merchant payment provider credentials (read-only here)AES-256-GCM (encrypt by @nx/payment)PaymentWebhookService (rare — most reads happen at MQ-Pay; sale primarily uses webhook payload)
Loyalty point conversion rate per merchantCustomerPointService.awardPointsForOrder

Sale reads from Configuration; writes are owned by the issuing service (e.g., payment).

5. Boot Order

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