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.json exists in the target directory, the CLI configures ArkEnv directly in the project. It scans for any .env or .env.example files to automatically pre-populate the schema fields, installs the selected validator dependencies, and generates the env.ts file.
  • New project: If the target directory does not contain a package.json and 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

FlagAliasDescription
--exampleSpecify an example name when creating a new project.
--force-fBypass checks and force initialization.
--no-codegenDisable automatic env.gen.ts code generation for Next.js (falls back to manual runtimeEnv destructuring).
--host-preset-HPre-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:

FlagAliasDescription
--yes-ySkip prompts and use defaults (also passed to subprocesses). For add host, an omitted provider defaults to vercel.
--quiet-qSuppress output logs unless an error occurs.
--json-jPrint a structured JSON summary to stdout upon completion.
--agentEnable non-interactive, machine-readable mode for AI agents. Bypasses prompts and outputs structured JSON. Macro for --yes --quiet --json.
--help-hDisplay 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.