Layouts

Simple layout

Get the ultimate DX in Nuxt using a single, unified schema file.

In this setup, you define your client, server, and shared schemas in a single file.

env.ts

To protect server-side secrets from ever reaching the client bundle, ArkEnv uses a proxy that throws a runtime error if a server-side variable is detected.

Defining your schemas together means the server validation logic is shipped in the client bundle.

⚠️ Visible in JS bundle🔒 Secure on server
Schema (keys, types, and constraints)
e.g., DATABASE_URL: string.url
Runtime values
e.g., "postgresql://db..."

If exposing your server variable names, types, or constraints is a security concern, use the strict layout instead.

Setup

The easiest way to bootstrap the simple layout is with the ArkEnv CLI. It automatically configures @arkenv/nuxt for your existing Nuxt project and generates your env.ts file.

npx @arkenv/cli@latest init --simple
pnpm dlx @arkenv/cli@latest init --simple
yarn dlx @arkenv/cli@latest init --simple
bunx @arkenv/cli@latest init --simple

Your schema

When bootstrapping with the CLI, it generates a single env.ts file where you define your client, server, and shared schemas:

env.ts
export const  = ({
	: {
		: "string",
	},
	: {
		: "string",
	},
	: {
		: "string",
	},
});