# cymondez/nest-simple-config architecture

> Architecture diagram of the GitHub repository cymondez/nest-simple-config, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cymondez/nest-simple-config
- Repository: https://github.com/cymondez/nest-simple-config

## Overview

NestJS Simple Config builds a hierarchical configuration object from files, environment variables and command-line arguments, then exposes immutable keyed reads and typed, validated option sections to a NestJS application. The documented priority is command line over environment over files; the builder also supports YAML, optional files and secret-backed configuration. A separate secret-management capability maps safe account references to OS-managed secrets and provides CLI operations. The graph preserves these documented branches; source excerpts are partial, so edges not explicit in excerpts rely on README or SOURCE INDEX evidence.

Main entry points: [`lib/config-builder.ts`](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-builder.ts) (Provider builder), [`lib/config-providers/config-provider.abstract.ts`](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/config-provider.abstract.ts) (Provider contract), [`lib/simple-config.module.ts`](https://github.com/cymondez/nest-simple-config/blob/master/lib/simple-config.module.ts) (Config module), [`lib/config-options.module.ts`](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-options.module.ts) (Typed option binding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_configuration["Configuration assembly"]
  node_simple_module["Config module"]
  node_config_builder["Provider builder<br/>[config-builder.ts]"]
  node_config_object["Merged config<br/>[config-builder.ts]"]
end

subgraph group_providers["Configuration sources"]
  node_abstract_provider["Provider contract"]
  node_file_provider["File provider"]
  node_json_yaml["JSON / YAML loaders"]
  node_env_provider["Environment provider"]
  node_command_provider["Command-line provider"]
  node_default_provider["Default provider"]
  node_secret_provider["Secret config provider"]
end

subgraph group_consumption["Application access"]
  node_configuration["Configuration service"]
  node_typed_options["Typed option binding"]
  node_bind_decorator["Option decorator"]
  node_validation_error["Validation error"]
end

subgraph group_secrets["Secret management"]
  node_secret_store[("Secret store<br/>[secret-store.ts]")]
  node_keytar_store["OS keytar adapter"]
  node_secret_cli["Secret management CLI<br/>[secrets-cli.ts]"]
end

node_application(("NestJS app"))
node_os_secret_manager[("OS secret manager")]
node_config_user(("Application service"))

node_application -->|"configures"| node_simple_module
node_simple_module -->|"assembles"| node_config_builder
node_config_builder -->|"loads providers"| node_abstract_provider
node_config_builder -->|"builds"| node_config_object
node_file_provider -->|"implements"| node_abstract_provider
node_json_yaml -->|"uses file loading"| node_file_provider
node_env_provider -->|"implements"| node_abstract_provider
node_command_provider -->|"implements"| node_abstract_provider
node_default_provider -->|"implements"| node_abstract_provider
node_secret_provider -->|"implements"| node_abstract_provider
node_config_builder -->|"registers"| node_file_provider
node_config_builder -->|"registers"| node_env_provider
node_config_builder -->|"registers"| node_command_provider
node_config_builder -.->|"supports"| node_secret_provider
node_simple_module -->|"provides"| node_configuration
node_configuration -->|"reads"| node_config_object
node_config_user -->|"reads keys"| node_configuration
node_simple_module -->|"registers"| node_typed_options
node_typed_options -->|"reads section"| node_configuration
node_typed_options -->|"reads metadata"| node_bind_decorator
node_typed_options -.->|"reports invalid config"| node_validation_error
node_secret_provider -.->|"resolves secrets"| node_secret_store
node_secret_cli -.->|"manages secrets"| node_secret_store
node_keytar_store -.->|"stores secrets"| node_os_secret_manager
node_secret_store -.->|"adapts via"| node_keytar_store
node_application -.->|"runs"| node_secret_cli

click node_simple_module "https://github.com/cymondez/nest-simple-config/blob/master/lib/simple-config.module.ts"
click node_config_builder "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-builder.ts"
click node_config_object "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-builder.ts"
click node_abstract_provider "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/config-provider.abstract.ts"
click node_file_provider "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/file-config-provider.ts"
click node_json_yaml "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/json-config-provider.ts"
click node_env_provider "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/env-config-provider.ts"
click node_command_provider "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/commandline-config-provider.ts"
click node_default_provider "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/default-config-provider.ts"
click node_secret_provider "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/secret-config-provider.ts"
click node_configuration "https://github.com/cymondez/nest-simple-config/blob/master/lib/simple-config.service.ts"
click node_typed_options "https://github.com/cymondez/nest-simple-config/blob/master/lib/config-options.module.ts"
click node_bind_decorator "https://github.com/cymondez/nest-simple-config/blob/master/lib/decorators/bind-option.decorator.ts"
click node_validation_error "https://github.com/cymondez/nest-simple-config/blob/master/lib/exceptions/config-validate-exception.ts"
click node_secret_store "https://github.com/cymondez/nest-simple-config/blob/master/lib/secret-store.ts"
click node_keytar_store "https://github.com/cymondez/nest-simple-config/blob/master/lib/keytar-secret-store.ts"
click node_secret_cli "https://github.com/cymondez/nest-simple-config/blob/master/lib/secrets-cli.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_simple_module,node_config_builder,node_config_object toneBlue
class node_abstract_provider,node_file_provider,node_json_yaml,node_env_provider,node_command_provider,node_default_provider,node_secret_provider,node_os_secret_manager toneAmber
class node_configuration,node_typed_options,node_bind_decorator,node_validation_error toneMint
class node_secret_store,node_keytar_store,node_secret_cli toneRose
class node_application,node_config_user toneIndigo
```

## Components

### Configuration assembly

- [Config module](https://github.com/cymondez/nest-simple-config/blob/master/lib/simple-config.module.ts): `lib/simple-config.module.ts`
- [Provider builder](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-builder.ts): `lib/config-builder.ts`
- [Merged config](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-builder.ts): `lib/config-builder.ts`

### Configuration sources

- [Provider contract](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/config-provider.abstract.ts): `lib/config-providers/config-provider.abstract.ts`
- [File provider](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/file-config-provider.ts): `lib/config-providers/file-config-provider.ts`
- [JSON / YAML loaders](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/json-config-provider.ts): `lib/config-providers/json-config-provider.ts`
- [Environment provider](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/env-config-provider.ts): `lib/config-providers/env-config-provider.ts`
- [Command-line provider](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/commandline-config-provider.ts): `lib/config-providers/commandline-config-provider.ts`
- [Default provider](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/default-config-provider.ts): `lib/config-providers/default-config-provider.ts`
- [Secret config provider](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-providers/secret-config-provider.ts): `lib/config-providers/secret-config-provider.ts`

### Application access

- [Configuration service](https://github.com/cymondez/nest-simple-config/blob/master/lib/simple-config.service.ts): `lib/simple-config.service.ts`
- [Typed option binding](https://github.com/cymondez/nest-simple-config/blob/master/lib/config-options.module.ts): `lib/config-options.module.ts`
- [Option decorator](https://github.com/cymondez/nest-simple-config/blob/master/lib/decorators/bind-option.decorator.ts): `lib/decorators/bind-option.decorator.ts`
- [Validation error](https://github.com/cymondez/nest-simple-config/blob/master/lib/exceptions/config-validate-exception.ts): `lib/exceptions/config-validate-exception.ts`

### Secret management

- [Secret store](https://github.com/cymondez/nest-simple-config/blob/master/lib/secret-store.ts): `lib/secret-store.ts`
- [OS keytar adapter](https://github.com/cymondez/nest-simple-config/blob/master/lib/keytar-secret-store.ts): `lib/keytar-secret-store.ts`
- [Secret management CLI](https://github.com/cymondez/nest-simple-config/blob/master/lib/secrets-cli.ts): `lib/secrets-cli.ts`

### Other components

- **NestJS app**
- **OS secret manager**
- **Application service**

## Connections

- NestJS app → Config module: configures (evidence: `README.md`)
- Config module → Provider builder: assembles (evidence: `lib/simple-config.module.ts`)
- Provider builder → Provider contract: loads providers (evidence: `lib/config-builder.ts`)
- Provider builder → Merged config: builds (evidence: `lib/config-builder.ts`)
- File provider → Provider contract: implements (evidence: `lib/config-providers/file-config-provider.ts`)
- JSON / YAML loaders → File provider: uses file loading (evidence: `lib/config-providers/json-config-provider.ts`)
- Environment provider → Provider contract: implements (evidence: `lib/config-providers/env-config-provider.ts`)
- Command-line provider → Provider contract: implements (evidence: `lib/config-providers/commandline-config-provider.ts`)
- Default provider → Provider contract: implements (evidence: `lib/config-providers/default-config-provider.ts`)
- Secret config provider → Provider contract: implements
- Provider builder → File provider: registers (evidence: `lib/config-builder.ts`)
- Provider builder → Environment provider: registers (evidence: `lib/config-builder.ts`)
- Provider builder → Command-line provider: registers (evidence: `README.md`)
- Provider builder → Secret config provider: supports
- Config module → Configuration service: provides (evidence: `lib/simple-config.module.ts`)
- Configuration service → Merged config: reads (evidence: `lib/simple-config.service.ts`)
- Application service → Configuration service: reads keys (evidence: `README.md`)
- Config module → Typed option binding: registers (evidence: `lib/simple-config.module.ts`)
- Typed option binding → Configuration service: reads section (evidence: `lib/config-options.module.ts`)
- Typed option binding → Option decorator: reads metadata (evidence: `lib/config-options.module.ts`)
- Typed option binding → Validation error: reports invalid config
- Secret config provider → Secret store: resolves secrets
- Secret management CLI → Secret store: manages secrets
- OS keytar adapter → OS secret manager: stores secrets
- Secret store → OS keytar adapter: adapts via
- NestJS app → Secret management CLI: runs (evidence: `README.md`)
