Skip to main content

System Settings

This guide covers the administrative configuration options available in Cascadia PLM, including item type configuration, lifecycle and workflow management, AI settings, vault configuration, and the general settings system.

All admin endpoints require the Administrator role unless otherwise noted.

Item Type Configuration

Cascadia uses a hybrid code-first + runtime configuration model. Item types (Part, Document, ChangeOrder, etc.) are defined in TypeScript with type-safe schemas, but their business rules can be overridden at runtime without redeployment.

What Can Be Configured at Runtime

SettingDescription
labelDisplay name (e.g., rename "Part" to "Component")
pluralLabelPlural display name
iconLucide icon name
lifecycleDefinitionIdLink to a workflow definition for lifecycle states
permissionsCRUD permission arrays (role names that can perform each action)
relationshipsAllowed relationship types and targets
fieldMetadataPer-field labels, descriptions, required/visible flags
workflowsByChangeType(ChangeOrder only) Map change types to workflow definitions

What Requires Code Changes

  • Database schema (adding columns)
  • Zod validation schemas
  • React components
  • Table mappings
  • Default state definitions

API Endpoints

List all item type configurations

GET /api/admin/item-type-configs

Returns every registered item type with its code definition, runtime override (if any), and the merged result.

Response structure:

{
"data": {
"configs": [
{
"itemType": "Part",
"hasCodeDefinition": true,
"hasRuntimeConfig": true,
"codeConfig": { "label": "Part", "permissions": { ... } },
"runtimeConfig": { "id": "...", "version": 2, "config": { ... } },
"mergedConfig": { "label": "Component", "permissions": { ... } }
}
]
}
}

Create or update a runtime override

POST /api/admin/item-type-configs
Content-Type: application/json

{
"itemType": "Part",
"config": {
"label": "Component",
"pluralLabel": "Components",
"permissions": {
"create": ["Engineer", "Administrator"],
"read": ["*"],
"update": ["Engineer", "Administrator"],
"delete": ["Administrator"]
}
}
}

After saving, the ItemTypeRegistry is automatically reloaded so changes take effect immediately on the current instance.

Returns 201 for a new configuration or 200 for an update.

Delete a runtime override (revert to code defaults)

DELETE /api/admin/item-type-configs/:itemType

Reload all configurations

POST /api/admin/reload-config

Forces all instances to reload runtime configurations from the database. Use this after direct database changes or in multi-instance deployments.

Configuration Merging

When the system resolves an item type configuration:

  1. The code-defined configuration is loaded (always present)
  2. The runtime configuration is loaded from the item_type_configs table (may not exist)
  3. Runtime values override code defaults field by field (runtime wins)
  4. The merged result is cached in memory

If no runtime override exists, the code defaults are used as-is.

Database Table

Runtime configurations are stored in item_type_configs:

ColumnTypeDescription
idUUIDPrimary key
item_typeVARCHAR(50)Item type name (unique)
configJSONBRuntime configuration object
versionINTEGERVersion number (for optimistic locking)
is_activeBOOLEANSoft delete flag
modified_byUUIDUser who last modified
modified_atTIMESTAMPTZLast modification time
created_atTIMESTAMPTZCreation time

For complete documentation, see docs/runtime-configuration.md.

Lifecycle Configuration

Lifecycles define the valid states and transitions for item types. Cascadia uses a unified lifecycle model with three types:

Lifecycle TypeDescriptionExample Item Types
FreeSelf-controlled with transitionsPrograms, Designs
DrivenControlled by ECOs, declares valid states onlyParts, Documents
DrivingControls Driven lifecycles, has merge actionsChange Orders

Workflow Definitions Table

Lifecycle definitions are stored in the workflow_definitions table:

ColumnTypeDescription
idUUIDPrimary key
nameVARCHAR(200)Unique name (e.g., "Part Lifecycle")
versionINTEGERDefinition version
workflow_typeVARCHAR(20)Type identifier
definitionJSONBStates, transitions, and actions
is_activeBOOLEANWhether this definition is active
lifecycle_typeENUMFree, Driven, or Driving
driversJSONBFor Driven lifecycles: IDs of Driving lifecycles that can act on it

Linking Item Types to Lifecycles

Use the runtime configuration system to assign a lifecycle to an item type:

{
"itemType": "Part",
"config": {
"lifecycleDefinitionId": "<workflow-definition-uuid>"
}
}

Validation rules:

  • Cannot change to a lifecycle that does not include states items are currently in
  • Cannot delete a lifecycle that item types reference
  • Cannot remove states from a lifecycle that items are currently using

Workflow Instances

Each item that participates in a lifecycle gets a workflow_instances record:

ColumnTypeDescription
workflow_definition_idUUIDReferences the definition
item_idUUIDThe item this instance tracks
current_stateVARCHAR(100)Current lifecycle state
scope_lockedBOOLEANFor ECOs: whether scope is frozen
instance_statesJSONBOverride states at instance level (optional)
instance_transitionsJSONBOverride transitions at instance level

Approval Configuration

For states that require approval, configure approvers at the workflow definition level:

The workflow_state_approvers table defines who must approve at each state:

ColumnTypeDescription
workflow_definition_idUUIDThe workflow definition
state_idVARCHAR(100)The state requiring approval
approver_typeVARCHAR(10)user or role
approver_idUUIDReferences users.id or roles.id
is_requiredBOOLEANWhether this approver is mandatory

