Overview
@brainstormer/shared is the shared package used across all backend services. It provides common types, utilities, constants, error classes, and Zod schemas.
Exports
Crypto Utilities
The crypto module provides AES-256-GCM encryption used by the platform config system:- Key is derived from
JWT_SECRETvia scrypt - Used to encrypt sensitive values in the
platform_configtable - Used to encrypt sensitive conversation variables in
conversation_variables.sensitive_variables
Prompt Renderer
The prompt renderer provides Mustache-style variable interpolation:- Pure function, no side effects
- Handles nested/escaped braces gracefully
- Unresolved variables replaced with empty string
- Returns list of unresolved variables for logging
Usage in Services
All services reference the shared package via npm workspaces:Build
Built as part of the monorepo. Each service Dockerfile builds shared first:Config Package
packages/config provides the base tsconfig.json that all services extend.
