Skip to content

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.

ArgumentDescription
<entry>Entry file to compile, relative to the source directory (e.g. server.ts or src/main.ts).
FlagDefaultDescription
-o, --out <file>./<entry-stem>Path to write the downloaded binary. For src/main.ts the default is ./main.
--releaseoffCompile with release optimisations. Recommended for production builds.
--target <kind>binaryOutput artifact: binary (a standalone executable) or node-addon (a Node.js native addon).
--libc <c>muslC 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.25Minimum 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=VALEnvironment variable for the build sandbox. Repeatable.
--dir <path>current dirSource directory to upload instead of the current directory.
--api-key <key>API key override (see authentication order).
--api-url <url>wss://api.pure.dev/wsAPI endpoint override. Also settable via PURE_API_URL.

Compile the file in the current directory:

Terminal window
pure build server.ts

Production build to a specific path:

Terminal window
pure build src/main.ts --release --out ./dist/server

Custom install step and build-time environment:

Terminal window
pure build app.ts --pre "npm ci" --env NODE_ENV=production --env TZ=UTC

Upload a different directory:

Terminal window
pure build main.ts --dir ./service --release

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:

Terminal window
pure build src/main.ts --release > build.log
CodeMeaning
0Build succeeded and the binary was written
1Invalid arguments, authentication failure, or a build/compile error
VariableDescription
PURE_API_KEYAPI key to use (overridden by --api-key, overrides pure login).
PURE_API_URLAPI endpoint (overridden by --api-url).