Introduction
Commands for scaffolding and mutating ArkEnv setup with an interactive CLI.
The ArkEnv CLI provides commands to scaffold a new ArkEnv setup and to mutate an existing one (for example, adding a hosting preset to your schema).
Commands
init
Set up ArkEnv in a project (or create a new one from an example).
npx @arkenv/cli@latest init [project-name] [options]pnpm dlx @arkenv/cli@latest init [project-name] [options]yarn dlx @arkenv/cli@latest init [project-name] [options]bunx @arkenv/cli@latest init [project-name] [options]The command adjusts its workflow depending on where it is executed:
- Existing project: If a
package.jsonexists in the target directory, the CLI configures ArkEnv directly in the project. It scans for any.envor.env.examplefiles to automatically pre-populate the schema fields, installs the selected validator dependencies, and generates theenv.tsfile. - New project: If the target directory does not contain a
package.jsonand is empty, the CLI guides you through creating a new project from an ArkEnv starter template. See our official examples for a list of available templates.
Options
| Flag | Alias | Description |
|---|---|---|
--example | Specify an example name when creating a new project. | |
--force | -f | Bypass checks and force initialization. |
--no-codegen | Disable automatic env.gen.ts code generation for Next.js (falls back to manual runtimeEnv destructuring). | |
--host-preset | -H | Pre-populate the schema with a hosting provider's system env vars (none, vercel, netlify, cloudflare, railway, render, fly). See Hosting presets. |
add host
Add a hosting provider preset (Vercel, Netlify, Cloudflare, Railway, Render, or Fly.io) to an existing schema.
npx @arkenv/cli@latest add host [provider]pnpm dlx @arkenv/cli@latest add host [provider]yarn dlx @arkenv/cli@latest add host [provider]bunx @arkenv/cli@latest add host [provider]See Hosting presets for behavior, interactive selection, and fallbacks when the schema is missing or unparseable.
Global options
These flags apply across commands:
| Flag | Alias | Description |
|---|---|---|
--yes | -y | Skip prompts and use defaults (also passed to subprocesses). For add host, an omitted provider defaults to vercel. |
--quiet | -q | Suppress output logs unless an error occurs. |
--json | -j | Print a structured JSON summary to stdout upon completion. |
--agent | Enable non-interactive, machine-readable mode for AI agents. Bypasses prompts and outputs structured JSON. Macro for --yes --quiet --json. | |
--help | -h | Display the CLI help information. |
When running with --json or --agent, the CLI emits a structured JSON summary you can parse programmatically. See Machine-readable output for the full schema and error codes.