@arkenv/nuxt

Subpath exports and module options for the Nuxt package.

Edit on GitHub

@arkenv/nuxt validates environment variables from a Nuxt module and hydrates public keys through Nitro runtimeConfig. This page is the subpath and option list. Setup recipes live in the Nuxt guide.

Flat arkenv(schema, { exposeToClient }) is the only call shape. Nested bags and expose / shared aliases were removed — see Migrating to v1.

Installation

Install the module next to the engine you write schemas with. The module does not bundle @arkenv/core or @arkenv/standard.

npm install @arkenv/core @arkenv/nuxt arktype

Or if you use Zod, Valibot, or another Standard Schema validator:

npm install @arkenv/standard @arkenv/nuxt

Subpaths

SubpathRole
.Runtime arkenv
./moduleNuxt module (modules: ["@arkenv/nuxt/module"])
./configsetupArkEnv and config types
./standardStandard Schema runtime
./standard/moduleStandard Schema Nuxt module

Module setup

Register the module in nuxt.config. The schema module is the surface. Nuxt leaves env.gen.ts to Next.js.

./nuxt.config.ts
export default defineNuxtConfig({
  modules: ["@arkenv/nuxt/module"],
});

Module options

These options live under arkenv in nuxt.config.

OptionDefaultMeaning
validatetrueValidate during Nuxt build/dev
schemaPathautoSchema entry path
logger / logLevel(none)Logging controls

Schema

Use the default entry for a single schema file.

./env.ts
import arkenv from "@arkenv/nuxt";

export const env = arkenv({
  DATABASE_URL: "string",
  NUXT_PUBLIC_API_URL: "string",
});

For an optional client/server module split, see Client vs. server. Never import a server env module from client or Vue code.

Next steps