shrimple-env

shrimple-env

An opinionated but small environment variable reader for Javascript.

Install shrimple-env with your package manager of choice. Bun should also work.

import 'shrimple-env/init';

console.log(process.env.MY_ENV_VAR);

With this approach, shrimple-env will look for a .env file in the root of your project.

import { init } from 'shrimple-env';
init({
envFiles: ['.env', '.env.local'],
})

The parsing tool used is also exported for better bug reproduction or for whatever reason you might need it.

import { parseEnv } from 'shrimple-env';

const env = 'HELLO=world\nFOO=bar';
const parsed = parseEnv(env);
console.log(parsed);