Skip to content

Configuration

1. Environment Variables

Source: packages/core/src/common/environments.ts (EnvironmentKeys) + this package's src/common/.

Core

NameTypeDefaultRequiredDescription
APP_ENV_PORTnumber3000HTTP listen port (dev external 31040)
APP_ENV_HOSTstring0.0.0.0Bind host
APP_ENV_BASE_PATHstring/v1/api/financeRoute prefix
APP_ENV_NODE_IDnumber4Snowflake worker ID
APP_ENV_LOG_LEVELinfo|debug|warn|errorinfoLogger level
NODE_ENVstringproductionEnvironment partition stamped onto accounts

Database

NameTypeDefaultRequiredDescription
APP_ENV_DB_URLstringPostgreSQL connection URL
APP_ENV_DB_POOL_MAXnumber10Max pool size

Kafka

NameTypeDefaultRequiredDescription
APP_ENV_KAFKA_BROKERSstringComma-separated brokers (empty → component throws on boot)
APP_ENV_KAFKA_CLIENT_IDstringSVC-00040-FINANCE_PRODUCER / _CONSUMERClient id
APP_ENV_KAFKA_GROUP_IDstringSVC-00040-FINANCE_CONSUMER_GROUPConsumer group
APP_ENV_KAFKA_SASL_ENABLEbooleanfalseEnable SASL
APP_ENV_KAFKA_SASL_MECHANISM / _USERNAME / _PASSWORDstringSASL credentials (when enabled)

WebSocket Redis

NameTypeDefaultRequiredDescription
APP_ENV_WEBSOCKET_REDIS_MODEsingle|clustersingleEmitter Redis topology
APP_ENV_WEBSOCKET_REDIS_HOSTstringlocalhost
APP_ENV_WEBSOCKET_REDIS_PORTnumber6379
APP_ENV_WEBSOCKET_REDIS_PASSWORDstring
APP_ENV_WEBSOCKET_REDIS_DBnumber0
APP_ENV_WEBSOCKET_REDIS_IDENTIFIERstringfinance-ws-redisConnection name

Cache / Authorization Redis

NameTypeDefaultRequiredDescription
APP_ENV_REDIS_HOSTstringAuthorization cache host (useCacheRedis)
APP_ENV_REDIS_PORTnumber6379

2. Feature Flags

None. Finance has no runtime feature flags. Behavioral switches (single-currency, control-account presence) are structural, not flag-gated. Multi-currency is dormant: the exchangeRate column exists but is hard-set to 1.

3. Seeded Data

Migration processes in src/migrations/processes/ — loaded by migration-process.ts, idempotent.

FileSeedsAlways-runNotes
finance-0001-seed-categories.ts14 system FinanceCategory rows (merchantId=null)noUpserts by (name, type, identifier, merchantId=null)
finance-0002-seed-permissions.tsAll finance Permission rowsyesUpsert by code
finance-0003-seed-role-permissions.tsGrants ALL finance permissions to OWNER, EMPLOYEE, CASHIERyesLenient baseline; tightened later via merchant policy API

14 system categories

IdentifierTypeName (en)
000_SALEINCOMESales Revenue
001_OTHER_INCOMEINCOMEOther Income
002_REFUND_INCOMEINCOMERefund Received
300_COLLECT_INTERESTINCOMEInterest Income
100_PURCHASEEXPENSEPurchase - Inventory
101_OTHER_EXPENSEEXPENSEOther Expenses
102_REFUND_EXPENSEEXPENSERefund to Customer
200_OPERATINGEXPENSEOperating Expenses
201_SALARYEXPENSESalaries & Wages
202_RENT_UTILITIESEXPENSERent & Utilities
203_MARKETINGEXPENSEMarketing & Advertising
204_SHIPPINGEXPENSETransportation & Delivery
205_MAINTENANCEEXPENSEMaintenance & Repairs
301_PAY_INTERESTEXPENSEInterest Expense

Constants in FixedFinanceCategories. Merchants add custom children under these via the category API. INVENTORY/COGS control accounts are not seeds — they are reconciled per-merchant on the first merchant CDC event.

4. Configuration Storage (Configuration table)

Per-merchant / system runtime configs read via ConfigurationRepository.

ConfigurationGroupRead byPurpose
DEFAULT_FINANCE_ACCOUNTSSYSTEM (principal null)FinanceWorkerService._loadDefaultAccountConfigTemplate array of default accounts seeded for a new merchant when merchant.metadata.finance.accounts is absent; validated by DefaultFinanceAccountsConfigSchema
PaymentIntegration.credential— (own table)PaymentIntegrationService / FinanceIntegrationServiceEncrypted gateway credentials; masked in API responses

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