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.
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 --simplepnpm dlx @arkenv/cli@latest init --simpleyarn dlx @arkenv/cli@latest init --simplebunx @arkenv/cli@latest init --simpleYour schema
When bootstrapping with the CLI, it generates a single env.ts file where you define your client, server, and shared schemas:
export const = ({
: {
: "string",
},
: {
: "string",
},
: {
: "string",
},
});