# @flatbread/config

> Loads, validates, and types flatbread.config.* files. Provides defineConfig().

Latest version **1.2.0** (published 2026-08-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @flatbread/config
pnpm add @flatbread/config
yarn add @flatbread/config
bun add @flatbread/config
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2026-08-24 |
| First published | 2021-11-21 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=20.19 |
| Dependencies | 2 |
| Unpacked size | 64.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 69 |
| Author | Tony Ketcham |
| Maintainers | tonyketcham |

## Links

- npm: https://www.npmjs.com/package/@flatbread/config
- Repository: https://github.com/FlatbreadLabs/flatbread
- Homepage: https://github.com/FlatbreadLabs/flatbread/tree/main/packages/config#readme
- Issues: https://github.com/FlatbreadLabs/flatbread/issues
- npm.io page: https://npm.io/package/@flatbread/config

## Dependencies (2)

- [esbuild](https://npm.io/package/esbuild.md) 0.25.0
- [@flatbread/core](https://npm.io/package/@flatbread/core.md) 1.2.0

## Recent versions

- 1.2.0 (latest) — 2026-08-24
- 1.0.0-alpha.3 (alpha) — 2022-06-30
- 1.1.0 — 2026-08-23
- 1.0.1 — 2026-08-15
- 1.0.0 — 2026-08-12
- 1.0.0-alpha.9 — 2025-08-10
- 1.0.0-alpha.8 — 2022-08-04
- 1.0.0-alpha.7 — 2022-07-01
- 1.0.0-alpha.6 — 2022-07-01
- 1.0.0-alpha.5 — 2022-07-01
- 1.0.0-alpha.4 — 2022-06-30
- 1.0.0-alpha.2 — 2022-06-25
- 1.0.0-alpha.1 — 2022-06-25
- 1.0.0-alpha.0 — 2021-11-25
- 0.0.2 — 2021-11-21

## README

# @flatbread/config 📐

> Provides a typed config helper function, config validation, and auto-config retrieval.

## 💾 Install

Use `pnpm`, `npm`, or `yarn`:

```bash
pnpm i @flatbread/config
```

Valid config filenames:

- `flatbread.config.js`
- `flatbread.config.mjs`
- `flatbread.config.cjs`
- `flatbread.config.ts`
- `flatbread.config.mts`
- `flatbread.config.cts`

## 👩‍🍳 Typical Usage

### defineConfig(config)

Provides assistance to your IDE for building your config

```js
// flatbread.config.js
import defineConfig from '@flatbread/config';

export default defineConfig({
  ...
});
```

## 😳 Advanced Usage

If you're building something custom, piecemealed from these modules, you can make use of schema validation & config auto-loading.

### `async loadConfig(...)`

Pulls the user config from an optionally specified filepath. By default, this will search the current working directory.

#### options

- Type: `{cwd?: string | undefined;}`
- Default: `{}`

Options for loading the config file, defaults to `{}`. Can pass in `cwd` as a path `string` to override the current working directory.

### `validateConfigHasExports(config)`

Validate that the user config has a default export that is an object.

### `validateConfigStructure(config)`

Validate that the user config has `source` and `content` properties.

---
_Source: https://npm.io/package/@flatbread/config · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
