# @confconf/confconf-typebox

> Integrates @confconf/confconf with @sinclair/typebox

Latest version **2.2.1** (published 2022-09-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @confconf/confconf-typebox
pnpm add @confconf/confconf-typebox
yarn add @confconf/confconf-typebox
bun add @confconf/confconf-typebox
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.1 |
| Published | 2022-09-05 |
| First published | 2021-12-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Tomi Turtiainen |
| Maintainers | tomiturtiainen |
| Keywords | confconf, typebox, typescript, json-schema |

## Links

- npm: https://www.npmjs.com/package/@confconf/confconf-typebox
- Repository: https://github.com/tomi/confconf
- Homepage: https://github.com/tomi/confconf/tree/main/packages/confconf-typebox#readme
- Issues: https://github.com/tomi/confconf/issues
- npm.io page: https://npm.io/package/@confconf/confconf-typebox

## Dependencies (1)

- [@confconf/confconf](https://npm.io/package/@confconf/confconf.md) 2.2.1

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 2.2.1 (latest) — 2022-09-05
- 2.2.0 — 2021-12-29
- 2.1.0 — 2021-12-29
- 2.0.1 — 2021-12-29
- 2.0.0 — 2021-12-29

## README

# confconf-typebox

Integrates [`@confconf/confconf`](https://github.com/tomi/confconf/tree/main/packages/confconf) with [`@sinclair/typebox`](https://github.com/sinclairzx81/typebox).

## Install

```bash
npm i --save @confconf/confconf-typebox @sinclair/typebox
```

## Usage

```ts
import { confconf, envConfig } from "@confconf/confconf-typebox";
import { Static, Type } from "@sinclair/typebox";

// Define a schema
const configSchema = Type.Object({
  port: Type.Number(),
  db: Type.Object({
    host: Type.String(),
    name: Type.String(),
  }),
});

type Config = Static<typeof configSchema>;

// Create the configuration loader and load configuration and validate
// it against the schema
const config = await confconf({
  schema: configSchema,
  providers: [
    // Load from env variables
    envConfig({
      // Map the specifc env variables into a specific structure
      structure: {
        port: "PORT",
        db: {
          host: "DB_HOST",
          name: "DB_NAME",
        },
      },
    }),
  ],
}).loadAndValidate();
```

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