Zod, Valibot, and other Standard Schema validators

Mix and match ArkType with Zod, Valibot, or other Standard Schema compatible libraries.

ArkEnv for Nuxt supports any Standard Schema validator. That includes Zod, Valibot, Typia, and any validator listed here:

Simple layout

Here is an example using Zod or Valibot with the simple layout:

env.ts
export const  = ({
	: {
		: .().(),
	},
	: {
		: .().(),
	},
	: {
		: .(["development", "production", "test"]),
	},
});
env.ts
export const  = ({
	: {
		: .(.(), .()),
	},
	: {
		: .(.(), .()),
	},
	: {
		: .(["development", "production", "test"]),
	},
});

Strict layout

You can freely mix Zod or Valibot schemas with the strict layout:

env/internal/shared.ts
import {  } from "zod";

/**
 * @internal 馃洃 INTERNAL SCHEMA ONLY.
 * Do not import this directly. Import `env` from `./client` or `./server` instead.
 */
export const  = .({
	: .(["development", "production", "test"]).("development"),
});
env/internal/shared.ts
import * as  from "valibot";

/**
 * @internal 馃洃 INTERNAL SCHEMA ONLY.
 * Do not import this directly. Import `env` from `./client` or `./server` instead.
 */
export const  = .({
	: .(.(["development", "production", "test"]), "development"),
});