# tej-env

> A package to load & update environment variables from .env file. Supports runtime updates for Express.js

Latest version **1.1.3** (published 2025-04-27) · ISC license · 0 weekly downloads

## Install

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

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2025-04-27 |
| First published | 2024-04-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Hirak Chhatbar |
| Maintainers | dr.hirak |
| Keywords | dotenv, env, .env, environment, variables, config, settings, global variables, global config |

## Links

- npm: https://www.npmjs.com/package/tej-env
- Repository: https://github.com/hirakchhatbar/tej-env
- Homepage: https://github.com/hirakchhatbar/tej-env#readme
- Issues: https://github.com/hirakchhatbar/tej-env/issues
- npm.io page: https://npm.io/package/tej-env

## 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

- 1.1.3 (latest) — 2025-04-27
- 1.1.2 — 2024-07-31
- 1.1.1 — 2024-07-21
- 1.1.0 — 2024-07-21
- 1.0.9 — 2024-05-01
- 1.0.8 — 2024-05-01
- 1.0.7 — 2024-05-01
- 1.0.6 — 2024-04-23
- 1.0.5 — 2024-04-12
- 1.0.3 — 2024-04-12
- 1.0.2 — 2024-04-10
- 1.0.1 — 2024-04-10

## README

# <p align="center">Tej-Env</p>

A zero-dependency module to load environment variables in your Nodejs project.

## 🧐 Features
- Load environment variables and access them anywhere with process.env or our global variable TejEnv
- Ability to set environment variables to access them anytime anywhere within that application session. (This doesn't update .env file)
-  [UPCOMING] - Optionally update .env file on the go with in-built routes for express.js and te.js

<br>

## 🛠️ Install
```bash
npm install tej-env
```

<br>

## 🧑🏻‍💻 Basic Usage
```js
import "tej-env"

// To read an environment variable anywhere in your project:
const value = process.env.YOUR_VARIABLE_NAME;
```

<br>

## 🧑🏻‍💻 Advanced Usage
tej-env module can be used to set and unset variables at global level. This will not update the .env file yet. Updating env file is a work in progress.
<br>
Import required functions from tej-env module and use them as shown below:
```js
import { env, setEnv, unsetEnv} from 'tej-env'
```

There are 2 options to read an environment variable or global variable anywhere in your project:
<br>
<br>
Option 1: Using process.env
```js
const value = process.env.YOUR_VARIABLE_NAME;
```
Option 2: Using env() function from tej-env
```js
const data = env("YOUR_VARIABLE_NAME");
```

<br>
To set an environment variable or global variable anywhere in your project, use setEnv() function from tej-env

```js
setEnv(key, value);
```

<br>
To unset an environment variable or global variable anywhere in your project, use unsetEnv() function from tej-env

```js
unsetEnv(key, value);
```


<br>

## 🍰 Contributing
Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are **greatly appreciated**.


<br>

## ❤️ Support
A simple star to this project repo is enough to keep me motivated on this project for days. If you find your self very much excited with this project let me know with a star.


<br>

## 🙇 Author
#### Hirak Chhatbar
- Github: [@hirakchhatbar](https://github.com/hirakchhatbar)


<br>

## ➤ License
Distributed under the MIT License. See [LICENSE](LICENSE) for more information.

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