@arkenv/nuxt

Subpath exports and module options for the Nuxt package.

Edit on GitHub

API reference for @arkenv/nuxt. Setup recipes: Nuxt guide.

Installation

npm install @arkenv/core @arkenv/nuxt arktype
pnpm add @arkenv/core @arkenv/nuxt arktype
yarn add @arkenv/core @arkenv/nuxt arktype
bun install @arkenv/core @arkenv/nuxt arktype

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

npm install @arkenv/standard @arkenv/nuxt
pnpm add @arkenv/standard @arkenv/nuxt
yarn add @arkenv/standard @arkenv/nuxt
bun install @arkenv/standard @arkenv/nuxt

Subpaths

SubpathRole
.Runtime arkenv
./moduleNuxt module (modules: ["@arkenv/nuxt/module"])
./configsetupArkEnv and config types
./standard and ./standard/*Standard Schema variants (including ./standard/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