Typesafe environment variables
with ArkType

Get a strictly typed object from the validator you already use. No boilerplate. Zero dependencies.

“Cool project btw! 👍”

Colin McDonnellCreator of Zod
Works with

Fail-fast at startup

Missing or malformed variables shouldn't silently crash production. ArkEnv fails loudly and early.

Strictly typed

Strict type inference without glue code. Your schema is the single source of truth.

./app.ts
import { env } from "./env";

const db = env.
const port = env.PORT;

Bring your own validator

Use ArkType or any Standard Schema you already have. Mix and match for incremental migration.

./env.ts
export const  = ({
  : "'development' | 'test' | 'production'",
  : .(.(), .()),
  : .(),
});

Full-stack ready

Native integrations for modern frameworks. No server variables leak to the client bundle.

Automatic coercion

Raw environment variables turn into booleans, numbers, and enums based on your schema.

PORT=
"number"
number
DEBUG=
"boolean"
boolean
THEME=
"'light' | 'dark'"
"light" | "dark"

Structured errors

Each issue gets a code that agents and CI can act on. Missing keys and bad values aren't the same.

{
  "success": false,
  "issues": [
    { "path": "HOST", "code": "MISSING_VARIABLE", "message": "" },
    { "path": "PORT", "code": "INVALID_TYPE", "message": "" }
  ]
}

Start validating with ArkEnv