@arkenv/standard
ArkType-free environment validation via Standard Schema.
@arkenv/standard is the Standard Schema validation engine. It validates environment variables with any
Standard Schema validator (Zod, Valibot,
and others). The root import has no runtime dependencies or peers.
- If you use ArkType, use
@arkenv/core. It also supports Zod and Valibot. You do not need to install both engines. - If you don't use ArkType, use
@arkenv/standard. This will keep your tree free of thearktypedependency.
TypeScript must use moduleResolution: "bundler" | "node16" | "nodenext".
Installation
npm install @arkenv/standardpnpm add @arkenv/standardyarn add @arkenv/standardbun install @arkenv/standardUsage
import from "@arkenv/standard";
import * as from "zod";
export const = ({
: .().(0).(65535).(3000),
: .(),
: .(["development", "production", "test"]).("development"),
});Compared to @arkenv/core
Both engines share arkenv() options, errors, and framework plugins.
They differ in schema style and peers.
@arkenv/core | @arkenv/standard | |
|---|---|---|
| Validator | ArkType DSL + type() | Standard Schema map only |
Keywords (string.host, number.port) | Yes | No |
Peer arktype | Required | None |
| Options | ArkEnvConfig | StandardEnvConfig (ArkEnvConfig plus toJsonSchema) |
| Coercion | Built-in for ArkType shapes | Standard JSON Schema on the value, or @arkenv/standard/valibot / /zod-mini / toJsonSchema |
Exports
These are the public names from @arkenv/standard.
| Export | Kind | Role |
|---|---|---|
arkenv | function (default + named) | Validate a Standard Schema field map |
ArkEnvError | class | Thrown on validation failure |
formatIssues | function | Format issues |
getSchemaKeys | function | List schema keys |
| Config / issue types | types | StandardEnvConfig extends core options with toJsonSchema |
Subpaths
| Import | Role |
|---|---|
@arkenv/standard | Root engine (throw path). Dependency-free. Zod works zero-config. |
@arkenv/standard/safe | arkenv — result object instead of a throw (default + named export) |
@arkenv/standard/valibot | Same arkenv, pre-configured for Valibot. valibot + @valibot/to-json-schema are required. |
@arkenv/standard/zod-mini | Same arkenv, pre-configured for Zod Mini. zod is required. |
import from "@arkenv/standard/safe";
import * as from "zod";
const = (
{ : ..() },
{ : { : "invalid" } },
);
if (!.) {
.(.);
}import { } from "@arkenv/standard/valibot";
import * as from "valibot";
export const = ({
: .(.(), 3000),
});Framework /standard subpaths
Next.js, Nuxt, Vite, and Bun ship /standard (and related) entries that
pair with this package. See each package reference for import paths.