Approval votes are tracked in workflow_approval_votes with the vote (approved or rejected), comments, and timestamp.

Workflow History

Every state transition is recorded in workflow_history:

ColumnTypeDescription
instance_idUUIDThe workflow instance
from_stateVARCHAR(100)Previous state
to_stateVARCHAR(100)New state
actionVARCHAR(200)Transition action name
actor_idUUIDUser who triggered the transition
commentsTEXTOptional transition comments
dataJSONBAdditional transition data
timestampTIMESTAMPTZWhen the transition occurred

AI Settings

Cascadia supports AI-assisted operations with configurable providers. Settings are managed through the admin AI settings API.

Supported Providers

ProviderDescription
openaiOpenAI (GPT models)
anthropicAnthropic (Claude models)
geminiGoogle Gemini
ollamaSelf-hosted Ollama

Configuring AI

API endpoint: GET /api/admin/ai-settings

Returns the current global AI configuration and indicates which environment variables are set:

{
"data": {
"settings": {
"enabled": true,
"provider": "anthropic",
"config": {
"provider": "anthropic",
"apiKey": "sk-ant-a...1234",
"model": "claude-sonnet-4-20250514"
}
},
"envVars": {
"openai": false,
"anthropic": true
}
}
}

API keys are masked in responses (first 8 and last 4 characters shown).

API endpoint: POST /api/admin/ai-settings

{
"enabled": true,
"provider": "anthropic",
"config": {
"provider": "anthropic",
"apiKey": "sk-ant-api-key-here",
"model": "claude-sonnet-4-20250514",
"baseURL": "https://api.anthropic.com"
}
}

API Key Encryption

When ENCRYPTION_KEY is set in the environment, API keys are encrypted before storage using AES encryption. When it is not set, keys are stored as plain text.

Configuration Precedence

AI settings can come from two sources:

  1. Environment variables: OPENAI_API_KEY, ANTHROPIC_API_KEY
  2. Database settings: Stored in the ai_settings table via the admin API

The ai_settings table stores global settings (where program_id is null) as well as optional per-program overrides.

Testing AI Configuration

API endpoint: POST /api/admin/ai-settings/test

Tests the configured AI provider by sending a simple request and verifying connectivity.

Vault Configuration

The vault is Cascadia's file storage system for CAD files, documents, and other attachments.

Viewing Vault Configuration

API endpoint: GET /api/admin/vault-config

Returns the effective vault configuration with source tracking (which values come from environment variables vs. database settings):

{
"data": {
"type": "local",
"rootPath": "./vault",
"source": {
"rootPath": "default"
},
"envVars": {
"VAULT_TYPE": false,
"VAULT_ROOT": false,
"S3_BUCKET": false
}
}
}

Storage Types

TypeDescriptionConfiguration
localLocal filesystem storage (default)VAULT_ROOT env or DB setting
s3Amazon S3 or S3-compatible storageS3 environment variables

Local Storage Configuration

SourceSettingDescription
Environment varVAULT_ROOTFilesystem path for vault
Database settingvault_rootOverrides env var
Default./vaultUsed if neither is set

S3 Storage Configuration

All S3 settings are configured via environment variables:

VariableRequiredDescription
VAULT_TYPEYesSet to s3
S3_BUCKETYesS3 bucket name
S3_REGIONYesAWS region
S3_ACCESS_KEY_IDYesAWS access key
S3_SECRET_ACCESS_KEYYesAWS secret key
S3_KEY_PREFIXNoPrefix for all object keys
S3_ENDPOINTNoCustom endpoint (for MinIO, etc.)
S3_FORCE_PATH_STYLENoUse path-style URLs (for MinIO)

General Settings

The settings table provides a key-value store for application-wide configuration. Each setting has a key, an optional text value, an optional JSON value, and audit fields.

Database Table

ColumnTypeDescription
idUUIDPrimary key
keyVARCHAR(100)Setting key (unique)
valueTEXTSimple text value
json_valueJSONBComplex structured value
descriptionTEXTHuman-readable description
modified_atTIMESTAMPTZLast modification time
modified_byUUIDUser who last modified

API Endpoints

Get all settings

GET /api/admin/settings

Get a single setting

GET /api/admin/settings?key=vault_root

Create or update a setting

POST /api/admin/settings
Content-Type: application/json

{
"key": "vault_root",
"value": "/data/vault",
"description": "Root path for file vault storage"
}

For structured values, use jsonValue instead of value:

{
"key": "email_config",
"jsonValue": {
"smtp_host": "smtp.example.com",
"smtp_port": 587
},
"description": "Email server configuration"
}

Delete a setting

DELETE /api/admin/settings?key=vault_root

Thread Cache Administration

The thread cache stores precomputed data for performance. Admin endpoints are available for monitoring and maintenance:

EndpointMethodDescription
/api/admin/thread-cache/statsGETView cache statistics
/api/admin/thread-cache/warmPOSTWarm the cache
/api/admin/thread-cache/clearPOSTClear all cached entries
/api/admin/thread-cache/cleanupPOSTRemove expired entries

Configuration Precedence

When multiple configuration sources provide the same setting, they are resolved in this order (highest priority first):

  1. Environment variables -- Always take precedence (for secrets, infrastructure config)
  2. Database settings -- Configurable at runtime via admin API
  3. Code defaults -- Built-in defaults in the application code

This allows infrastructure teams to lock down settings via environment variables while giving administrators flexibility to tune business rules through the UI or API.