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

“Cool project btw! 👍”
Fail-fast at startup
Missing or malformed variables shouldn't silently crash production. ArkEnv fails loudly and early.
npm run dev
ArkEnvError: Errors found while validating environment variables
DATABASE_URL must be a URL string (was [REDACTED])
PORT must be a number (was a string)Strictly typed
Strict type inference without glue code. Your schema is the single source of truth.
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.
export const = ({
: "'development' | 'test' | 'production'",
: .(.(), .()),
: .(),
});Full-stack ready
Native integrations for modern frameworks. No server variables leak to the client bundle.
Runtime Error
Do not access server-only key 'DATABASE_URL' on the client since it will leak sensitive data (prevented by ArkEnv)
5 <span>{env.DATABASE_URL}</span>Automatic coercion
Raw environment variables turn into booleans, numbers, and enums based on your schema.
"number"number"boolean"boolean"'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": "" }
]
}