Languages

Envlet for Node.js

One line at boot and process.env is full. Node, Bun, and edge runtimes.

Inject
import { inject } from "@envlet/sdk";

await inject();

const stripe = new Stripe(process.env.STRIPE_KEY);
Load
import { load } from "@envlet/sdk";

const values = await load();

const db = connect(values.DATABASE_URL);
Get
import { get } from "@envlet/sdk";

const stripeKey = await get("STRIPE_KEY");
Install
npm install @envlet/sdk

Set up

  1. 01

    Install

    npm install @envlet/sdk.

  2. 02

    Set one secret

    ENVLET_TOKEN on the host. It is the only secret the host keeps.

  3. 03

    Inject at boot

    Call inject() before anything reads process.env.

Questions

Will my app start if Envlet is down?
No, and that is the point. The SDK retries for a few seconds, then fails so you notice. It never starts your app with half an environment.
What does the host need?
One variable, ENVLET_TOKEN. Everything else arrives at boot.
Can I still set some values on the Node.js host?
Yes. A value the host already set wins. Pass override if you want Envlet to win instead.

Stop pasting .env files.

One command. The right values for whoever runs it.