@arkenv/nuxt
Subpath exports and module options for the Nuxt package.
API reference for @arkenv/nuxt. Setup recipes:
Nuxt guide.
Installation
npm install @arkenv/core @arkenv/nuxt arktypepnpm add @arkenv/core @arkenv/nuxt arktypeyarn add @arkenv/core @arkenv/nuxt arktypebun install @arkenv/core @arkenv/nuxt arktypeOr if you use Zod, Valibot, or another Standard Schema validator:
npm install @arkenv/standard @arkenv/nuxtpnpm add @arkenv/standard @arkenv/nuxtyarn add @arkenv/standard @arkenv/nuxtbun install @arkenv/standard @arkenv/nuxtSubpaths
| Subpath | Role |
|---|---|
. | Runtime arkenv |
./module | Nuxt module (modules: ["@arkenv/nuxt/module"]) |
./config | setupArkEnv 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.
export default defineNuxtConfig({
modules: ["@arkenv/nuxt/module"],
});Module options
These options live under arkenv in nuxt.config.
| Option | Default | Meaning |
|---|---|---|
validate | true | Validate during Nuxt build/dev |
schemaPath | auto | Schema entry path |
logger / logLevel | (none) | Logging controls |
Schema
Use the default entry for a single schema file.
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.