# env-plus

> Modern package to manage and document evnironment variables with schemas

Latest version **0.1.3** (published 2023-03-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install env-plus
pnpm add env-plus
yarn add env-plus
bun add env-plus
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.3 |
| Published | 2023-03-09 |
| First published | 2023-03-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 21.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Adrian Romanowski |
| Maintainers | adrian-rom64 |
| Keywords | env, config, configuration, documentation, docs, environment, variables, validation, decorator, typescript |

## Links

- npm: https://www.npmjs.com/package/env-plus
- Repository: https://github.com/adrian-rom64/env-plus
- Homepage: https://github.com/adrian-rom64/env-plus.git
- Issues: https://github.com/adrian-rom64/env-plus/issues
- npm.io page: https://npm.io/package/env-plus

## Dependencies (2)

- [dotenv](https://npm.io/package/dotenv.md) ^16.0.3
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) ^0.1.13

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 0.1.3 (latest) — 2023-03-09
- 0.1.2 — 2023-03-02
- 0.1.1-alpha — 2023-03-01
- 0.1.0-alpha — 2023-03-01

## README

# env-plus

**This is work in progress. Api changes frequently**

## Getting started

Run your favourite package manager

```bash
npm install env-plus
# yarn add env-plus
# pnpm install env-plus
```

Make sure you have these properties in typescript config

```json
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strictPropertyInitialization": false
```

Create .env file with example variables

```bash
MESSAGE="hello there"
PORT="3000"
LOGGER="true"
```

Create your first env schema

```typescript
import * as dotenv from 'dotenv'
dotenv.config()

import { EnvSchema, EnvProperty, EnvManager } from 'env-plus'

@EnvSchema()
export class MyEnvSchema {
  @EnvProperty('MESSAGE')
  message: string

  @EnvProperty('PORT')
  port: number

  @EnvProperty('LOGGER')
  logger: boolean
}

const env = EnvManager.getPlainInstance(MyEnvSchema)

console.log(env)
```

Returns an object with parsed values

```typescript
{
  message: 'hello there',
  port: 3000,
  logger: true
}
```

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