pure build
pure build uploads your project to api.pure.dev, compiles the entry point to
a native binary in the cloud, streams the compile log, and downloads the
finished executable.
pure build <entry> [options]The current directory is packaged as a gzipped tarball and uploaded.
node_modules and .git are excluded, but package.json and your lockfile are
kept so the server-side pre-command can install dependencies. The build never
runs on your machine — no local toolchain is required.
Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
<entry> | Entry file to compile, relative to the source directory (e.g. server.ts or src/main.ts). |
Options
Section titled “Options”| Flag | Default | Description |
|---|---|---|
-o, --out <file> | ./<entry-stem> | Path to write the downloaded binary. For src/main.ts the default is ./main. |
--release | off | Compile with release optimisations. Recommended for production builds. |
--target <kind> | binary | Output artifact: binary (a standalone executable) or node-addon (a Node.js native addon). |
--libc <c> | musl | C library for the compiled binary: musl (fully static, runs on any Linux host) or glibc (dynamically linked, needs glibc on the run host). |
--glibc-version <v> | 2.25 | Minimum glibc version to target, e.g. 2.31. Only valid with --libc glibc — the binary runs on any host with glibc at or above this version. |
--pre <cmd> | — | Pre-command run server-side before compiling, e.g. "npm ci". |
--env KEY=VAL | — | Environment variable for the build sandbox. Repeatable. |
--dir <path> | current dir | Source directory to upload instead of the current directory. |
--api-key <key> | — | API key override (see authentication order). |
--api-url <url> | wss://api.pure.dev/ws | API endpoint override. Also settable via PURE_API_URL. |
Examples
Section titled “Examples”Compile the file in the current directory:
pure build server.tsProduction build to a specific path:
pure build src/main.ts --release --out ./dist/serverCustom install step and build-time environment:
pure build app.ts --pre "npm ci" --env NODE_ENV=production --env TZ=UTCUpload a different directory:
pure build main.ts --dir ./service --releaseWhat it prints
Section titled “What it prints”Progress (upload size, queue position, “Wrote …”) is written to stderr; the streamed compile log is written to stdout. This means you can capture just the compiler output with a normal redirect:
pure build src/main.ts --release > build.logExit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 | Build succeeded and the binary was written |
1 | Invalid arguments, authentication failure, or a build/compile error |
Environment variables
Section titled “Environment variables”| Variable | Description |
|---|---|
PURE_API_KEY | API key to use (overridden by --api-key, overrides pure login). |
PURE_API_URL | API endpoint (overridden by --api-url). |