Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.envless.cloud/llms.txt

Use this file to discover all available pages before exploring further.

The runtime mode populates process.env and exposes a typed env object directly to your code. No .env files on disk, no dotenv step, no process.env.X typos that silently return undefined.

import { env } from '@goenvless/envless';

env.DATABASE_URL    // string, autocompleted, throws if missing
env.PORT            // number, coerced from the schema

Five-minute setup

1

Install Envless

npm install @goenvless/envless
If you also want the envless CLI globally for login/link:
npm install -g @goenvless/envless
2

Log in and link

envless login
envless link
envless passphrase set
This writes .envless at your project root and caches your decryption key.
3

Generate types

envless types
Writes envless-env.d.ts next to your package.json. Commit it — no secrets, only the shape.
4

Import and use

import { env } from '@goenvless/envless';

const db = new Database(env.DATABASE_URL);
5

Run your app

npm run dev
On boot, Envless fetches the encrypted bundle, decrypts it with your cached key, and exposes env. process.env is populated too, so libraries that read it directly keep working.

What you can delete

  • Your .env / .env.local / .env.development files (or keep them — real env still wins as override).
  • dotenv and dotenv-cli from package.json.
  • Any t3-env / envalid / hand-rolled validation — the schema lives in Envless now.
  • .env.* entries in .gitignore.

What it looks like in practice

import { env } from '@goenvless/envless';

const db = new Database({
    url: env.DATABASE_URL,          // string, required
    poolSize: env.DB_POOL_SIZE,     // number, optional with default
});

const stripe = new Stripe(env.STRIPE_SECRET);

if (env.FEATURE_X_ENABLED) {        // boolean, from the schema
    enableFeatureX();
}

Every property is autocompleted. Misspell one and TypeScript fails the build. Miss a required value and it throws at boot with a useful message.

Framework-specific setup

https://mintcdn.com/envless-7b88c948/9f3dXE0TchC0LVM7/assets/icons/duotone/code.svg?fit=max&auto=format&n=9f3dXE0TchC0LVM7&q=85&s=fbd6ab5160f56cd28bd3af2bff1550eb

Next.js

App Router, Pages Router, Edge.
https://mintcdn.com/envless-7b88c948/9f3dXE0TchC0LVM7/assets/icons/duotone/lightning.svg?fit=max&auto=format&n=9f3dXE0TchC0LVM7&q=85&s=f575bd0acd9e226946c861301950ccd5

Vite

SPAs, SvelteKit, Astro, Remix-on-Vite.
https://mintcdn.com/envless-7b88c948/nR8RUPgNBtCF5SFI/assets/icons/duotone/terminal-window.svg?fit=max&auto=format&n=nR8RUPgNBtCF5SFI&q=85&s=59666127dd6ae7b6c5dd9fce7bd3e392

Node

Express, Fastify, Hono, scripts.
https://mintcdn.com/envless-7b88c948/9f3dXE0TchC0LVM7/assets/icons/duotone/lightning.svg?fit=max&auto=format&n=9f3dXE0TchC0LVM7&q=85&s=f575bd0acd9e226946c861301950ccd5

Bun

Preload hook or direct import.
https://mintcdn.com/envless-7b88c948/9f3dXE0TchC0LVM7/assets/icons/duotone/globe.svg?fit=max&auto=format&n=9f3dXE0TchC0LVM7&q=85&s=229329c024d61c61f298955438d51f26

Workers / Edge

Cloudflare, Vercel Edge, Netlify Edge.

Next steps

https://mintcdn.com/envless-7b88c948/9f3dXE0TchC0LVM7/assets/icons/duotone/shield-check.svg?fit=max&auto=format&n=9f3dXE0TchC0LVM7&q=85&s=e2fac80ab85ae810abeeeb59fb16097d

Server vs Client

Split visibility so secrets never end up in your client bundle.
https://mintcdn.com/envless-7b88c948/9f3dXE0TchC0LVM7/assets/icons/duotone/code.svg?fit=max&auto=format&n=9f3dXE0TchC0LVM7&q=85&s=fbd6ab5160f56cd28bd3af2bff1550eb

Typed Variables

How codegen, coercion, and validation work.