Repolode
google

google/zx

A JavaScript-based tool for writing shell-style scripts, wrapping child_process with safe argument escaping and cross-platform helpers.

Stars
45,813
Forks
1,320
Open issues
22
Last commit
9 days ago

What is it?

zx lets you write scripts in JavaScript while running shell commands with a concise syntax. Its `$` template tag executes commands, escapes interpolated arguments automatically, and returns the output, so common Bash tasks like piping, parallel execution and file operations become ordinary code.

The package wraps Node.js child_process with cross-platform helpers and sensible defaults, removing much of the boilerplate needed to spawn processes directly. It works on Linux, macOS and Windows, and runs on Node.js, Bun, Deno and GraalVM Node.js, with either Bash or PowerShell as the underlying shell.

It supports both CommonJS and ESM modules, as well as JavaScript and TypeScript projects. A lighter zx@lite variant is also available.

Key features

  • 01Runs shell commands via a `$` template tag with automatic argument escaping.
  • 02Provides cross-platform wrappers around Node.js child_process.
  • 03Supports Bash and PowerShell as the underlying shell.
  • 04Works with Node.js, Bun, Deno and GraalVM Node.js.
  • 05Supports both CommonJS and ESM, in JavaScript or TypeScript.

Use cases

  • Writing deployment or build scripts that call git, docker or other CLI tools.
  • Running multiple shell commands in parallel from a single Node.js script.
  • Replacing complex Bash scripts with maintainable JavaScript or TypeScript code.

Quick start

  1. 1

    Install zx with npm

    npm install zx
  2. 2

    Write a script using the zx API and run it with the zx command as shown in the documentation

Things to know

  • The README's setup and usage details are only in external documentation, so getting started requires reading the linked docs.

Topics

FAQ

What is zx?
A JavaScript-based tool for writing shell-style scripts, wrapping child_process with safe argument escaping and cross-platform helpers. zx lets you write scripts in JavaScript while running shell commands with a concise syntax. Its `$` template tag executes commands, escapes interpolated arguments automatically, and returns the output, so common Bash tasks like piping, parallel execution and file operations become ordinary code.
Is zx free to use? What license does it have?
zx is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
Is zx still maintained?
Actively maintained. The last commit to zx was on Oct 12, 2026.
What can I use zx for?
Writing deployment or build scripts that call git, docker or other CLI tools. Running multiple shell commands in parallel from a single Node.js script. Replacing complex Bash scripts with maintainable JavaScript or TypeScript code.
How do I install zx?
Install zx with npm: npm install zx Write a script using the zx API and run it with the zx command as shown in the documentation
Where can I get zx?
The source code and installation instructions are on GitHub: https://github.com/google/zx

Summary generated by AI from the project's README. GitHub stats refresh daily.

Related projects