Introduction

Quickly scaffold ArkEnv projects with an interactive CLI.

The ArkEnv CLI is the command-line interface used to initialize and configure ArkEnv in your project.

Usage

Run the CLI using your package manager of choice. The CLI will guide you through the setup process interactively.

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]

Behavior

The CLI automatically 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

Configure the CLI behavior using the following command-line flags:

FlagAliasDescription
--yes-ySkip all prompts and use the default configuration.
--quiet-qSuppress all output logs unless an error occurs.
--json-jPrint a structured JSON summary to stdout upon completion.
--agent-aEnable non-interactive, machine-readable mode for AI agents. Bypasses all prompts and outputs structured JSON. Macro for --yes --quiet --json.
--example-eSpecify an example name when creating a new project.
--force-fBypass checks and force initialization.
--no-codegen-CDisable automatic env.gen.ts code generation for Next.js (falls back to manual runtimeEnv destructuring).
--help-hDisplay the CLI help information.