Skip to main content

Install

npm install @goenvless/envless

Add the plugin

vite.config.ts
import { defineConfig } from 'vite';
import { envless } from '@goenvless/envless/vite';

export default defineConfig({
    plugins: [envless()],
});
The plugin runs during config resolution. Client-flagged variables are inlined as string literals at build time; server-flagged variables are stripped from client chunks.

Use it

src/server/db.ts
import { env } from '@goenvless/envless/server';

export const db = createClient({ url: env.DATABASE_URL });
src/main.ts
import { env } from '@goenvless/envless/client';

fetch(env.PUBLIC_API_URL);

Variable naming

Vite traditionally requires VITE_ prefixed variables to be exposed to the client. With envless you don’t need the prefix — visibility is controlled by the dashboard flag. You can keep the prefix if you like the convention, but it’s not required.

Dev mode

vite dev picks up dashboard changes without restart. Saved variables trigger HMR for any module that references them.

CI builds

ENVLESS_TOKEN=ev_sk_xxxxxxxxxxxx vite build