Validators
Choose between @arkenv/core and @arkenv/standard, then wire ArkType, Zod, or Valibot.
ArkEnv ships two engines. Both call arkenv(), share fail-fast errors,
the coercion pipeline, and framework plugins. Shared
options (env, coerce, safe, …) apply
to both. toJsonSchema is on @arkenv/standard only; ArkType already
exposes JSON Schema. The engines also differ in schema style and peer
dependencies.
@arkenv/core | @arkenv/standard | |
|---|---|---|
| Schema style | ArkType DSL strings + type() | Per-key Standard Schema validators |
| Typical libraries | ArkType | Zod, Valibot, VineJS, Zod Mini, … |
Runtime dependencies | None | None |
Peer arktype | Required | None |
Env keywords (string.host, number.port) | Yes | Use the validator's own APIs |
| Coercion | Built-in | Built-in when fields expose Standard JSON Schema v1, via /valibot or /zod-mini, or via toJsonSchema |
| Framework plugins | @arkenv/nextjs, … | Same packages via /standard subpaths |
Pick the engine that matches the schema library you write, then follow the cookbook below.
Side by side
The same keys, two declaration styles. Zod 4.2+ does not need
z.coerce; ArkEnv coerces first.
import from "@arkenv/core";
export const = ({
: "string",
: "number.port = 3000",
: "'development' | 'production' | 'test' = 'development'",
});import from "@arkenv/standard";
import * as from "zod";
export const = ({
: .(),
: .().(0).(65535).(3000),
:
.(["development", "production", "test"])
.("development"),
});Install either stack the same way you would any env schema: one validation package, then framework plugins if you need them.
ArkType engine:
npm install @arkenv/core arktypepnpm add @arkenv/core arktypeyarn add @arkenv/core arktypebun install @arkenv/core arktypeStandard Schema engine:
npm install @arkenv/standardpnpm add @arkenv/standardyarn add @arkenv/standardbun install @arkenv/standardWhen each fits
| Situation | Engine |
|---|---|
| You want ArkType's DSL and ArkEnv keywords | @arkenv/core |
| The app already uses Zod or Valibot for other schemas | @arkenv/standard |
| You must stay ArkType-free | @arkenv/standard |
| You are scaffolding a new TypeScript app and like ArkType | @arkenv/core |
ArkType itself implements Standard Schema. If you already depend on
ArkType, stay on @arkenv/core rather than wrapping ArkType types
through @arkenv/standard.
Packaging
Engines are separate packages so peer dependencies stay honest.
Framework plugins stay single packages with /standard subpaths
(@arkenv/nextjs/standard, @arkenv/vite-plugin/standard, and so on)
instead of a second npm package per host.
JSON Schema and coercion
Standard Schema and Standard JSON Schema are orthogonal specs: one is about validation, the other about converting a type to JSON Schema. A value can implement one, both, or neither.
ArkEnv's pre-coercion step for @arkenv/standard prefers Standard
JSON Schema v1 on the value (~standard.jsonSchema.input /
.output). When a library keeps conversion outside the schema, use a
first-class subpath or the optional
toJsonSchema
escape hatch.
| Library | How ArkEnv gets JSON Schema |
|---|---|
| Zod (v4.2+) | On the value (Standard JSON Schema v1) |
| VineJS (v4.3+) | On the value (Standard JSON Schema v1) |
Valibot (v1.2+ with @valibot/to-json-schema) | @arkenv/standard/valibot (see Valibot) |
| Zod Mini | @arkenv/standard/zod-mini (mixing) |
| Other Standard JSON Schema v1 validators | On the value |
See Coercion and parsing.
A one-file Env.assert(process.env) works for a hello-world Node
script. ArkEnv adds env-specific errors, automatic coercion, a CLI, and
framework plugins that keep server secrets out of the client graph. See
Why ArkEnv? for DIY, Varlock, T3 Env, znv, Envalid, and
related tools.
Cookbooks
ArkType
@arkenv/core, ArkType DSL, and built-in coercion.
Zod
@arkenv/standard with Zod 4.2+, Zod Mini, or Zod v3.
Valibot
@arkenv/standard/valibot with zero-boilerplate coercion.
@arkenv/core
ArkType engine package reference.
@arkenv/standard
Standard Schema engine package reference.
Defining your schema
Declare field types for either engine.