NOTE: this is still a draft, so it's subject to changes. This alert will be removed as soon as final version will be available

βš™οΈ@hsuite/smart-config - Configuration Management

βš™οΈ Dynamic configuration management for HSuite applications

Advanced configuration management module providing environment-based settings, secure credential management, and dynamic configuration updates for distributed blockchain applications.


Table of Contents


Quick Start

Installation

npm install @hsuite/smart-config

Basic Setup

Basic Usage


Architecture

Core Components

βš™οΈ Configuration Management

  • SmartConfigService - Core configuration service with type safety

  • Environment Loading - Multi-environment configuration support

  • Dynamic Updates - Runtime configuration updates

πŸ”’ Security Features

  • Credential Encryption - Automatic encryption for sensitive values

  • Secret Management - Secure handling of API keys and passwords

  • Environment Isolation - Separate configs for different environments

πŸ”„ Dynamic Configuration

  • Hot Reloading - Configuration updates without restart

  • Validation - Schema-based configuration validation

  • Type Safety - Full TypeScript support for configuration objects

Module Structure


API Reference

SmartConfigModule

Static Methods

forRoot(options: SmartConfigOptions): DynamicModule

Configures the smart config module with static options.

forRootAsync(options: SmartConfigAsyncOptions): DynamicModule

Configures the smart config module with async dependency injection.

SmartConfigService

Core Methods

get<T = any>(key: string, defaultValue?: T): T

  • Retrieves configuration value by key

  • Parameters: key - Configuration key, defaultValue - Fallback value

  • Returns: Configuration value or default

getOrThrow<T = any>(key: string): T

  • Gets configuration value or throws error if not found

  • Parameters: key - Configuration key

  • Throws: Error if key not found

getDatabaseConfig(): DatabaseConfig

  • Returns typed database configuration

  • Returns: Complete database configuration object

getAuthConfig(): AuthConfig

  • Returns authentication configuration

  • Returns: Authentication settings with type safety

getNetworkConfig(): NetworkConfig

  • Returns network and blockchain configuration

  • Returns: Network configuration for all supported chains


Guides

Environment Configuration Guide

Learn how to set up environment-specific configurations and secrets. Configure validation schemas, environment variable management, and secure credential handling.

Dynamic Updates Guide

Implement runtime configuration updates and hot reloading. Set up configuration watchers, event-driven updates, and real-time configuration management.

Validation Guide

Set up configuration validation schemas and type safety. Implement Joi validation, custom validators, and configuration error handling.


Examples

Complete Module Configuration

Environment-Specific Configuration

Dynamic Configuration Updates

Configuration Validation Service


Integration

Required Dependencies

Environment File Structure

Production Environment


βš™οΈ Type Safety: Full TypeScript support with configuration interfaces and validation.

πŸ”’ Security: Encrypted credential storage and environment-based configuration isolation.

πŸ”„ Dynamic: Runtime configuration updates with validation and event emission.

Built with ❀️ by the HSuite Team Copyright © 2025 HSuite. All rights reserved.

Last updated