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.

Install

npm install @goenvless/envless

Wire up the build plugin

next.config.mjs
import { withEnvless } from '@goenvless/envless/next';

export default withEnvless({
    // your existing Next config
});
withEnvless does two things:
  1. Loads the encrypted bundle during next build and next dev config evaluation so client-flagged variables can be inlined into client chunks.
  2. Registers the runtime loader so process.env and env are populated before any of your code runs.

Use it

app/api/checkout/route.ts
import { env } from '@goenvless/envless/server';

export async function POST(req: Request) {
    const stripe = new Stripe(env.STRIPE_SECRET);
    // ...
}
app/page.tsx
'use client';
import { env } from '@goenvless/envless/client';

export default function Page() {
    return <img src={`${env.NEXT_PUBLIC_CDN_URL}/hero.png`} />;
}

App Router rules

File / directiveImport from
Server Components (default)@goenvless/envless/server
Route Handlers@goenvless/envless/server
Server Actions@goenvless/envless/server
middleware.ts@goenvless/envless/server
'use client' files@goenvless/envless/client
Importing /server from a 'use client' file fails at lint and at build.

Edge runtime

When a route opts into the Edge runtime (export const runtime = 'edge'), the build plugin pre-resolves all referenced variables at build time and inlines them. No runtime fetch on the edge, no extra latency.

Dev mode

In next dev, the loader watches .envless and the API. When a variable changes in the dashboard, Next’s fast refresh picks it up — no manual restart.

Production builds

CI doesn’t have a cached key. Provide a personal access token:
ENVLESS_TOKEN=ev_live_xxxxxxxxxxxx next build
See Production & CI for details.