Skip to main content

04 — Base Configs

What it is: Global key-value settings for a team's store that don't change when you swap programs. Think: auth token lifetimes, timezone. Stored as JSONB per key, with an audit history table.


Table: tbl_base_configs

One row per config key. Key is unique per schema.

FieldNotes
configKeyenum-backed (must be registered before use)
configCategorygrouping (auth, general, feature_flags)
valueJSONB — flexible (string, object, array, number, boolean)
versionincrements on each update

Table: tbl_base_configs_history

Audit trail. Every create/update/delete writes a row here with oldValue, newValue, changeType, and optional changeReason. This backend is read-only for configs — all writes come from the dashboard.


Config keys

KeyCategoryWhat it controlsDefaults
authSettingsauthaccessTokenExpiry ('15m'), refreshTokenExpiry ('30d'), fetchVendorDatasee defaults
generalSettingsgeneraltimezone (e.g. 'America/New_York')America/New_York
featureFlagsfeature_flagsruntime feature toggles{} empty

Note: Inventory seat limits were moved to tbl_flex_program_configs (per-program), not here.


How retrieval works

  • Missing config key → falls back to code defaults in base-config-defaults.constant.ts
  • Partial DB values are deep-merged with defaults (all properties always present)
  • Soft-deleted configs also fall back to defaults

Key rules

  • This backend only reads configs; dashboard writes them
  • Config keys must be in the BaseConfigKey enum (generalSettings · authSettings · featureFlags) before use
  • No teamSchema column — multi-tenancy is handled by schema isolation (one schema per team)