The Problem
dotenv is the standard for loading .env files in Node.js — but it has more features than most projects need, and the dependency tree keeps growing.
I wanted something minimal: zero dependencies, tiny API, and fast.
env-fast
env-fast is a zero-dependency .env loader with a simple API:
const env = require('env-fast');
const result = env.load();
console.log(result); // { loaded: true, path: '.env', variables: 12 }
Features
- Zero dependencies
- Variable expansion (${VAR} syntax)
- Custom paths
- TypeScript-friendly
- Under 2KB
Install
npm install env-fast
Usage
// .env
PORT=3000
DATABASE_URL=postgres://localhost/mydb
// index.js
const env = require('env-fast');
env.load();
console.log(process.env.PORT); // 3000
When to Use
- Side projects needing simple env loading
- Serverless functions where size matters
- Any project wanting zero dependency overhead
GitHub: https://github.com/opensource-crypto/env-fast
npm: https://www.npmjs.com/package/env-fast
Top comments (0)