# Config API reference

> Current emitted signatures and options for @db3.ai/app/config.

- Package: `@db3.ai/app/config`
- Canonical page: [https://db3.ai/docs/config-api](https://db3.ai/docs/config-api)
- Markdown: [https://db3.ai/docs/config-api.md](https://db3.ai/docs/config-api.md)
- Framework source of truth: `packages/app/src/config/README.md`

<a id="start"></a>

## Imports and examples

Import supported APIs from `@db3.ai/app/config`. These signatures come from the staged package used by consumers. Relative filenames in declarations describe type dependencies; they are not extra supported deep imports.

Use the guide for setup, executable examples, failure handling and ownership. A signature is not proof that every deployment or provider has been exercised.

- [Guide, examples and testing](https://db3.ai/docs/config.md)

<a id="repository"></a>

## Config and defineConfig

### Config and defineConfig

```typescript
export type ConfigValues = Record<string, unknown>;
/**
 * Runtime configuration repository with dot-path reads.
 */
export declare class Config<TValues extends ConfigValues = ConfigValues> {
    private readonly values;
    /**
     * Creates a config repository from a plain object.
     *
     * @param values - Config values to expose.
     */
    constructor(values?: TValues);
    /**
     * Returns all config values.
     *
     * @returns Config object supplied to this repository.
     */
    all(): TValues;
    /**
     * Reads a config value by dot path.
     *
     * @param path - Dot-separated config path.
     * @returns Config value or undefined when the path is missing.
     */
    get<TValue = unknown>(path: string): TValue | undefined;
    /**
     * Reads a config value by dot path with a fallback.
     *
     * @param path - Dot-separated config path.
     * @param fallback - Value to return when the path is missing.
     * @returns Config value or fallback.
     */
    get<TValue>(path: string, fallback: TValue): TValue;
    /**
     * Returns true when a dot path exists in this config repository.
     *
     * @param path - Dot-separated config path.
     * @returns True when the path exists.
     */
    has(path: string): boolean;
}
/**
 * Defines a typed config object without changing its runtime shape.
 *
 * @param values - Config values to preserve.
 * @returns The same config values.
 */
export declare function defineConfig<TValues extends ConfigValues>(values: TValues): TValues;
```

<a id="environment"></a>

## Environment readers and parser overloads

### Environment readers and parser overloads

```typescript
export type EnvSource = Record<string, string | undefined>;
export interface EnvReader {
    (name: string): string | undefined;
    <TDefault>(name: string, fallback: TDefault): string | TDefault;
    required(name: string): string;
    string(name: string): string | undefined;
    string<TDefault>(name: string, fallback: TDefault): string | TDefault;
    boolean(name: string): boolean | undefined;
    boolean<TDefault>(name: string, fallback: TDefault): boolean | TDefault;
    number(name: string): number | undefined;
    number<TDefault>(name: string, fallback: TDefault): number | TDefault;
    integer(name: string): number | undefined;
    integer<TDefault>(name: string, fallback: TDefault): number | TDefault;
    array(name: string): string[] | undefined;
    array<TDefault>(name: string, fallback: TDefault): string[] | TDefault;
    json<TValue = unknown>(name: string): TValue | undefined;
    json<TValue = unknown, TDefault = TValue>(name: string, fallback: TDefault): TValue | TDefault;
}
/**
 * Creates an env reader over a supplied source object.
 *
 * @param source - Environment-like key/value source.
 * @returns Callable env reader with typed parsing helpers.
 */
export declare function createEnv(source?: EnvSource): EnvReader;
export declare const env: EnvReader;
```

## Related documentation
- [Configuration](https://db3.ai/docs/config.md): Read settings once at boot. Parse environment values, validate the bits your application needs and pass them into the services that use them.

## Guidance for AI tools
Use the documented public import `@db3.ai/app/config` and its exported types. Prefer the source-backed examples and behavioural outcomes above over invented APIs or source-relative internal imports.
