- Category
- Developer Tools
- Rank
- No. 196Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- GitHub
- 45.7k stars
- Latest release
- 8.8.5
- Date
About
Google's JavaScript scripting tool with $`shell` template literals, top-level await, and fetch — a friendlier alternative to Bash for Node.js developers.
What it does
zx turns JavaScript or TypeScript into a practical shell scripting environment. It runs commands through an available shell, safely quotes interpolated arguments, captures process results, and supplies helpers for files, prompts, retries, temporary data, and network requests.
Why it's ranked here
It is a strong choice when shell scripts have outgrown simple command chains. Structured language features, typed package exports, configurable process execution, and automatic argument quoting address common scripting pain without hiding the underlying shell.
What's good
Interpolated values are quoted for the active shell, reducing accidental command parsing. Commands return rich promise-like results with captured output, exit status, signals, timing, piping, timeouts, and abort support. Scripts can also run from standard input, remote URLs, or Markdown code fences.
Tradeoffs
It still requires Bash or PowerShell, so portability depends on the selected shell and installed commands. Remote script execution and optional dependency installation expand the trust boundary. Global injection is convenient but makes dependencies less explicit, while process behavior offers enough options to require careful defaults.
How to use it well
Use zx for deployment scripts, repository automation, and command orchestration when the team already works comfortably in JavaScript or TypeScript. Prefer explicit imports for reusable modules and globals for short scripts. It does not replace the shell, provide missing system commands, or serve as a general workflow scheduler.
Technical notes+
package.json defines an ESM package with CommonJS, ESM, declaration, CLI, globals, and core export surfaces. src/cli.ts parses flags, loads environment files, accepts files, stdin, HTTP URLs, evaluation strings, and Markdown, then imports the prepared script. src/core.ts wraps child-process execution in ProcessPromise and ProcessOutput, using AsyncLocalStorage for scoped options plus configurable spawning, logging, piping, timeouts, signals, and synchronous execution. src/md.ts converts JavaScript fences directly, shell fences into awaited command templates, and other prose into comments. src/deps.ts detects imports and can install npm dependencies without saving them. src/globals.ts exposes the package API through globalThis.
Observed
- License
- Apache-2.0
- Primary language
- TypeScript source compiled for JavaScript runtimes
- Install surface
- Published as the npm package zx and installed with npm
- Interfaces
- Command-line executable and importable library
- Module formats
- ESM and CommonJS exports with TypeScript declarations
- Platform support
- Linux, macOS, and Windows
- Runtime support
- Node.js, Bun, Deno, and GraalVM Node.js
- Shell requirement
- Requires Bash or PowerShell
Read from README.md, package.json, src/cli.ts, src/index.ts, src/md.ts, src/log.ts, src/core.ts, src/deps.ts, src/repl.ts, src/util.ts, src/error.ts, src/goods.ts, src/vendor.ts, src/globals.ts, src/versions.ts.
What it can do
Execute shell commands with template literals
JavaScript code with $`shell command` syntax → Command execution results
Run asynchronous operations at top level
JavaScript code with await statements outside functions → Resolved promise values
Make HTTP requests
URLs and request parameters → HTTP response data
Process command output with JavaScript
Shell command results and JavaScript processing logic → Transformed or filtered data
Create cross-platform shell scripts
JavaScript code using zx utilities → Executable scripts that work across operating systems
Chain multiple shell commands
Sequence of shell commands in JavaScript syntax → Combined command execution results
Tags
Tech Stack
Media

Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.
