Command Line Interface

ZX comes with a built-in CLI tool to help you create, develop, and deploy your projects.

Installation

Install the ZX CLI using one of the following methods:

$ curl -fsSL https://ziex.dev/install | bash
> powershell -c "irm ziex.dev/install.ps1 | iex"

Commands

init

Initialize a new ZX project. Creates all the necessary files and directory structure to get started with ZX.

$ zx init [path] [flags]

Arguments

  • [path] — Path to initialize the project in (default: current directory)

Flags

  • --template, -t <name> — Template to use (default: "default"). Options: default, react, wasm, react_wasm
  • --force, -f — Force initialization even if the directory is not empty
Note: The command will warn if the directory is not empty. Use --force to override.

dev

Start the app in development mode with hot reloading. Watches for file changes and automatically rebuilds.

$ zx dev [flags]

Flags

  • --binpath, -b <path> — Binpath of the app (default: auto-detected)
  • --build-args <args> — Additional arguments to pass to zig build

serve

Serve the project for production. Builds and runs the executable.

$ zx serve [flags]

Flags

  • --port, -p <number> — Port to run the server on (default: 3000)

transpile

Transpile .zx files to Zig source code. Useful for debugging or inspecting generated code.

$ zx transpile <path> [flags]

Arguments

  • <path> — Path to .zx file or directory (required)

Flags

  • --outdir, -o <directory> — Output directory (default: ".zx")

fmt Alpha

Format ZX source code files according to ZX's formatting rules.

$ zx fmt [path] [flags]

Arguments

  • [path] — Path to .zx file or directory (optional, formats current directory if not specified)

Flags

  • --stdio — Read from stdin and write to stdout
  • --stdout — Write formatted output to stdout instead of modifying files

export

Generate static site assets. Builds your project and exports it for static hosting.

$ zx export [flags]

Flags

  • --outdir, -o <directory> — Output directory (default: "dist")
  • --binpath, -b <path> — Binpath of the app executable (default: auto-detected)
Note: Run zig build first to build the ZX executable before exporting.

bundle

Bundle the site into a deployable directory with the executable and assets.

$ zx bundle [flags]

Flags

  • --outdir, -o <directory> — Output directory (default: "bundle")
  • --binpath, -b <path> — Binpath of the app executable (default: auto-detected)
Note: Run zig build first to build the ZX executable before bundling.

update

Update the ZX dependency version in your project's build.zig.zon file.

$ zx update [flags]

Flags

  • --version, -v <version> — Version to update to (default: "latest")

upgrade

Upgrade the ZX CLI tool itself. Downloads and installs a new version of the CLI binary.

$ zx upgrade [flags]

Flags

  • --version, -v <version> — Version to upgrade to (default: "latest")

version

Show the current version of the ZX CLI tool.

$ zx version