# configchecker

> A very simple and effective way to check config, before it's used in runtime with nice fluent API. Here is the full documentation.

Latest version **1.5.132** (published 2025-11-07) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install configchecker
pnpm add configchecker
yarn add configchecker
bun add configchecker
```

## Health

**Score 55/100 (C)** — status: stable.

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

Warnings: low downloads; no esm support.

## Facts

| | |
|---|---|
| Version | 1.5.132 |
| Published | 2025-11-07 |
| First published | 2019-06-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 40.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Pavol Hejný |
| Maintainers | hejny |

## Links

- npm: https://www.npmjs.com/package/configchecker
- Repository: https://github.com/hejny/configchecker
- Homepage: https://github.com/hejny/configchecker#readme
- Issues: https://github.com/hejny/configchecker/issues
- Funding: https://buymeacoffee.com/hejny
- npm.io page: https://npm.io/package/configchecker

## Recent versions

- 1.5.132 (latest) — 2025-11-07
- 1.5.131 — 2025-11-06
- 1.5.130 — 2025-11-05
- 1.5.129 — 2025-11-03
- 1.5.128 — 2025-10-28
- 1.5.127 — 2025-10-18
- 1.5.126 — 2025-10-15
- 1.5.125 — 2025-09-13
- 1.5.124 — 2025-09-12
- 1.5.123 — 2025-09-09
- 1.5.122 — 2025-09-09
- 1.5.121 — 2025-08-23
- 1.5.120 — 2025-08-04
- 1.5.119 — 2025-06-20
- 1.5.118 — 2025-06-13
- … 129 more at https://npm.io/package/configchecker/versions

## README

# ☑️ Config Checker

<!--Badges-->
<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src/workflows/800-badges/badges.ts so every manual change will be overwritten.-->


[![Quality of package Config Checker](https://packagequality.com/shield/configchecker.svg)](https://packagequality.com/#?package=configchecker)
[![Known Vulnerabilities](https://snyk.io/test/github/hejny/configchecker/badge.svg)](https://snyk.io/test/github/hejny/configchecker)
[![Issues](https://img.shields.io/github/issues/hejny/configchecker.svg?style=flat)](https://github.com/hejny/configchecker/issues)
<!--[![License of Config Checker](https://img.shields.io/github/license/hejny/configchecker.svg?style=flat)](https://github.com/hejny/configchecker/blob/main/LICENSE)-->
<!--[![NPM Version of Config Checker](https://badge.fury.io/js/configchecker.svg)](https://www.npmjs.com/package/configchecker)-->
<!--[![Socket](https://socket.dev/api/badge/npm/package/configchecker)](https://socket.dev/npm/package/configchecker)-->

<!--/Badges-->

A very simple and effective way to check config, before it's used in runtime with nice fluent API. Here is the full **[documentation](https://hejny.github.io/configchecker/)**.



<!--Wallpaper-->
<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src//workflows/315-ai-generated-wallpaper/4-aiGeneratedWallpaperUseInReadme.ts so every manual change will be overwritten.-->
[![Wallpaper of ☑️ Config Checker](assets/ai/wallpaper/gallery/98062879-c3c7-438e-9d5a-af1a601edcc1-0_0.png)](https://www.midjourney.com/app/jobs/98062879-c3c7-438e-9d5a-af1a601edcc1)
<!--/Wallpaper-->

## Install

Install from [NPM](https://www.npmjs.com/package/configchecker)

```bash
npm i configchecker
```

## 💡 Motivation

When you use some ENV value do you really know what it contains or if it is really defined?

```typescript
export const { TESTING_MAIL } = process.env;
```

This will be OK until your server tries to send some email. Maybe it drops the whole server or just don't do nothing and you will be figuring out why the hell server is working but it doesn't send any emails.

I have this problem many many times.

And because I am a TypeScript lover it is fully using all advantages of static typing.

## Usage

I load the config from some environment Object:

```typescript
import { ConfigChecker } from 'configchecker';

const config = ConfigChecker.from(process.env);
```

And then I can read variabiles from it:

```typescript
config.get('TESTING_MAIL').value;
```

I can enforce them:

```typescript
config.get('TESTING_MAIL').required().value;
```

I can convert them to certain types:

```typescript
config.get('...').number().value;
config.get('...').boolean().value;
config.get('...').json().value;
config.get('...').list().value;
config.get('...').date().value;
config.get('...').url().value;
```

### Full sample 1

```typescript
import { ConfigChecker } from 'configchecker';
const config = ConfigChecker.from(process.env);

export const PORT = config
.get('PORT')
.number()
.required().value;
export const TESTING_MAIL = config.get('TESTING_MAIL').value;
```

### Full sample 2

This sample is working same like sample 1 but unfortunately it is not using full TypeScript potential.

```typescript
import { ConfigChecker } from 'configchecker';
const config = ConfigChecker.from(process.env);

export default {
...config
.get('PORT')
.number()
.required().object,
...config.get('TESTING_MAIL').object,
};
```

<!--
TODO: To all projects:
+ donation address


# Contributing

I am open to your pull requests, feedback, suggestions, and donations. Contact to me is on my [personal page](https://www.pavolhejny.com)
-->

## Authors

-   [Pavol Hejný](https://github.com/hejny)
-   [David Pohan](https://github.com/pohy)



<!--Contributing-->
<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src/workflows/810-contributing/contributing.ts so every manual change will be overwritten.-->

## 🖋️ Contributing

I am open to pull requests, feedback, and suggestions. Or if you like this utility, you can [☕ buy me a coffee](https://www.buymeacoffee.com/hejny) or [donate via cryptocurrencies](https://github.com/hejny/hejny/blob/main/documents/crypto.md).

You can also ⭐ star the configchecker package, [follow me on GitHub](https://github.com/hejny) or [various other social networks](https://www.pavolhejny.com/contact/).

<!--/Contributing-->


<!--Partners-->
<!--⚠️WARNING: This section was generated by https://github.com/hejny/batch-project-editor/blob/main/src/workflows/820-partners/partners.ts so every manual change will be overwritten.-->

## ✨ Partners


<a href="https://collboard.com/" title="Collboard"><img src="https://collboard.fra1.cdn.digitaloceanspaces.com/assets/18.12.1/logo-small.png#gh-light-mode-only" alt="Collboard" height="60"/></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://webgpt.cz/?partner=ph&utm_medium=referral&utm_source=github-readme&utm_campaign=partner-ph" title="WebGPT"><img src="https://webgpt.cz/_next/static/media/webgpt-black.8d958d25.png#gh-light-mode-only" alt="WebGPT" height="60"/></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://github.com/webgptorg/promptbook" title="Promptbook"><img src="https://raw.githubusercontent.com/webgptorg/promptbook/main/other/design/logo.png#gh-light-mode-only" alt="Promptbook" height="60"/></a>


[Become a partner](https://www.pavolhejny.com/contact/)

<!--/Partners-->

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