@arkenv/standard
ArkType-free environment validation via Standard Schema.
@arkenv/standard is the ArkType-free validation engine. First-class
support is Zod and Valibot. It consumes
Standard Schema validators. Libraries
that only implement the validate hook may still need a toJsonSchema
helper or a dedicated subpath (for example @arkenv/standard/valibot).
The root import has no runtime dependencies or peers.
Already on ArkType?
Use @arkenv/core instead. ArkType strings
belong on that engine, not wrapped through this one.
TypeScript must use moduleResolution: "bundler" | "node16" | "nodenext".
Installation
Install the engine next to Zod or Valibot. It does not pull in
arktype.
npm 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
The main entry is the throw-path runtime. Issue helpers and the non-throwing parser live on subpaths so the default import stays small.
| Export | Kind | Role |
|---|---|---|
arkenv | function (default + named) | Validate a Standard Schema field map |
ArkEnvError | class | Thrown on validation failure |
SafeArkEnvResult | type | Result shape returned by @arkenv/standard/safe |
StandardEnvConfig | type | Extends core options with toJsonSchema |
Subpaths
Issue formatting and the non-throwing parser are separate entries.
| Import | Role |
|---|---|
@arkenv/standard | Root engine (throw path). Dependency-free. Zod works zero-config. |
@arkenv/standard/issues | formatIssues, getSchemaKeys, and EnvIssue / EnvIssueCode / EnvIssueMeta |
@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 = (
{ : ..() },
{ : { PORT: "invalid" } },
);
if (!.) {
console.error(.);
}import { } from "@arkenv/standard/valibot";
import * as from "valibot";
export const = ({
PORT: .optional(.number(), 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.