Core concepts
Design, parse, and secure environment variables with ArkEnv.
Missing or malformed environment variables fail as early as ArkEnv can
see them: in next build, during Vite or Bun plugin runs, on server
boot, and anywhere else you call arkenv().
These guides take you through designing a schema, parsing values, and keeping secrets off the client. They are meant to be read in order the first time. Skip ahead once you know which slice you need.
By the time you've read this section, you'll have a typed env object
and a clear client/server split.
ArkEnv validates and types your environment. Loading .env files is
still your runtime or framework's job. See
Loading .env files.
From schema to env
Start here if you're writing a schema for the first time.
1. Defining your schema
Where env.ts lives, field types, fail-fast validation, and the typed env object.
2. Client vs. server
Keep public keys and private secrets in separate buckets.
3. Coercion and parsing
Numbers, booleans, arrays, objects, and transforms.
4. Error reporting
Fail fast with clear console output and issue codes.
5. Reusing schemas
Share one schema across runtimes and packages.
6. Hosting presets
Add Vercel, Netlify, Cloudflare, and other provider vars.
Next steps
Wire a runtime with the framework guides, pick an engine under validators, or skim the thinner Guides section for AI and migrations.