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/inventoryRoute prefix
APP_ENV_NODE_IDnumberSnowflake worker ID (must be 5 for inventory)
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 — if unset, auth cache disabled
APP_ENV_REDIS_PORTnumber6379
APP_ENV_REDIS_PASSWORDstring
APP_ENV_REDIS_DBnumber0

Kafka

NameTypeDefaultRequiredDescription
APP_ENV_KAFKA_BROKERScsvComma-separated broker list — service refuses to start if empty
APP_ENV_KAFKA_CLIENT_IDstringSVC-00050-INVENTORY_PRODUCER / _CONSUMERProducer/consumer override
APP_ENV_KAFKA_GROUP_IDstringSVC-00050-INVENTORY_CONSUMER_GROUPConsumer group
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

Authentication

NameTypeDefaultRequiredDescription
APP_ENV_JWKS_URLurlIdentity service JWKS endpoint (/jw-certs)
APP_ENV_BASIC_AUTH_*stringService-to-service basic creds (if enabled)

2. Feature Flags

FlagStorageDefaultDescription
metadata.inventory.allowOversellMaterial rowfalseWhen true, adjustStock skips forceNonNegative guard for that material
metadata.inventory.isInventoryTrackedMaterial rowtrueWhen false, material is not seeded into InventoryItem on create

No global feature-flag service today. Per-row metadata flags only.

3. Seeded Data

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

FileScopeIdempotency KeyApprox RowsNotes
inventory-0002-seed-permissions.tsPermission (RBAC catalogue)code~131Aggregates InventoryPermissions from 15 controller groups (controllers/permissions.ts)
inventory-0003-seed-unit-of-measures.tsUnitOfMeasure (system-wide, merchantId=NULL)code~40Categories: COUNT (unit, pair, pack, dozen…), WEIGHT (kg, g, lb…), VOLUME (L, ml, gal…), TIME (sec, min, hr, day…); base unit per category has ratio=1
inventory-0004-seed-discrimination-types.tsDiscriminationType (reference data)(scope, type)~100Scopes: tracking_reason, tracking_reference_type, tracking_type, location_type, identifier_scheme, ticket_partner_type, material_type, material_identifier_scheme, uom_category, costing_method
inventory-0005-backfill-vendor-item.tsVendorItem materialization from PO history(merchantId, vendorId, itemType, itemId)one-shotSnapshots latest non-cancelled PO line per group
inventory-0006-backfill-merchant-id.tsInventoryStock.merchantId denorm backfillper row missing merchantIdone-shotPopulates from InventoryItem.merchantId

Each seed file extends MigrationProcess from @nx/core and respects alwaysRun flag. Backfills (0005, 0006) are one-shot — re-execution is a no-op.

4. Configuration Storage (Configuration table)

N/A. Inventory does not use the per-merchant Configuration table for runtime configs (no encrypted credentials, no per-merchant feature toggles in this package).

5. Boot Order

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